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
Create an integration for the specified app.
def create_integration(app_id, integration_create_body, opts = {}) data, _status_code, _headers = create_integration_with_http_info(app_id, integration_create_body, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_integration_with_http_info(app_id, integration_create_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.create_integration ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.create_integration\"\n end\n # verify the required parameter 'integration_create_body' is set\n if @api_client.config.client_side_validation && integration_create_body.nil?\n fail ArgumentError, \"Missing the required parameter 'integration_create_body' when calling IntegrationApi.create_integration\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations\".sub('{' + 'appId' + '}', app_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(integration_create_body)\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 => 'IntegrationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#create_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_for_app(app_auth_request = nil)\n build_request(app_auth_request || { api_key: @api_key, client_secret: @secret },\n Requests::AuthenticateApp).\n send_to_api(:post, endpoint_path)\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def app(create=false)\r\n @app_integration_instance = nil if create\r\n @app_integration_instance ||= new_session do |sess|\r\n sess.host! \"www.example.com\"\r\n end\r\nend", "def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end", "def create_integration(auth, server_id, type, id)\n MijDiscord::Core::API.request(\n :guilds_sid_integrations,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations\",\n { type: type, id: id }.to_json,\n Authorization: auth\n )\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end", "def create\n @cargapp_integration = CargappIntegration.new(cargapp_integration_params)\n\n respond_to do |format|\n if @cargapp_integration.save\n format.html { redirect_to @cargapp_integration, notice: 'Cargapp integration was successfully created.' }\n format.json { render :show, status: :created, location: @cargapp_integration }\n else\n format.html { render :new }\n format.json { render json: @cargapp_integration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new app_params\n @app.user = current_user\n \n if @app.valid?\n\n openid_client = Services::OpenIdConnectionService.new(@app).register\n\n\n if openid_client[\"client_id\"].present?\n @app.openid_client_id = openid_client[\"client_id\"]\n @app.openid_client_secret = openid_client[\"client_secret\"]\n @app.openid_client_access_token = openid_client[\"registration_access_token\"]\n @app.save\n end\n end\n\n respond_to do |format|\n if @app.persisted?\n format.html { redirect_to app_path(@app), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(opts)\n app = nil\n scope = select_scope(opts[:scope])\n\n assets = Asset.accessible_by_user(user).\n where(\n state: Asset::STATE_CLOSED,\n uid: opts[:ordered_assets],\n )\n\n App.transaction do\n app_series = create_app_series(opts[:name], scope)\n release = opts.fetch(:release, UBUNTU_16)\n revision = app_series.latest_revision_app.try(:revision).to_i + 1\n\n applet_dxid = new_applet(\n opts.slice(\n :input_spec,\n :output_spec,\n :code,\n :instance_type,\n :packages,\n :internet_access,\n ),\n release,\n )\n\n app_dxid = new_app(\n opts.slice(\n :name,\n :title,\n :internet_access,\n :readme,\n ).merge(\n applet_dxid: applet_dxid,\n asset_dxids: assets.map(&:dxid),\n revision: revision,\n scope: scope,\n ),\n )\n\n api.project_remove_objects(project, [applet_dxid])\n\n app = App.create!(\n dxid: app_dxid,\n version: nil,\n revision: revision,\n title: opts[:title],\n readme: opts[:readme],\n entity_type: opts[:entity_type] || App::TYPE_REGULAR,\n user: user,\n scope: scope,\n app_series: app_series,\n input_spec: opts[:input_spec],\n output_spec: opts[:output_spec],\n internet_access: opts[:internet_access],\n instance_type: opts[:instance_type],\n ordered_assets: opts[:ordered_assets],\n packages: opts[:packages],\n code: opts[:code].strip,\n assets: assets,\n release: release,\n )\n\n app_series.update!(latest_revision_app: app)\n app_series.update!(latest_version_app: app) if Space.valid_scope?(scope)\n app_series.update!(deleted: false) if app_series.deleted?\n\n Event::AppCreated.create_for(app, user)\n end\n\n app\n end", "def new_app(opts)\n api.app_new(\n applet: opts[:applet_dxid],\n name: AppSeries.construct_dxname(user.username, opts[:name], opts[:scope]),\n title: \"#{opts[:title]} \",\n summary: \" \",\n description: \"#{opts[:readme]} \",\n version: \"r#{opts[:revision]}-#{SecureRandom.hex(3)}\",\n resources: opts[:asset_dxids],\n details: { ordered_assets: opts[:asset_dxids] },\n openSource: false,\n billTo: bill_to,\n access: opts[:internet_access] ? { network: [\"*\"] } : {},\n )[\"id\"]\n end", "def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end", "def create_guild_integration(guild_id, type:, id:)\n request(\n :guilds_gid_integrations, guild_id,\n :post,\n \"guilds/#{guild_id}/integrations\",\n type: type, id: id,\n )\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def setupApp(pia_url, app_key, app_secret)\n token = getToken(pia_url, app_key, app_secret)\n { \"url\" => pia_url,\n \"app_key\" => app_key,\n \"app_secret\" => app_secret,\n \"token\" => token }\nend", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create\n @mobile_app = create_app\n if @mobile_app.present? && @mobile_app['identifier'].present?\n @api_key = create_api_key @mobile_app['identifier']\n end\n redirect_to \"/\", flash: { error_message: @error_message }\n end", "def create\n @integration = Integration.new(integration_params)\n @integration.status = 200\n\n respond_to do |format|\n if @integration.save\n current_user.integrations.push(@integration)\n current_user.save\n #format.html { redirect_to @integration, notice: 'Integration was successfully created.' }\n format.json { render json: @integration, status: :created }#, location: @integration }\n else\n format.html { render action: 'new' }\n format.json { render json: @integration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(name, redirect_uri, scopes = 'read', website = nil)\n perform_request_with_object(:post, '/api/v1/apps',\n {\n client_name: name,\n redirect_uris: redirect_uri,\n scopes: scopes,\n website: website\n }, Mastodon::App)\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end", "def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n client.create_application!(name: name,\n primary_language: primary_language,\n sku: sku,\n bundle_id: bundle_id,\n bundle_id_suffix: bundle_id_suffix,\n company_name: company_name,\n platform: platform,\n platforms: platforms,\n itunes_connect_users: itunes_connect_users)\n end", "def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def ajax_mf_app_create\n\n domain = params[:domain] + \".myshopify.com\"\n from_email = params[:domain] + \"@custprotection.com\"\n\n digest = OpenSSL::Digest.new('sha256')\n token = Base64.encode64(OpenSSL::HMAC.digest(digest, ENV['SECRET_KEY_BASE'], params[:domain])).strip\n app = App.create(user_id: params[:user_id], name: domain, auth_token: token, from_email: from_email)\n\n response = {\n success: true,\n url: app.name,\n message: 'App Created!'\n }\n\n render json: response\n\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:create] == 'existing'\n @app = App.new(app_params)\n origin = @apps.find(params[:origin])\n\n @app.runtime = origin.runtime.dup\n @app.android_config = origin.android_config.dup\n @app.ios_config = origin.ios_config.dup\n @app.android_icon = origin.android_icon.dup\n @app.ios_icon = origin.ios_icon.dup\n\n @app.splash = origin.splash.dup\n\n @app.android_config['origin'] = origin.id\n @app.ios_config['origin'] = origin.id\n @app.android_config.delete('bundle_id')\n @app.ios_config.delete('bundle_id')\n\n @app.duplicate_files(origin)\n else\n @app = App.new(app_params)\n end\n\n @app.user = current_user\n\n if @app.save\n if origin\n origin.assets.each do |item|\n asset = Asset.new\n asset.app_id = @app.id\n asset.slug = item.slug\n asset.duplicate_file(item)\n asset.save!\n end\n end\n end\n\n respond_modal_with @app, location: @app\n end", "def create_integration_installation_access_token(installation, options = {})\n opts = ensure_api_media_type(:integrations, options)\n post \"/installations/#{installation}/access_tokens\", opts\n end", "def create\n @customer_app = CustomerApp.new(customer_app_params)\n @customer_app.auth_account_id = active_account.id\n\n if @customer_app.save\n render :show, status: :created, location: @customer_app\n else\n render json: @customer_app.errors, status: :unprocessable_entity\n end\n end", "def create_application(client, options)\n if options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n application = client.applications.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Application created.\"\n\n #TODO: Add exception handling\nend", "def create_omniauth\n omniauth_params = request.env['omniauth.params']\n org_uid = omniauth_params['state'] if omniauth_params\n response = request.env['omniauth.auth']\n\n return redirect_to root_url unless is_admin && org_uid && response\n\n shop_name = response.uid\n current_organization.from_omniauth(response)\n\n current_organization.instance_url = \"https://#{shop_name}/admin\"\n\n unless current_organization.save\n flash[:alert] = \"Oops, your account could not be linked. #{format_errors(current_organization)}\"\n return redirect_to root_url\n end\n\n token = response['credentials']['token']\n session[:show_popup] = !is_same_currency\n\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n redirect_to root_url\n\n rescue Shopify::Webhooks::WebhooksManager::CreationFailed => e\n Maestrano::Connector::Rails::ConnectorLogger.log('warn', current_organization, \"Webhooks could not be created: #{e}\")\n redirect_to root_url\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @integration = Integration.new(params[:integration])\n if @integration.save\n redirect_to user_integration_path(@user, @integration), notice: 'Integration was successfully created.'\n else\n fetch_projects\n fetch_clients\n render action: \"new\"\n end\n end", "def ext_create(opts = {})\n ext_api = ActiveExtAPI::StoreCreate.new self\n ext_api.create opts\n end", "def create\n params[:app][:user_id] = current_user.id\n @app = App.create(params[:app])\n if @app.save\n redirect_to source_app_path(@app), notice: 'app was successfully created.'\n else\n render :new\n end\n end", "def create\n @payment_app = PaymentApp.new(payment_app_params)\n respond_to do |format|\n if @payment_app.save\n format.html { redirect_to @payment_app, notice: 'Payment app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @payment_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n session[:current_api_token] = @app.api_token\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { \n @apps = App.all\n render action: \"index\" \n }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n flash[:success] = 'App was successfully saved.'\n format.html { redirect_to @app }\n format.json { render :show, status: :created, location: @app }\n else\n flash[:danger] = 'There was a problem creating the App Catalog Page.'\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_google_apps\n GoogleApps.new(self).generate\n end", "def create_webhooks_integration(body, opts = {})\n data, _status_code, _headers = create_webhooks_integration_with_http_info(body, opts)\n data\n end", "def create_omniauth\n omniauth_params = request.env['omniauth.params']\n if omniauth_params && org_uid = omniauth_params['state']\n organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(org_uid, current_user.tenant)\n if organization && is_admin?(current_user, organization) && response = request.env['omniauth.auth']\n shop_name = response.uid\n organization.from_omniauth(response)\n organization.instance_url = \"https://#{shop_name}/admin\"\n organization.save!\n\n token = response['credentials']['token']\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n\n end\n end\n redirect_to root_url\n end", "def create\n @app_instance = AppInstance.new(app_instance_params)\n\n respond_to do |format|\n if @app_instance.save\n format.html { redirect_to @app_instance, notice: 'App instance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @app_instance }\n else\n format.html { render action: 'new' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end", "def create(*args)\n if !self.is_?(App)\n self.app_name = HesCentral.application_repository_name\n end\n super(*args)\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @erp_integration = ErpIntegration.new(erp_integration_params)\n\n respond_to do |format|\n if @erp_integration.save\n format.html { redirect_to @erp_integration, notice: 'Erp integration was successfully created.' }\n format.json { render :show, status: :created, location: @erp_integration }\n else\n format.html { render :new }\n format.json { render json: @erp_integration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end", "def create\n @cotiz_app = CotizApp.new(cotiz_app_params)\n\n respond_to do |format|\n if @cotiz_app.save\n format.html { redirect_to cotiz_app_path(@cotiz_app), notice: 'Cotiz app was successfully created.' }\n format.json { render :show, status: :created, location: @cotiz_app }\n else\n format.html { render :new }\n format.json { render json: @cotiz_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_subscription(payment_intent_id)\n result = ChargeBee::Subscription.create({\n plan_id: '<chargebee-plan-id>',\n auto_collection: 'on',\n payment_intent: {\n gateway_account_id: '<checkout.com-gateway-id>',\n gw_token: payment_intent_id\n }\n })\n subscription = result.subscription\n puts \"Chargebee subscription ID: #{subscription.id} created for Checkout.com payment ID: #{payment_intent_id}\"\n end", "def register_application(app_name, namespace, public_hostname)\n # curl -X POST https://dnsapi.cn/Record.Create -d 'login_email=api@dnspod.com&login_password=password&format=json&domain_id=2317346&sub_domain=@&record_type=A&record_line=默认&value=1.1.1.1'\n\n # create an A record for the application in the domain\n hostname = \"#{app_name}-#{namespace}\"\n url = \"https://dnsapi.cn/Record.Create\"\n params = common_params.merge({\n :domain_id => @domain_id,\n :sub_domain => hostname,\n :record_type => 'A',\n :record_line => '默认',\n :value => public_hostname\n })\n\n res = @http.post(url, params)\n res = JSON.parse(res.content)\n puts res\n\n result = JSON.parse(response.body)\n result.status['message']\n #{\n # \"status\": {\n # \"code\":\"1\",\n # \"message\":\"Action completed successful\",\n # \"created_at\":\"2012-11-23 22:17:47\"\n #},\n # \"record\": {\n # \"id\":\"16894439\",\n # \"name\":\"@\",\n # \"status\":\"enable\"\n #}\n #}\n\n end", "def add_webauthn_device(app_id, user, fake_device = nil, name: 'My device')\n fake_device ||= WebAuthn::FakeClient.new(app_id)\n\n options_for_create = WebAuthn::Credential.options_for_create(\n user: { id: user.webauthn_xid, name: user.username },\n authenticator_selection: { user_verification: 'discouraged' },\n rp: { name: 'GitLab' }\n )\n challenge = options_for_create.challenge\n\n device_response = fake_device.create(challenge: challenge).to_json # rubocop:disable Rails/SaveBang\n device_registration_params = { device_response: device_response,\n name: name }\n\n Webauthn::RegisterService.new(\n user, device_registration_params, challenge).execute\n FakeWebauthnDevice.new(page, name, fake_device)\n end", "def create\n @app_request = AppRequest.new(app_request_params)\n @app_request.order_uid = SecureRandom.uuid\n\n tm_response = faraday.post do |req|\n req.url uri.path\n req.headers['Content-Type'] = 'application/json'\n req.headers['X-API-KEY'] = @app_request.public_key\n req.body = @app_request.to_json\n end\n\n if tm_response.success? && @app_request.save\n redirect_to tm_response.body\n else\n errors = JSON.parse(tm_response.body)['errors']\n errors.each do |e|\n @app_request.errors.add(:base, e)\n end\n\n respond_to do |format|\n format.html {\n render :new, error: tm_response.body\n }\n end\n end\n end", "def create(cli = false)\n $logger.info(\"Creating new gear #{@uuid} for application #{@app.name}\")\n\n if cli\n command = %Q(oo-devel-node app-create -c #{uuid} -a #{@app.uuid} --with-namespace #{@app.account.domain} --with-app-name #{@app.name} --with-secret-token=DEADBEEFDEADBEEFDEADBEEFDEADBEEF)\n $logger.info(%Q(Running #{command}))\n results = %x[#{command}]\n assert_equal(0, $?.exitstatus, %Q(#{command}\\n #{results}))\n end\n\n # Create the container object for use in the event listener later\n begin\n @container = OpenShift::Runtime::ApplicationContainer.new(@app.uuid, @uuid, nil, @app.name, @app.name, @app.account.domain, nil, nil)\n rescue Exception => e\n $logger.error(\"#{e.message}\\n#{e.backtrace}\")\n raise\n end\n\n unless cli\n @container.create('DEADBEEFDEADBEEFDEADBEEFDEADBEEF')\n end\n end", "def register_app(apk, bundle_id, env = \"dev\")\n if apk.nil?\n UI.error(\"Specify the APK you want to run and register in crashlytics. Provide the filename only, not the full path.\")\n exit(1)\n end\n\n if bundle_id.nil?\n UI.error(\"Specify the bundle_id of the app you want to run and register in crashlytics.\")\n exit(1)\n end\n\n avd = getAvdEmulator\n\n # Register the app in crashlytics by starting it\n sh(\"./register.sh #{apk} #{bundle_id} #{avd} #{env}\")\nend", "def get_integration_with_http_info(app_id, integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.get_integration ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.get_integration\"\n end\n # verify the required parameter 'integration_id' is set\n if @api_client.config.client_side_validation && integration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling IntegrationApi.get_integration\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations/{integrationId}\".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_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 = ['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 => 'IntegrationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#get_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create!(bundle_id: nil, name: nil, mac: false)\n new_website_push = client.create_website_push!(name, bundle_id, mac: mac)\n self.new(new_website_push)\n end", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create_application_payment\n Payment.new application: self,\n amount: self.calculate_fee,\n description: \"Application fee (#{pluralize self.course_selections_count, 'course'})\"\n end", "def create\n @app = App::Gcm::App.find_by_name(params[:app_name])\n @app_user = @app.app_users.build(app_params)\n @app_user.app_id = @app.id\n @app_user.app_name = @app.name\n respond_to do |format|\n if @app_user.save\n format.html { redirect_to ({action:'show', id:@app_user.id}), notice: 'App user was successfully created.' }\n format.json { render json: @app_user, status: :created, location: {:action => 'show', id:@app_user.id} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_integration_action(id, body, opts = {})\n data, _status_code, _headers = create_integration_action_with_http_info(id, body, opts)\n return data\n end", "def create_app_profile instance_id, app_profile_id, app_profile, ignore_warnings: nil\n instances.create_app_profile parent: instance_path(instance_id),\n app_profile_id: app_profile_id,\n app_profile: app_profile,\n ignore_warnings: ignore_warnings\n end", "def create\n backend_api = current_account.backend_apis.create(create_params)\n respond_with(backend_api)\n end", "def convert_with_rest!(publisher_app, params={})\n # Create the app object with the item id of the offer, which is what will point to the app that this install offer wants you to install.\n # Install offers that aren't the primary offer for an app will not have their id and their app's id match, but the offer's item_id will\n # always be the app that this offer is for.\n raise \"item_id is nil so we don't know which app we are converting. This is a bug in test_chamber\" unless item_id\n advertiser_app = TestChamber::App.new(id: item_id)\n advertiser_app.open_app\n end", "def register_application(app_name, namespace, public_hostname)\n\n # create an A record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # create an update record\n\n update = {\n :comment => \"Add an application record for #{fqdn}\",\n :changes => [change_record(\"CREATE\", fqdn, @ttl, public_hostname)]\n }\n \n res = r53.change_resource_record_sets({\n :hosted_zone_id => @aws_hosted_zone_id,\n :change_batch => update\n })\n end", "def intercom\n intercom = Intercom::Client.new(app_id: 'ahd0euu5', api_key: 'b505f64477d12b3375524315399786d54e28f9b7')\n end", "def add_application(app)\n app = DoesFacebook::Application.new(app) if app.is_a?(Hash)\n @applications << app\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def sign_up\n NexaasID::Resources::SignUp.new(api_token, config)\n end", "def register_integration(name, version)\n meta = { name: \"sentry.ruby.#{name}\", version: version }.freeze\n integrations[name.to_s] = meta\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def call(access_token)\n # Configure which events you want to subscribe to\n # See https://developer.aircall.io/api-references/#events\n events = ['call.created']\n\n aircall_client.create_webhook(access_token: access_token, events: events)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def list_integrations_with_http_info(app_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.list_integrations ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.list_integrations\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations\".sub('{' + 'appId' + '}', app_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'types'] = opts[:'types'] if !opts[:'types'].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 = ['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 => 'ListIntegrationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#list_integrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_app_notification(fb_user_id, template, href = \"\")\n uri = og_uri(fb_user_id, \"notifications\")\n post_to_og(uri, :access_token => access_token, :template => template, :href => href)\n end", "def create_webhooks_integration_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.create_webhooks_integration ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling WebhooksIntegrationAPI.create_webhooks_integration\"\n end\n # resource path\n local_var_path = '/api/v1/integration/webhooks/configuration/webhooks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'WebhooksIntegration'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :create_webhooks_integration,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhooksIntegrationAPI#create_webhooks_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @admin_app = App.new(admin_app_params)\n\n respond_to do |format|\n if @admin_app.save\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @admin_app] }\n else\n format.html { render :new }\n format.json { render json: [:admin, @admin_app].errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create!(name: nil, bundle_id: nil, certificate: nil, devices: [], mac: false, sub_platform: nil, template_name: nil)\n raise \"Missing required parameter 'bundle_id'\" if bundle_id.to_s.empty?\n raise \"Missing required parameter 'certificate'. e.g. use `Spaceship::Portal::Certificate::Production.all.first`\" if certificate.to_s.empty?\n\n app = Spaceship::Portal::App.find(bundle_id, mac: mac)\n raise \"Could not find app with bundle id '#{bundle_id}'\" unless app\n\n raise \"Invalid sub_platform #{sub_platform}, valid values are tvOS\" if !sub_platform.nil? && sub_platform != 'tvOS'\n\n # Fill in sensible default values\n name ||= [bundle_id, self.pretty_type].join(' ')\n\n if self == AppStore || self == InHouse || self == Direct\n # Distribution Profiles MUST NOT have devices\n devices = []\n end\n\n certificate_parameter = certificate.collect(&:id) if certificate.kind_of?(Array)\n certificate_parameter ||= [certificate.id]\n\n # Fix https://github.com/KrauseFx/fastlane/issues/349\n certificate_parameter = certificate_parameter.first if certificate_parameter.count == 1\n\n if devices.nil? || devices.count == 0\n if self == Development || self == AdHoc\n # For Development and AdHoc we usually want all compatible devices by default\n if mac\n devices = Spaceship::Portal::Device.all_macs\n elsif sub_platform == 'tvOS'\n devices = Spaceship::Portal::Device.all_apple_tvs\n else\n devices = Spaceship::Portal::Device.all_ios_profile_devices\n end\n end\n end\n\n profile = client.with_retry do\n client.create_provisioning_profile!(name,\n self.type,\n app.app_id,\n certificate_parameter,\n devices.map(&:id),\n mac: mac,\n sub_platform: sub_platform,\n template_name: template_name)\n end\n\n self.new(profile)\n end", "def create\n name = shift_argument\n url = shift_argument\n\n unless name && url\n raise(Heroku::Command::CommandFailed, \"Usage: clients:register [NAME] [CALLBACK_URL]\")\n end\n\n validate!(url)\n client = request do\n api.request(\n :body => encode_json(\n { :name => name, :redirect_uri => url }),\n :expects => 201,\n :headers => headers,\n :method => :post,\n :path => \"/oauth/clients\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Registered client \"#{name}\".})\n styled_hash(client)\n end\n end", "def create_app_profile \\\n instance_id,\n app_profile_id,\n app_profile,\n ignore_warnings: nil\n execute do\n instances.create_app_profile(\n instance_path(instance_id),\n app_profile_id,\n app_profile,\n ignore_warnings: ignore_warnings\n )\n end\n end", "def create_app_series(app_name, scope)\n app_series_dxid = AppSeries.construct_dxid(user.username, app_name, scope)\n\n AppSeries.create_with(\n name: app_name,\n user: user,\n scope: scope,\n ).find_or_create_by(\n dxid: app_series_dxid,\n )\n end", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create_new_app\n rake 'install --trace'\n FileUtils.rm_rf(rails_app)\n sh \"relevance_rails new #{rails_app} --database=#{database} --relevance-dev\"\n end" ]
[ "0.6851142", "0.6613742", "0.6320141", "0.6286776", "0.6243598", "0.61107016", "0.6092274", "0.60061455", "0.59643096", "0.5952713", "0.5895749", "0.5852185", "0.57128704", "0.5695547", "0.5677204", "0.56629384", "0.56376237", "0.5623359", "0.56065327", "0.56010187", "0.55648816", "0.5521196", "0.55172545", "0.5503504", "0.5500473", "0.54837", "0.54794455", "0.54732835", "0.54705644", "0.54598314", "0.5457293", "0.54537135", "0.5436643", "0.5408191", "0.5401126", "0.5396905", "0.53926355", "0.53926355", "0.5377887", "0.5353853", "0.5341364", "0.5325654", "0.5295436", "0.5292006", "0.52865475", "0.5264482", "0.5262403", "0.5259847", "0.5254543", "0.5254543", "0.52427506", "0.52413774", "0.5232597", "0.5224031", "0.5222894", "0.5218511", "0.52033716", "0.5202427", "0.52002394", "0.51976025", "0.5195624", "0.51912475", "0.5179493", "0.5168255", "0.51479626", "0.514387", "0.51279795", "0.512586", "0.5114385", "0.5112257", "0.51099324", "0.5089814", "0.50714153", "0.50653875", "0.5062267", "0.5058741", "0.5044742", "0.50377357", "0.50352186", "0.5019974", "0.5014325", "0.50034094", "0.50034094", "0.5001177", "0.49962825", "0.4984294", "0.4984294", "0.4984048", "0.49707437", "0.49637264", "0.49633506", "0.49605167", "0.49480906", "0.49457657", "0.49426112", "0.49419922", "0.49386302", "0.4931034", "0.492564", "0.49222657" ]
0.7144803
0
Create an integration for the specified app.
def create_integration_with_http_info(app_id, integration_create_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: IntegrationApi.create_integration ..." end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling IntegrationApi.create_integration" end # verify the required parameter 'integration_create_body' is set if @api_client.config.client_side_validation && integration_create_body.nil? fail ArgumentError, "Missing the required parameter 'integration_create_body' when calling IntegrationApi.create_integration" end # resource path local_var_path = "/apps/{appId}/integrations".sub('{' + 'appId' + '}', app_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(integration_create_body) auth_names = ['jwt'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'IntegrationResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#create_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_integration(app_id, integration_create_body, opts = {})\n data, _status_code, _headers = create_integration_with_http_info(app_id, integration_create_body, opts)\n return data\n end", "def create_for_app(app_auth_request = nil)\n build_request(app_auth_request || { api_key: @api_key, client_secret: @secret },\n Requests::AuthenticateApp).\n send_to_api(:post, endpoint_path)\n end", "def create_app(name, url)\n JSON.parse((@cloudvox_api[\"/applications/create.json\"].post :call_flow => {:name => name}, :agi => {:url => url}).body)\n end", "def app(create=false)\r\n @app_integration_instance = nil if create\r\n @app_integration_instance ||= new_session do |sess|\r\n sess.host! \"www.example.com\"\r\n end\r\nend", "def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end", "def create_integration(auth, server_id, type, id)\n MijDiscord::Core::API.request(\n :guilds_sid_integrations,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations\",\n { type: type, id: id }.to_json,\n Authorization: auth\n )\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end", "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end", "def create\n @cargapp_integration = CargappIntegration.new(cargapp_integration_params)\n\n respond_to do |format|\n if @cargapp_integration.save\n format.html { redirect_to @cargapp_integration, notice: 'Cargapp integration was successfully created.' }\n format.json { render :show, status: :created, location: @cargapp_integration }\n else\n format.html { render :new }\n format.json { render json: @cargapp_integration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new app_params\n @app.user = current_user\n \n if @app.valid?\n\n openid_client = Services::OpenIdConnectionService.new(@app).register\n\n\n if openid_client[\"client_id\"].present?\n @app.openid_client_id = openid_client[\"client_id\"]\n @app.openid_client_secret = openid_client[\"client_secret\"]\n @app.openid_client_access_token = openid_client[\"registration_access_token\"]\n @app.save\n end\n end\n\n respond_to do |format|\n if @app.persisted?\n format.html { redirect_to app_path(@app), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(opts)\n app = nil\n scope = select_scope(opts[:scope])\n\n assets = Asset.accessible_by_user(user).\n where(\n state: Asset::STATE_CLOSED,\n uid: opts[:ordered_assets],\n )\n\n App.transaction do\n app_series = create_app_series(opts[:name], scope)\n release = opts.fetch(:release, UBUNTU_16)\n revision = app_series.latest_revision_app.try(:revision).to_i + 1\n\n applet_dxid = new_applet(\n opts.slice(\n :input_spec,\n :output_spec,\n :code,\n :instance_type,\n :packages,\n :internet_access,\n ),\n release,\n )\n\n app_dxid = new_app(\n opts.slice(\n :name,\n :title,\n :internet_access,\n :readme,\n ).merge(\n applet_dxid: applet_dxid,\n asset_dxids: assets.map(&:dxid),\n revision: revision,\n scope: scope,\n ),\n )\n\n api.project_remove_objects(project, [applet_dxid])\n\n app = App.create!(\n dxid: app_dxid,\n version: nil,\n revision: revision,\n title: opts[:title],\n readme: opts[:readme],\n entity_type: opts[:entity_type] || App::TYPE_REGULAR,\n user: user,\n scope: scope,\n app_series: app_series,\n input_spec: opts[:input_spec],\n output_spec: opts[:output_spec],\n internet_access: opts[:internet_access],\n instance_type: opts[:instance_type],\n ordered_assets: opts[:ordered_assets],\n packages: opts[:packages],\n code: opts[:code].strip,\n assets: assets,\n release: release,\n )\n\n app_series.update!(latest_revision_app: app)\n app_series.update!(latest_version_app: app) if Space.valid_scope?(scope)\n app_series.update!(deleted: false) if app_series.deleted?\n\n Event::AppCreated.create_for(app, user)\n end\n\n app\n end", "def new_app(opts)\n api.app_new(\n applet: opts[:applet_dxid],\n name: AppSeries.construct_dxname(user.username, opts[:name], opts[:scope]),\n title: \"#{opts[:title]} \",\n summary: \" \",\n description: \"#{opts[:readme]} \",\n version: \"r#{opts[:revision]}-#{SecureRandom.hex(3)}\",\n resources: opts[:asset_dxids],\n details: { ordered_assets: opts[:asset_dxids] },\n openSource: false,\n billTo: bill_to,\n access: opts[:internet_access] ? { network: [\"*\"] } : {},\n )[\"id\"]\n end", "def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)\n # First, we need to fetch the data from Apple, which we then modify with the user's values\n r = request(:get, 'ra/apps/create/?appType=ios')\n data = parse_response(r, 'data')\n\n # Now fill in the values we have\n data['versionString']['value'] = version\n data['newApp']['name']['value'] = name\n data['newApp']['bundleId']['value'] = bundle_id\n data['newApp']['primaryLanguage']['value'] = primary_language || 'English'\n data['newApp']['vendorId']['value'] = sku\n data['newApp']['bundleIdSuffix']['value'] = bundle_id_suffix\n data['companyName']['value'] = company_name if company_name\n\n # Now send back the modified hash\n r = request(:post) do |req|\n req.url 'ra/apps/create/?appType=ios'\n req.body = data.to_json\n req.headers['Content-Type'] = 'application/json'\n end\n\n data = parse_response(r, 'data')\n handle_itc_response(data)\n end", "def create_guild_integration(guild_id, type:, id:)\n request(\n :guilds_gid_integrations, guild_id,\n :post,\n \"guilds/#{guild_id}/integrations\",\n type: type, id: id,\n )\n end", "def create\n megam_rest.post_appreq(to_hash)\n end", "def setupApp(pia_url, app_key, app_secret)\n token = getToken(pia_url, app_key, app_secret)\n { \"url\" => pia_url,\n \"app_key\" => app_key,\n \"app_secret\" => app_secret,\n \"token\" => token }\nend", "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create\n @mobile_app = create_app\n if @mobile_app.present? && @mobile_app['identifier'].present?\n @api_key = create_api_key @mobile_app['identifier']\n end\n redirect_to \"/\", flash: { error_message: @error_message }\n end", "def create\n @integration = Integration.new(integration_params)\n @integration.status = 200\n\n respond_to do |format|\n if @integration.save\n current_user.integrations.push(@integration)\n current_user.save\n #format.html { redirect_to @integration, notice: 'Integration was successfully created.' }\n format.json { render json: @integration, status: :created }#, location: @integration }\n else\n format.html { render action: 'new' }\n format.json { render json: @integration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, @app\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_app(name, redirect_uri, scopes = 'read', website = nil)\n perform_request_with_object(:post, '/api/v1/apps',\n {\n client_name: name,\n redirect_uris: redirect_uri,\n scopes: scopes,\n website: website\n }, Mastodon::App)\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to app_activities_path(@app) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def post_app_generate(application_id, type, opts={})\n # \n # default_options = {\n # \"name\" => \"\",\n # \"author\" => \"\",\n # \"description\" => \"\",\n # \"guid\" => \"\",\n # \"datasets\" => \"\",\n # \"env\" => \"prod\",\n # \"image_url\" => \"http://appresource.s3.amazonaws.com/apiappimages/missing_icard.jpg\",\n # \"runtime\" => \"\"\n # }\n # options = default_options.merge(opts)\n return post_response(\"app/#{application_id}/generate/#{type}\", opts,:json)\n end", "def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil)\n puts(\"The `version` parameter is deprecated. Use `ensure_version!` method instead\") if version\n client.create_application!(name: name,\n primary_language: primary_language,\n sku: sku,\n bundle_id: bundle_id,\n bundle_id_suffix: bundle_id_suffix,\n company_name: company_name,\n platform: platform,\n platforms: platforms,\n itunes_connect_users: itunes_connect_users)\n end", "def create\n @registered_app = RegisteredApp.new(registered_app_params)\n\n respond_to do |format|\n if @registered_app.save\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registered_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def ajax_mf_app_create\n\n domain = params[:domain] + \".myshopify.com\"\n from_email = params[:domain] + \"@custprotection.com\"\n\n digest = OpenSSL::Digest.new('sha256')\n token = Base64.encode64(OpenSSL::HMAC.digest(digest, ENV['SECRET_KEY_BASE'], params[:domain])).strip\n app = App.create(user_id: params[:user_id], name: domain, auth_token: token, from_email: from_email)\n\n response = {\n success: true,\n url: app.name,\n message: 'App Created!'\n }\n\n render json: response\n\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:create] == 'existing'\n @app = App.new(app_params)\n origin = @apps.find(params[:origin])\n\n @app.runtime = origin.runtime.dup\n @app.android_config = origin.android_config.dup\n @app.ios_config = origin.ios_config.dup\n @app.android_icon = origin.android_icon.dup\n @app.ios_icon = origin.ios_icon.dup\n\n @app.splash = origin.splash.dup\n\n @app.android_config['origin'] = origin.id\n @app.ios_config['origin'] = origin.id\n @app.android_config.delete('bundle_id')\n @app.ios_config.delete('bundle_id')\n\n @app.duplicate_files(origin)\n else\n @app = App.new(app_params)\n end\n\n @app.user = current_user\n\n if @app.save\n if origin\n origin.assets.each do |item|\n asset = Asset.new\n asset.app_id = @app.id\n asset.slug = item.slug\n asset.duplicate_file(item)\n asset.save!\n end\n end\n end\n\n respond_modal_with @app, location: @app\n end", "def create_integration_installation_access_token(installation, options = {})\n opts = ensure_api_media_type(:integrations, options)\n post \"/installations/#{installation}/access_tokens\", opts\n end", "def create\n @customer_app = CustomerApp.new(customer_app_params)\n @customer_app.auth_account_id = active_account.id\n\n if @customer_app.save\n render :show, status: :created, location: @customer_app\n else\n render json: @customer_app.errors, status: :unprocessable_entity\n end\n end", "def create_application(client, options)\n if options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n application = client.applications.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Application created.\"\n\n #TODO: Add exception handling\nend", "def create_omniauth\n omniauth_params = request.env['omniauth.params']\n org_uid = omniauth_params['state'] if omniauth_params\n response = request.env['omniauth.auth']\n\n return redirect_to root_url unless is_admin && org_uid && response\n\n shop_name = response.uid\n current_organization.from_omniauth(response)\n\n current_organization.instance_url = \"https://#{shop_name}/admin\"\n\n unless current_organization.save\n flash[:alert] = \"Oops, your account could not be linked. #{format_errors(current_organization)}\"\n return redirect_to root_url\n end\n\n token = response['credentials']['token']\n session[:show_popup] = !is_same_currency\n\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n redirect_to root_url\n\n rescue Shopify::Webhooks::WebhooksManager::CreationFailed => e\n Maestrano::Connector::Rails::ConnectorLogger.log('warn', current_organization, \"Webhooks could not be created: #{e}\")\n redirect_to root_url\n end", "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @integration = Integration.new(params[:integration])\n if @integration.save\n redirect_to user_integration_path(@user, @integration), notice: 'Integration was successfully created.'\n else\n fetch_projects\n fetch_clients\n render action: \"new\"\n end\n end", "def ext_create(opts = {})\n ext_api = ActiveExtAPI::StoreCreate.new self\n ext_api.create opts\n end", "def create\n params[:app][:user_id] = current_user.id\n @app = App.create(params[:app])\n if @app.save\n redirect_to source_app_path(@app), notice: 'app was successfully created.'\n else\n render :new\n end\n end", "def create\n @payment_app = PaymentApp.new(payment_app_params)\n respond_to do |format|\n if @payment_app.save\n format.html { redirect_to @payment_app, notice: 'Payment app was successfully created.' }\n format.json { render action: 'show', status: :created, location: @payment_app }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n session[:current_api_token] = @app.api_token\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render json: @app, status: :created, location: @app }\n else\n format.html { \n @apps = App.all\n render action: \"index\" \n }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n flash[:success] = 'App was successfully saved.'\n format.html { redirect_to @app }\n format.json { render :show, status: :created, location: @app }\n else\n flash[:danger] = 'There was a problem creating the App Catalog Page.'\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_google_apps\n GoogleApps.new(self).generate\n end", "def create_webhooks_integration(body, opts = {})\n data, _status_code, _headers = create_webhooks_integration_with_http_info(body, opts)\n data\n end", "def create_omniauth\n omniauth_params = request.env['omniauth.params']\n if omniauth_params && org_uid = omniauth_params['state']\n organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(org_uid, current_user.tenant)\n if organization && is_admin?(current_user, organization) && response = request.env['omniauth.auth']\n shop_name = response.uid\n organization.from_omniauth(response)\n organization.instance_url = \"https://#{shop_name}/admin\"\n organization.save!\n\n token = response['credentials']['token']\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n\n end\n end\n redirect_to root_url\n end", "def create\n @app_instance = AppInstance.new(app_instance_params)\n\n respond_to do |format|\n if @app_instance.save\n format.html { redirect_to @app_instance, notice: 'App instance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @app_instance }\n else\n format.html { render action: 'new' }\n format.json { render json: @app_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to(@app, :notice => 'App was successfully created.') }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @app = App.new(params[:app])\n\n respond_to do |format|\n if @app.save\n flash[:notice] = 'App was successfully created.'\n format.html { redirect_to(app_path(@app)) }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: 'Test app was successfully created.' }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @newapp = Newapp.new(params[:newapp])\n\n respond_to do |format|\n if @newapp.save\n format.html { redirect_to @newapp, notice: 'Newapp was successfully created.' }\n format.json { render json: @newapp, status: :created, location: @newapp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end", "def create(*args)\n if !self.is_?(App)\n self.app_name = HesCentral.application_repository_name\n end\n super(*args)\n end", "def create\n @test_app = TestApp.new(test_app_params)\n\n respond_to do |format|\n if @test_app.save\n format.html { redirect_to @test_app, notice: \"Test app was successfully created.\" }\n format.json { render :show, status: :created, location: @test_app }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @erp_integration = ErpIntegration.new(erp_integration_params)\n\n respond_to do |format|\n if @erp_integration.save\n format.html { redirect_to @erp_integration, notice: 'Erp integration was successfully created.' }\n format.json { render :show, status: :created, location: @erp_integration }\n else\n format.html { render :new }\n format.json { render json: @erp_integration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end", "def create\n @cotiz_app = CotizApp.new(cotiz_app_params)\n\n respond_to do |format|\n if @cotiz_app.save\n format.html { redirect_to cotiz_app_path(@cotiz_app), notice: 'Cotiz app was successfully created.' }\n format.json { render :show, status: :created, location: @cotiz_app }\n else\n format.html { render :new }\n format.json { render json: @cotiz_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_subscription(payment_intent_id)\n result = ChargeBee::Subscription.create({\n plan_id: '<chargebee-plan-id>',\n auto_collection: 'on',\n payment_intent: {\n gateway_account_id: '<checkout.com-gateway-id>',\n gw_token: payment_intent_id\n }\n })\n subscription = result.subscription\n puts \"Chargebee subscription ID: #{subscription.id} created for Checkout.com payment ID: #{payment_intent_id}\"\n end", "def register_application(app_name, namespace, public_hostname)\n # curl -X POST https://dnsapi.cn/Record.Create -d 'login_email=api@dnspod.com&login_password=password&format=json&domain_id=2317346&sub_domain=@&record_type=A&record_line=默认&value=1.1.1.1'\n\n # create an A record for the application in the domain\n hostname = \"#{app_name}-#{namespace}\"\n url = \"https://dnsapi.cn/Record.Create\"\n params = common_params.merge({\n :domain_id => @domain_id,\n :sub_domain => hostname,\n :record_type => 'A',\n :record_line => '默认',\n :value => public_hostname\n })\n\n res = @http.post(url, params)\n res = JSON.parse(res.content)\n puts res\n\n result = JSON.parse(response.body)\n result.status['message']\n #{\n # \"status\": {\n # \"code\":\"1\",\n # \"message\":\"Action completed successful\",\n # \"created_at\":\"2012-11-23 22:17:47\"\n #},\n # \"record\": {\n # \"id\":\"16894439\",\n # \"name\":\"@\",\n # \"status\":\"enable\"\n #}\n #}\n\n end", "def add_webauthn_device(app_id, user, fake_device = nil, name: 'My device')\n fake_device ||= WebAuthn::FakeClient.new(app_id)\n\n options_for_create = WebAuthn::Credential.options_for_create(\n user: { id: user.webauthn_xid, name: user.username },\n authenticator_selection: { user_verification: 'discouraged' },\n rp: { name: 'GitLab' }\n )\n challenge = options_for_create.challenge\n\n device_response = fake_device.create(challenge: challenge).to_json # rubocop:disable Rails/SaveBang\n device_registration_params = { device_response: device_response,\n name: name }\n\n Webauthn::RegisterService.new(\n user, device_registration_params, challenge).execute\n FakeWebauthnDevice.new(page, name, fake_device)\n end", "def create\n @app_request = AppRequest.new(app_request_params)\n @app_request.order_uid = SecureRandom.uuid\n\n tm_response = faraday.post do |req|\n req.url uri.path\n req.headers['Content-Type'] = 'application/json'\n req.headers['X-API-KEY'] = @app_request.public_key\n req.body = @app_request.to_json\n end\n\n if tm_response.success? && @app_request.save\n redirect_to tm_response.body\n else\n errors = JSON.parse(tm_response.body)['errors']\n errors.each do |e|\n @app_request.errors.add(:base, e)\n end\n\n respond_to do |format|\n format.html {\n render :new, error: tm_response.body\n }\n end\n end\n end", "def create(cli = false)\n $logger.info(\"Creating new gear #{@uuid} for application #{@app.name}\")\n\n if cli\n command = %Q(oo-devel-node app-create -c #{uuid} -a #{@app.uuid} --with-namespace #{@app.account.domain} --with-app-name #{@app.name} --with-secret-token=DEADBEEFDEADBEEFDEADBEEFDEADBEEF)\n $logger.info(%Q(Running #{command}))\n results = %x[#{command}]\n assert_equal(0, $?.exitstatus, %Q(#{command}\\n #{results}))\n end\n\n # Create the container object for use in the event listener later\n begin\n @container = OpenShift::Runtime::ApplicationContainer.new(@app.uuid, @uuid, nil, @app.name, @app.name, @app.account.domain, nil, nil)\n rescue Exception => e\n $logger.error(\"#{e.message}\\n#{e.backtrace}\")\n raise\n end\n\n unless cli\n @container.create('DEADBEEFDEADBEEFDEADBEEFDEADBEEF')\n end\n end", "def register_app(apk, bundle_id, env = \"dev\")\n if apk.nil?\n UI.error(\"Specify the APK you want to run and register in crashlytics. Provide the filename only, not the full path.\")\n exit(1)\n end\n\n if bundle_id.nil?\n UI.error(\"Specify the bundle_id of the app you want to run and register in crashlytics.\")\n exit(1)\n end\n\n avd = getAvdEmulator\n\n # Register the app in crashlytics by starting it\n sh(\"./register.sh #{apk} #{bundle_id} #{avd} #{env}\")\nend", "def get_integration_with_http_info(app_id, integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.get_integration ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.get_integration\"\n end\n # verify the required parameter 'integration_id' is set\n if @api_client.config.client_side_validation && integration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling IntegrationApi.get_integration\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations/{integrationId}\".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_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 = ['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 => 'IntegrationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#get_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create!(bundle_id: nil, name: nil, mac: false)\n new_website_push = client.create_website_push!(name, bundle_id, mac: mac)\n self.new(new_website_push)\n end", "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end", "def create_application_payment\n Payment.new application: self,\n amount: self.calculate_fee,\n description: \"Application fee (#{pluralize self.course_selections_count, 'course'})\"\n end", "def create\n @app = App::Gcm::App.find_by_name(params[:app_name])\n @app_user = @app.app_users.build(app_params)\n @app_user.app_id = @app.id\n @app_user.app_name = @app.name\n respond_to do |format|\n if @app_user.save\n format.html { redirect_to ({action:'show', id:@app_user.id}), notice: 'App user was successfully created.' }\n format.json { render json: @app_user, status: :created, location: {:action => 'show', id:@app_user.id} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_integration_action(id, body, opts = {})\n data, _status_code, _headers = create_integration_action_with_http_info(id, body, opts)\n return data\n end", "def create_app_profile instance_id, app_profile_id, app_profile, ignore_warnings: nil\n instances.create_app_profile parent: instance_path(instance_id),\n app_profile_id: app_profile_id,\n app_profile: app_profile,\n ignore_warnings: ignore_warnings\n end", "def create\n backend_api = current_account.backend_apis.create(create_params)\n respond_with(backend_api)\n end", "def convert_with_rest!(publisher_app, params={})\n # Create the app object with the item id of the offer, which is what will point to the app that this install offer wants you to install.\n # Install offers that aren't the primary offer for an app will not have their id and their app's id match, but the offer's item_id will\n # always be the app that this offer is for.\n raise \"item_id is nil so we don't know which app we are converting. This is a bug in test_chamber\" unless item_id\n advertiser_app = TestChamber::App.new(id: item_id)\n advertiser_app.open_app\n end", "def register_application(app_name, namespace, public_hostname)\n\n # create an A record for the application in the domain\n fqdn = \"#{app_name}-#{namespace}.#{@domain_suffix}\"\n\n # create an update record\n\n update = {\n :comment => \"Add an application record for #{fqdn}\",\n :changes => [change_record(\"CREATE\", fqdn, @ttl, public_hostname)]\n }\n \n res = r53.change_resource_record_sets({\n :hosted_zone_id => @aws_hosted_zone_id,\n :change_batch => update\n })\n end", "def intercom\n intercom = Intercom::Client.new(app_id: 'ahd0euu5', api_key: 'b505f64477d12b3375524315399786d54e28f9b7')\n end", "def add_application(app)\n app = DoesFacebook::Application.new(app) if app.is_a?(Hash)\n @applications << app\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def sign_up\n NexaasID::Resources::SignUp.new(api_token, config)\n end", "def register_integration(name, version)\n meta = { name: \"sentry.ruby.#{name}\", version: version }.freeze\n integrations[name.to_s] = meta\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create\n manifest = JSON.parse(params[:manifest])\n manifest['provider'] = params[:provider]\n puts \"Repository type: #{params[:repository_type]}\"\n @client.app_create(params[:id], params[:repository_type])\n @client.app_add_manifest(params[:id], manifest)\n\n respond_to do |format|\n format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n #if @client.app_create(params[:id], manifest)\n # format.html { redirect_to app_path(params[:id]), notice: 'App was successfully created.' }\n # # FIXME format.json { render json: @app, status: :created, location: app_path(params[:id]) } \n #else\n # format.html { render action: \"new\" }\n # format.json { render json: @app.errors, status: :unprocessable_entity } # FIXME\n #end\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def create\n megam_rest.post_marketplaceapp(to_hash)\n end", "def call(access_token)\n # Configure which events you want to subscribe to\n # See https://developer.aircall.io/api-references/#events\n events = ['call.created']\n\n aircall_client.create_webhook(access_token: access_token, events: events)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def list_integrations_with_http_info(app_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.list_integrations ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.list_integrations\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations\".sub('{' + 'appId' + '}', app_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'types'] = opts[:'types'] if !opts[:'types'].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 = ['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 => 'ListIntegrationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#list_integrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_app_notification(fb_user_id, template, href = \"\")\n uri = og_uri(fb_user_id, \"notifications\")\n post_to_og(uri, :access_token => access_token, :template => template, :href => href)\n end", "def create_webhooks_integration_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.create_webhooks_integration ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling WebhooksIntegrationAPI.create_webhooks_integration\"\n end\n # resource path\n local_var_path = '/api/v1/integration/webhooks/configuration/webhooks'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'WebhooksIntegration'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :create_webhooks_integration,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhooksIntegrationAPI#create_webhooks_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @admin_app = App.new(admin_app_params)\n\n respond_to do |format|\n if @admin_app.save\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @admin_app] }\n else\n format.html { render :new }\n format.json { render json: [:admin, @admin_app].errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def create!(name: nil, bundle_id: nil, certificate: nil, devices: [], mac: false, sub_platform: nil, template_name: nil)\n raise \"Missing required parameter 'bundle_id'\" if bundle_id.to_s.empty?\n raise \"Missing required parameter 'certificate'. e.g. use `Spaceship::Portal::Certificate::Production.all.first`\" if certificate.to_s.empty?\n\n app = Spaceship::Portal::App.find(bundle_id, mac: mac)\n raise \"Could not find app with bundle id '#{bundle_id}'\" unless app\n\n raise \"Invalid sub_platform #{sub_platform}, valid values are tvOS\" if !sub_platform.nil? && sub_platform != 'tvOS'\n\n # Fill in sensible default values\n name ||= [bundle_id, self.pretty_type].join(' ')\n\n if self == AppStore || self == InHouse || self == Direct\n # Distribution Profiles MUST NOT have devices\n devices = []\n end\n\n certificate_parameter = certificate.collect(&:id) if certificate.kind_of?(Array)\n certificate_parameter ||= [certificate.id]\n\n # Fix https://github.com/KrauseFx/fastlane/issues/349\n certificate_parameter = certificate_parameter.first if certificate_parameter.count == 1\n\n if devices.nil? || devices.count == 0\n if self == Development || self == AdHoc\n # For Development and AdHoc we usually want all compatible devices by default\n if mac\n devices = Spaceship::Portal::Device.all_macs\n elsif sub_platform == 'tvOS'\n devices = Spaceship::Portal::Device.all_apple_tvs\n else\n devices = Spaceship::Portal::Device.all_ios_profile_devices\n end\n end\n end\n\n profile = client.with_retry do\n client.create_provisioning_profile!(name,\n self.type,\n app.app_id,\n certificate_parameter,\n devices.map(&:id),\n mac: mac,\n sub_platform: sub_platform,\n template_name: template_name)\n end\n\n self.new(profile)\n end", "def create\n name = shift_argument\n url = shift_argument\n\n unless name && url\n raise(Heroku::Command::CommandFailed, \"Usage: clients:register [NAME] [CALLBACK_URL]\")\n end\n\n validate!(url)\n client = request do\n api.request(\n :body => encode_json(\n { :name => name, :redirect_uri => url }),\n :expects => 201,\n :headers => headers,\n :method => :post,\n :path => \"/oauth/clients\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Registered client \"#{name}\".})\n styled_hash(client)\n end\n end", "def create_app_profile \\\n instance_id,\n app_profile_id,\n app_profile,\n ignore_warnings: nil\n execute do\n instances.create_app_profile(\n instance_path(instance_id),\n app_profile_id,\n app_profile,\n ignore_warnings: ignore_warnings\n )\n end\n end", "def create_app_series(app_name, scope)\n app_series_dxid = AppSeries.construct_dxid(user.username, app_name, scope)\n\n AppSeries.create_with(\n name: app_name,\n user: user,\n scope: scope,\n ).find_or_create_by(\n dxid: app_series_dxid,\n )\n end", "def create(name=nil, options={})\n\t\tparams = {}\n\t\tparams['app[name]'] = name if name\n\t\txml(post('/apps', params)).elements[\"//app/name\"].text\n\tend", "def create_new_app\n rake 'install --trace'\n FileUtils.rm_rf(rails_app)\n sh \"relevance_rails new #{rails_app} --database=#{database} --relevance-dev\"\n end" ]
[ "0.7144803", "0.6613742", "0.6320141", "0.6286776", "0.6243598", "0.61107016", "0.6092274", "0.60061455", "0.59643096", "0.5952713", "0.5895749", "0.5852185", "0.57128704", "0.5695547", "0.5677204", "0.56629384", "0.56376237", "0.5623359", "0.56065327", "0.56010187", "0.55648816", "0.5521196", "0.55172545", "0.5503504", "0.5500473", "0.54837", "0.54794455", "0.54732835", "0.54705644", "0.54598314", "0.5457293", "0.54537135", "0.5436643", "0.5408191", "0.5401126", "0.5396905", "0.53926355", "0.53926355", "0.5377887", "0.5353853", "0.5341364", "0.5325654", "0.5295436", "0.5292006", "0.52865475", "0.5264482", "0.5262403", "0.5259847", "0.5254543", "0.5254543", "0.52427506", "0.52413774", "0.5232597", "0.5224031", "0.5222894", "0.5218511", "0.52033716", "0.5202427", "0.52002394", "0.51976025", "0.5195624", "0.51912475", "0.5179493", "0.5168255", "0.51479626", "0.514387", "0.51279795", "0.512586", "0.5114385", "0.5112257", "0.51099324", "0.5089814", "0.50714153", "0.50653875", "0.5062267", "0.5058741", "0.5044742", "0.50377357", "0.50352186", "0.5019974", "0.5014325", "0.50034094", "0.50034094", "0.5001177", "0.49962825", "0.4984294", "0.4984294", "0.4984048", "0.49707437", "0.49637264", "0.49633506", "0.49605167", "0.49480906", "0.49457657", "0.49426112", "0.49419922", "0.49386302", "0.4931034", "0.492564", "0.49222657" ]
0.6851142
1
Delete the specified integration.
def delete_integration(app_id, integration_id, opts = {}) delete_integration_with_http_info(app_id, integration_id, opts) return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_integration(auth, server_id, integration_id)\n MijDiscord::Core::API.request(\n :guilds_sid_integrations_iid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations/#{integration_id}\",\n Authorization: auth\n )\n end", "def delete_guild_integration(guild_id, integration_id)\n request(\n :guilds_gid_integrations_iid, guild_id,\n :delete,\n \"guilds/#{guild_id}/integrations/#{integration_id}\"\n )\n end", "def destroy\n @integration.destroy\n respond_to do |format|\n format.html { redirect_to integrations_url, notice: 'Integration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @integration = Integration.find(params[:id])\n @integration.destroy\n\n respond_to do |format|\n format.html { redirect_to user_integrations_url(@integration.user) }\n format.json { head :no_content }\n end\n end", "def destroy\n # remove integrations from user\n begin\n current_user.integrations.delete(@integration)\n\n # remove integrations from agents\n current_user.agents.each do |agent|\n agent.integrations.delete(@integration)\n end\n\n # remove integrations from templates\n current_user.templates.each do |template|\n template.integrations.delete(@integration)\n end\n\n # remove integration\n @integration.destroy\n rescue Exception => e\n Services::Slog.exception e\n end\n\n respond_to do |format|\n format.html { redirect_to integrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @integral = Integral.find(params[:id])\n @integral.destroy\n\n respond_to do |format|\n format.html { redirect_to integrals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cargapp_integration.destroy\n respond_to do |format|\n format.html { redirect_to cargapp_integrations_url, notice: 'Cargapp integration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_integration_with_http_info(app_id, integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.delete_integration ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.delete_integration\"\n end\n # verify the required parameter 'integration_id' is set\n if @api_client.config.client_side_validation && integration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling IntegrationApi.delete_integration\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations/{integrationId}\".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_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 = ['jwt']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#delete_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @integrante = Integrante.find(params[:id])\n @integrante.destroy\n\n respond_to do |format|\n format.html { redirect_to integrantes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @erp_integration.destroy\n respond_to do |format|\n format.html { redirect_to erp_integrations_url, notice: 'Erp integration was successfully destroyed.' }\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 delete(_identifier)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def delete_subscription subscription\n subscriber.delete_subscription subscription: subscription_path(subscription)\n end", "def destroy\n @integrante.destroy\n respond_to do |format|\n format.html { redirect_to integrantes_url, notice: 'Integrante removidos.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n # TODO: Implement this for Stripe webhooks\n end", "def delete\n trap_exception { delete! }\n end", "def delete\n api(\"Delete\")\n end", "def delete_subscription(entity)\r\n subscriptions.delete(entity)\r\n end", "def delete\n destroy\n end", "def delete(_spec)\n raise NotImplementedError, not_implemented_msg(:delete)\n end", "def del\n delete\n end", "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "def delete\n request(:delete)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy \n Instagram.delete_subscription({:id => params[:id]})\n local_subscription = Subscription.find_by_original_id params[:id]\n local_subscription.destroy if local_subscription\n redirect_to :admin_subscriptions\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def deleteInterest(interest)\n \n end", "def deleteInterest(interest)\n \n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n execute_request { faraday_connection.delete }\n end", "def delete_expectation\n orgId = params[:id].to_i\n expectationId = params[:expectation_id].to_i\n\n expectation = Expectation.new()\n expectation[\"organization_id\"] = orgId\n expectation[\"id\"] = expectationId\n\n result = @expectationService.delete_expectation(expectation)\n\n render status: result.status,\n json: {\n info: result.info\n }\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end", "def delete\n api_client.delete(url)\n end", "def delete\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def delete\n Fission::Action::VM::Deleter.new(self).delete\n end", "def delete\n # TODO: implement delete\n end", "def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end", "def delete\n \n end", "def destroy\n current_user.templates.delete(@template)\n # Remove from integrations\n @template.integrations.each do |integration|\n integration.templates.delete(@template)\n\n # check if integrations has agents, remove if all empty\n if integration.agents.empty?\n current_user.integrations.delete(integration)\n integration.destroy\n end\n end\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n\n head :no_content\n end", "def delete\n destroy\n end", "def delete\n destroy\n end", "def delete(*args)\n execute(:delete, *args)\n end", "def delete(vendor_id)\n @client.delete(\"/#{@model}/#{vendor_id}\")\n end", "def delete\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def delete!\n delete( nil, true ) \n end", "def delete(ident)\n @model.delete_item @proxy_class.instance_path(@base_path, ident)\n end", "def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def delete!\n clear!\n delete\n end", "def _destroy_delete\n delete\n end", "def _destroy_delete\n delete\n end", "def delete_by_id(id)\n delete_payment_token_by_id(id)\n end", "def delete\n storage.delete(id)\n end", "def destroy\n @project= @task.project_id\n @integrant.destroy\n redirect_to integrants_path(project_id: @project)\n flash[:notice] = 'Task was successfully destroyed.'\n\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete_by_uuid uuid\n deliberately_unscoped(Webhook).where(uuid: uuid).destroy\n end", "def destroy\n requires :id\n\n service.delete_internet_gateway(id)\n true\n end", "def delete_upload_request(upload_id)\n call(:delete, upload_path(\"#{upload_id}/\"))\n end", "def delete\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def delete!\n resource = RESOURCE % { account_id: account.id, id: id }\n response = Request.new(account.client, :delete, resource).perform\n from_response(response.body[:data])\n end", "def delete\n @service.delete(self)\n end", "def delete\n end", "def destroy\n @extra_page.destroy\n respond_to do |format|\n format.html { redirect_to extra_pages_url, notice: 'Integration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n feature.destroy\n\n respond_with(feature)\n end", "def delete_at(index)\n @store.delete_at(index)\n end", "def operation_delete(job_id, interaction_id, path)\n interactive_front(job_id, interaction_id).delete(path)\n end", "def destroy\n @associated_trial.destroy\n respond_to do |format|\n format.html { redirect_to associated_trials_url, notice: 'Associated trial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_conversations_messaging_integrations_line_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.delete_conversations_messaging_integrations_line_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.delete_conversations_messaging_integrations_line_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/line/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#delete_conversations_messaging_integrations_line_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete!\n delete_if { true }\n end", "def delete\n request('delete').auth_required!\n end", "def destroy; delete end", "def destroy\n @installation.destroy\n flash[:success] = \"Installation deleted\"\n redirect_to installations_path\n end", "def destroy\n @trial.destroy_sub\n notice = 'Trial was successfully destroyed.'\n redirect_to trials_url_helper, notice: notice\n end", "def delete\n\n end", "def destroy\n @invoice.destroy\n end", "def delete!\n return if @deleted\n delete_page = @client.get @delete_url\n delete_form = delete_page.form_with(:action => /delete/i)\n delete_button = delete_form.button_with(:name => /delete/i)\n delete_form.submit delete_button\n @deleted = true\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete\n \n end", "def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end", "def delete_subscriptions\n end", "def delete_sales_invoice!(id)\n delete(\"sales_invoices/#{id}\")\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete(path: nil, payload: nil, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :delete,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end", "def delete_subscription(id)\n delete(\"/subscriptions/#{id}\")\n end" ]
[ "0.7705007", "0.7387403", "0.7291439", "0.7242794", "0.70122725", "0.68807834", "0.65916157", "0.6534435", "0.6441573", "0.6350197", "0.6205371", "0.6205371", "0.6205371", "0.6205371", "0.619457", "0.61403406", "0.61036325", "0.60600567", "0.60487884", "0.6025649", "0.60108787", "0.59985924", "0.5993339", "0.5962842", "0.5961764", "0.5945058", "0.59178746", "0.59139353", "0.58804977", "0.58368754", "0.58368754", "0.5831366", "0.5821215", "0.58185923", "0.58151126", "0.58151126", "0.5813484", "0.5810297", "0.57924247", "0.5791169", "0.5778572", "0.576914", "0.5751584", "0.5746255", "0.5733575", "0.5725576", "0.5725576", "0.5719718", "0.57155794", "0.57118404", "0.5704691", "0.5700806", "0.5700538", "0.5700468", "0.5691914", "0.5689234", "0.5687426", "0.5687426", "0.5677887", "0.5677247", "0.5674624", "0.566859", "0.5667682", "0.56662077", "0.56653297", "0.5661377", "0.5656819", "0.5643166", "0.5637564", "0.56356", "0.56355953", "0.5635591", "0.56330395", "0.563251", "0.56318736", "0.56252617", "0.5622685", "0.5620774", "0.5620774", "0.5620251", "0.5620251", "0.5619711", "0.56139064", "0.5613394", "0.5612618", "0.5611599", "0.5608757", "0.5603498", "0.5602502", "0.5596721", "0.5596721", "0.5596721", "0.5596721", "0.5596251", "0.5595533", "0.5595118", "0.559448", "0.559281", "0.55888283", "0.5586799" ]
0.65985185
6
Delete the specified integration.
def delete_integration_with_http_info(app_id, integration_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: IntegrationApi.delete_integration ..." end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling IntegrationApi.delete_integration" end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.delete_integration" end # resource path local_var_path = "/apps/{appId}/integrations/{integrationId}".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['jwt'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#delete_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_integration(auth, server_id, integration_id)\n MijDiscord::Core::API.request(\n :guilds_sid_integrations_iid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations/#{integration_id}\",\n Authorization: auth\n )\n end", "def delete_guild_integration(guild_id, integration_id)\n request(\n :guilds_gid_integrations_iid, guild_id,\n :delete,\n \"guilds/#{guild_id}/integrations/#{integration_id}\"\n )\n end", "def destroy\n @integration.destroy\n respond_to do |format|\n format.html { redirect_to integrations_url, notice: 'Integration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @integration = Integration.find(params[:id])\n @integration.destroy\n\n respond_to do |format|\n format.html { redirect_to user_integrations_url(@integration.user) }\n format.json { head :no_content }\n end\n end", "def destroy\n # remove integrations from user\n begin\n current_user.integrations.delete(@integration)\n\n # remove integrations from agents\n current_user.agents.each do |agent|\n agent.integrations.delete(@integration)\n end\n\n # remove integrations from templates\n current_user.templates.each do |template|\n template.integrations.delete(@integration)\n end\n\n # remove integration\n @integration.destroy\n rescue Exception => e\n Services::Slog.exception e\n end\n\n respond_to do |format|\n format.html { redirect_to integrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @integral = Integral.find(params[:id])\n @integral.destroy\n\n respond_to do |format|\n format.html { redirect_to integrals_url }\n format.json { head :no_content }\n end\n end", "def delete_integration(app_id, integration_id, opts = {})\n delete_integration_with_http_info(app_id, integration_id, opts)\n return nil\n end", "def destroy\n @cargapp_integration.destroy\n respond_to do |format|\n format.html { redirect_to cargapp_integrations_url, notice: 'Cargapp integration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @integrante = Integrante.find(params[:id])\n @integrante.destroy\n\n respond_to do |format|\n format.html { redirect_to integrantes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @erp_integration.destroy\n respond_to do |format|\n format.html { redirect_to erp_integrations_url, notice: 'Erp integration was successfully destroyed.' }\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 delete(_identifier)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def delete_subscription subscription\n subscriber.delete_subscription subscription: subscription_path(subscription)\n end", "def destroy\n @integrante.destroy\n respond_to do |format|\n format.html { redirect_to integrantes_url, notice: 'Integrante removidos.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n # TODO: Implement this for Stripe webhooks\n end", "def delete\n trap_exception { delete! }\n end", "def delete\n api(\"Delete\")\n end", "def delete_subscription(entity)\r\n subscriptions.delete(entity)\r\n end", "def delete\n destroy\n end", "def delete(_spec)\n raise NotImplementedError, not_implemented_msg(:delete)\n end", "def del\n delete\n end", "def delete()\n @client.make_request(:delete, @client.concat_user_path(\"#{DOMAIN_PATH}/#{domain_id}/endpoints/#{id}\"))[0]\n end", "def delete\n request(:delete)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy \n Instagram.delete_subscription({:id => params[:id]})\n local_subscription = Subscription.find_by_original_id params[:id]\n local_subscription.destroy if local_subscription\n redirect_to :admin_subscriptions\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def deleteInterest(interest)\n \n end", "def deleteInterest(interest)\n \n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n execute_request { faraday_connection.delete }\n end", "def delete_expectation\n orgId = params[:id].to_i\n expectationId = params[:expectation_id].to_i\n\n expectation = Expectation.new()\n expectation[\"organization_id\"] = orgId\n expectation[\"id\"] = expectationId\n\n result = @expectationService.delete_expectation(expectation)\n\n render status: result.status,\n json: {\n info: result.info\n }\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trial = Trial.find(params[:id])\n @trial.destroy\n\n respond_to do |format|\n format.html { redirect_to(trials_url) }\n format.xml { head :ok }\n end\n end", "def delete\n api_client.delete(url)\n end", "def delete\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def delete\n Fission::Action::VM::Deleter.new(self).delete\n end", "def delete\n # TODO: implement delete\n end", "def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end", "def delete\n \n end", "def destroy\n current_user.templates.delete(@template)\n # Remove from integrations\n @template.integrations.each do |integration|\n integration.templates.delete(@template)\n\n # check if integrations has agents, remove if all empty\n if integration.agents.empty?\n current_user.integrations.delete(integration)\n integration.destroy\n end\n end\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n\n head :no_content\n end", "def delete\n destroy\n end", "def delete\n destroy\n end", "def delete(*args)\n execute(:delete, *args)\n end", "def delete(vendor_id)\n @client.delete(\"/#{@model}/#{vendor_id}\")\n end", "def delete\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def delete!\n delete( nil, true ) \n end", "def delete(ident)\n @model.delete_item @proxy_class.instance_path(@base_path, ident)\n end", "def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def delete!\n clear!\n delete\n end", "def _destroy_delete\n delete\n end", "def _destroy_delete\n delete\n end", "def delete_by_id(id)\n delete_payment_token_by_id(id)\n end", "def delete\n storage.delete(id)\n end", "def destroy\n @project= @task.project_id\n @integrant.destroy\n redirect_to integrants_path(project_id: @project)\n flash[:notice] = 'Task was successfully destroyed.'\n\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete_by_uuid uuid\n deliberately_unscoped(Webhook).where(uuid: uuid).destroy\n end", "def destroy\n requires :id\n\n service.delete_internet_gateway(id)\n true\n end", "def delete_upload_request(upload_id)\n call(:delete, upload_path(\"#{upload_id}/\"))\n end", "def delete\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def delete!\n resource = RESOURCE % { account_id: account.id, id: id }\n response = Request.new(account.client, :delete, resource).perform\n from_response(response.body[:data])\n end", "def delete\n @service.delete(self)\n end", "def delete\n end", "def destroy\n @extra_page.destroy\n respond_to do |format|\n format.html { redirect_to extra_pages_url, notice: 'Integration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n feature.destroy\n\n respond_with(feature)\n end", "def delete_at(index)\n @store.delete_at(index)\n end", "def operation_delete(job_id, interaction_id, path)\n interactive_front(job_id, interaction_id).delete(path)\n end", "def destroy\n @associated_trial.destroy\n respond_to do |format|\n format.html { redirect_to associated_trials_url, notice: 'Associated trial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_conversations_messaging_integrations_line_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.delete_conversations_messaging_integrations_line_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.delete_conversations_messaging_integrations_line_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/line/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#delete_conversations_messaging_integrations_line_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete!\n delete_if { true }\n end", "def delete\n request('delete').auth_required!\n end", "def destroy; delete end", "def destroy\n @installation.destroy\n flash[:success] = \"Installation deleted\"\n redirect_to installations_path\n end", "def destroy\n @trial.destroy_sub\n notice = 'Trial was successfully destroyed.'\n redirect_to trials_url_helper, notice: notice\n end", "def delete\n\n end", "def destroy\n @invoice.destroy\n end", "def delete!\n return if @deleted\n delete_page = @client.get @delete_url\n delete_form = delete_page.form_with(:action => /delete/i)\n delete_button = delete_form.button_with(:name => /delete/i)\n delete_form.submit delete_button\n @deleted = true\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete\n \n end", "def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end", "def delete_subscriptions\n end", "def delete_sales_invoice!(id)\n delete(\"sales_invoices/#{id}\")\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def delete(path: nil, payload: nil, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :delete,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\n end", "def delete_subscription(id)\n delete(\"/subscriptions/#{id}\")\n end" ]
[ "0.7705007", "0.7387403", "0.7291439", "0.7242794", "0.70122725", "0.68807834", "0.65985185", "0.65916157", "0.6441573", "0.6350197", "0.6205371", "0.6205371", "0.6205371", "0.6205371", "0.619457", "0.61403406", "0.61036325", "0.60600567", "0.60487884", "0.6025649", "0.60108787", "0.59985924", "0.5993339", "0.5962842", "0.5961764", "0.5945058", "0.59178746", "0.59139353", "0.58804977", "0.58368754", "0.58368754", "0.5831366", "0.5821215", "0.58185923", "0.58151126", "0.58151126", "0.5813484", "0.5810297", "0.57924247", "0.5791169", "0.5778572", "0.576914", "0.5751584", "0.5746255", "0.5733575", "0.5725576", "0.5725576", "0.5719718", "0.57155794", "0.57118404", "0.5704691", "0.5700806", "0.5700538", "0.5700468", "0.5691914", "0.5689234", "0.5687426", "0.5687426", "0.5677887", "0.5677247", "0.5674624", "0.566859", "0.5667682", "0.56662077", "0.56653297", "0.5661377", "0.5656819", "0.5643166", "0.5637564", "0.56356", "0.56355953", "0.5635591", "0.56330395", "0.563251", "0.56318736", "0.56252617", "0.5622685", "0.5620774", "0.5620774", "0.5620251", "0.5620251", "0.5619711", "0.56139064", "0.5613394", "0.5612618", "0.5611599", "0.5608757", "0.5603498", "0.5602502", "0.5596721", "0.5596721", "0.5596721", "0.5596721", "0.5596251", "0.5595533", "0.5595118", "0.559448", "0.559281", "0.55888283", "0.5586799" ]
0.6534435
8
Get the specified integration.
def get_integration(app_id, integration_id, opts = {}) data, _status_code, _headers = get_integration_with_http_info(app_id, integration_id, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integration\n @integration\n end", "def set_integration\n @integration = Integration.find(params[:id])\n end", "def set_integration\n @integration = Integration.find(params[:id])\n end", "def integration_name; end", "def integration_path(integration)\n \"spec/integration/#{integration}\"\nend", "def get_integration_with_http_info(app_id, integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.get_integration ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.get_integration\"\n end\n # verify the required parameter 'integration_id' is set\n if @api_client.config.client_side_validation && integration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling IntegrationApi.get_integration\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations/{integrationId}\".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_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 = ['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 => 'IntegrationResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#get_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_canvas_integration_url\n response = client.integration_urls\n\n loop do\n response.entries.each do |integration_url|\n return integration_url if integration_url.name == INTEGRATION_URL_NAME\n end\n\n # Get the next page if it exists\n response = response.next\n\n break unless response\n end\n\n return nil\n end", "def show\n begin\n @integration = current_user.integrations.find(params[:id])\n rescue Exception => e\n flash[:notice] = \"You are not authorized to access that Integration\"\n Services::Slog.exception e\n redirect_to :root\n end\n end", "def set_slack_integration\n @slack_integration = SlackIntegration.find(params[:id])\n end", "def get(endpoint)\n client.get(endpoint)\n end", "def get(endpoint)\n client.get(endpoint)\n end", "def get(endpoint)\n client.get(endpoint)\n end", "def set_integration_store\n @integration_store = IntegrationStore.find(params[:id])\n end", "def get_webhooks_integration(webhook_name, opts = {})\n data, _status_code, _headers = get_webhooks_integration_with_http_info(webhook_name, opts)\n data\n end", "def get(endpoint_name)\n self[endpoint_name]\n end", "def current_subscription\n self.subscriptions.current.first\n end", "def get_integration_menu(app_id, integration_id, opts = {})\n data, _status_code, _headers = get_integration_menu_with_http_info(app_id, integration_id, opts)\n return data\n end", "def integration_name\n @integration_name ||= begin\n name = self.name.split('::').last\n name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n name.downcase!\n name.to_sym\n end\n end", "def get endpoint, wrap_name: 'response', **params\n response = HTTParty.get(@base_uri+endpoint, query: params)\n response.parsed_response[wrap_name]\n end", "def intersys_get(property)\n intersys_property(property).get\n end", "def get_subscription(survey_id)\r\n (s = self.subscriptions.by_survey(survey_id)) && s.first\r\n end", "def get_subscription(survey_id)\r\n (s = self.subscriptions.by_survey(survey_id)) && s.first\r\n end", "def get_allocation(integration_point)\n @session.post('facebook.admin.getAllocation', :integration_point_name => integration_point.to_s).to_i\n end", "def get_allocation(integration_point)\n @session.post('facebook.admin.getAllocation', :integration_point_name => integration_point.to_s).to_i\n end", "def get(setting, default = nil)\n prov = backend.provider\n raise Errors::NoProviderSpecifiedError unless prov\n\n prov.get(setting, site_name, environment_name, default)\n end", "def get(_spec)\n raise NotImplementedError, not_implemented_msg(:get)\n end", "def set_integration\n begin\n @integration = Integration.find(params[:id])\n rescue Exception => e\n Services::Slog.exception e\n flash[:notice] = \"Sorry, <i class=\\\"icon-shuffle\\\"></i> couldn't find the integration identified by <em>#{params[:id]}</em>.\"\n redirect_to :controller => \"templates\", :action => \"index\"\n end\n end", "def get(call_uuid)\n valid_param?(:call_uuid, call_uuid, [String, Symbol], true)\n perform_get(call_uuid)\n end", "def get endpoint\n do_request :get, endpoint\n end", "def plugin_get(hook, call_params=nil)\n Aurita::Plugin_Register.get(hook, self, call_params)\n end", "def integrations; end", "def integrations; end", "def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end", "def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end", "def get_sale\n sales.first\n end", "def set_sqs_integration\n @sqs_integration = SqsIntegration.find(params[:id])\n end", "def integration\n if consumer_specified? && provider_specified?\n OpenStruct.new(consumer: consumer, provider: provider)\n else\n nil\n end\n end", "def get_sensor(sensor)\n get_sensors_list([sensor])[sensor]\n end", "def integral\n return Signal.new(:sample_rate => @sample_rate, :data => Calculus.integral(@data))\n end", "def delete_guild_integration(guild_id, integration_id)\n request(\n :guilds_gid_integrations_iid, guild_id,\n :delete,\n \"guilds/#{guild_id}/integrations/#{integration_id}\"\n )\n end", "def get_slack_integration_channel(account_name, channel_name, opts = {})\n data, _status_code, _headers = get_slack_integration_channel_with_http_info(account_name, channel_name, opts)\n data\n end", "def new_session\n IntegrationSession.new\n end", "def integrate!\n raise NotImplementedError.new\n end", "def show\n @integral = Integral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @integral }\n end\n end", "def get(sym)\n call(sym)\n end", "def get(subscription_key)\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::GET_SUBSCRIPTION.gsub(\"{subscription-key}\", ERB::Util.url_encode(subscription_key))\n\n puts \"========== GET A SUBSCRIPTION ============\"\n\n begin\n @z_client.get(args) do |resp|\n ap resp\n return resp if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end", "def get_gateway_by_id(gateway_id)\r\n valid_id?(gateway_id)\r\n url = CLX.paths[:gateway] + '/' + gateway_id.to_s\r\n @http_client.get(url)\r\n end", "def workforce_integrations\n return @workforce_integrations\n end", "def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end", "def get_slack_integration_channel_with_http_info(account_name, channel_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlackIntegrationAPI.get_slack_integration_channel ...'\n end\n # verify the required parameter 'account_name' is set\n if @api_client.config.client_side_validation && account_name.nil?\n fail ArgumentError, \"Missing the required parameter 'account_name' when calling SlackIntegrationAPI.get_slack_integration_channel\"\n end\n # verify the required parameter 'channel_name' is set\n if @api_client.config.client_side_validation && channel_name.nil?\n fail ArgumentError, \"Missing the required parameter 'channel_name' when calling SlackIntegrationAPI.get_slack_integration_channel\"\n end\n # resource path\n local_var_path = '/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}'.sub('{account_name}', CGI.escape(account_name.to_s).gsub('%2F', '/')).sub('{channel_name}', CGI.escape(channel_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'SlackIntegrationChannel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_slack_integration_channel,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SlackIntegrationAPI#get_slack_integration_channel\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_single(scope) \n JSON[RestClient.get \"#{@site}/unit/#{scope}\", :accept=>'json'][0]\n end", "def get_metric start, stop, step\n\t\t@store.get_metric self, start, stop, step\n\tend", "def get!\n throw NotImplementedError\n end", "def get!\n throw NotImplementedError\n end", "def get_integration_log(pk, sk, opts = {})\n data, _status_code, _headers = get_integration_log_with_http_info(pk, sk, opts)\n data\n end", "def get_conversations_messaging_integrations_line_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_line_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.get_conversations_messaging_integrations_line_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/line/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LineIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_line_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def api\n return @api\n end", "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def to_get_request\n 'get_%ss' % api_name\n end", "def get_endpoint()\n end", "def delete_integration(auth, server_id, integration_id)\n MijDiscord::Core::API.request(\n :guilds_sid_integrations_iid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations/#{integration_id}\",\n Authorization: auth\n )\n end", "def get_stock(stock_ticker)\n stock = StockQuote::Stock.quote(stock_ticker)\n return stock\nend", "def get_conversations_messaging_integrations_twitter_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_twitter_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.get_conversations_messaging_integrations_twitter_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/twitter/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TwitterIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_twitter_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get(instance)\n get!(instance)\n end", "def set_cargapp_integration\n @cargapp_integration = CargappIntegration.find(params[:id])\n end", "def get\n raise NotImplementedError\n end", "def get(x = None, y = None)\n execute(:get, x, y)\n end", "def initialize(integration)\n @integration = integration\n @references = [ ]\n end", "def institution_getit_url\n current_primary_institution.getit_url if current_primary_institution.respond_to?(:getit_url)\n end", "def get_current_transport\n x = transport_list\n x[:transports][0]\n end", "def current_invoice\n invoices.opened.first\n end", "def integration_gemfile(integration)\n \"BUNDLE_GEMFILE=#{integration_path(integration)}/Gemfile\"\nend", "def get\n Habberdash::Persistence::Mongoid::Dashboard.first.try(:configuration)\n end", "def get_conversations_messaging_integrations_facebook_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_facebook_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.get_conversations_messaging_integrations_facebook_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/facebook/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FacebookIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_facebook_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_integrations_action(action_id, opts = {})\n data, _status_code, _headers = get_integrations_action_with_http_info(action_id, opts)\n return data\n end", "def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end", "def get(index = nil)\n @local_index.get(index)\n end", "def get_workspace(workspace_namespace, workspace_name)\n path = self.api_root + \"/api/workspaces/#{uri_encode(workspace_namespace)}/#{uri_encode(workspace_name)}\"\n process_firecloud_request(:get, path)\n end", "def api\n self.well_info.api\n end", "def get_current_client\n get_current_hub&.current_client\n end", "def [](metric)\n registry.get(metric.to_sym)\n end", "def get_webhooks_integration_with_http_info(webhook_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.get_webhooks_integration ...'\n end\n # verify the required parameter 'webhook_name' is set\n if @api_client.config.client_side_validation && webhook_name.nil?\n fail ArgumentError, \"Missing the required parameter 'webhook_name' when calling WebhooksIntegrationAPI.get_webhooks_integration\"\n end\n # resource path\n local_var_path = '/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}'.sub('{webhook_name}', CGI.escape(webhook_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'WebhooksIntegration'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_webhooks_integration,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhooksIntegrationAPI#get_webhooks_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get\n execute(:get).to_s\n end", "def run\n integration.run(self)\n end", "def get_plugin(hook)\n get_plugin_by_caller(eval(\"__FILE__\", hook.binding))\n end", "def config_get(id)\n Configuration.get(id)\n end", "def list_integrations_with_http_info(app_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.list_integrations ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.list_integrations\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations\".sub('{' + 'appId' + '}', app_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'types'] = opts[:'types'] if !opts[:'types'].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 = ['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 => 'ListIntegrationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#list_integrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_transcription(transcription_id)\n @client.make_request(:get, @client.concat_user_path(\"#{RECORDING_PATH}/#{id}/transcriptions/#{transcription_id}\"))[0]\n end", "def get\n execute(:get)\n end", "def get\n execute(:get)\n end", "def subscription_for(topic)\n subscriptions.where(:topic_id => topic.id).first\n end", "def gcp_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/integration/gcp\", nil, nil, false)\n end", "def get_api(path, params = {}, env = {})\n current_session.get(\"#{$settings.url}/#{path}\", params, env)\n last_response.body ? Oj.load(last_response.body) : nil\n end", "def get_current_user_api\n $SDK_API\nend", "def test_connection\n return ShopifyAPI::Shop.current\n end", "def active_subscription\n self.active_subscriptions.first\n end", "def get(id)\n @service.get(id)\n end", "def get_integration_log_file(pk, sk, uuid, opts = {})\n data, _status_code, _headers = get_integration_log_file_with_http_info(pk, sk, uuid, opts)\n data\n end", "def get_plugin(name)\n raise \"Unknown plugin: #{ name }\" unless Capistrano::EXTENSIONS.keys.include?(name)\n self.send(name)\n end", "def license\n licenses.first\n end" ]
[ "0.72498006", "0.615705", "0.615705", "0.6006859", "0.5965343", "0.59372413", "0.57735324", "0.5680734", "0.5329793", "0.529376", "0.529376", "0.529376", "0.5270806", "0.52328277", "0.5192563", "0.51766986", "0.5165119", "0.5150433", "0.51286215", "0.5099464", "0.5062347", "0.5062347", "0.50529593", "0.50529593", "0.5040469", "0.50330824", "0.49965283", "0.49961323", "0.49745053", "0.49533373", "0.49418512", "0.49418512", "0.49067074", "0.48967212", "0.4889753", "0.48871642", "0.4882371", "0.487373", "0.4857509", "0.48537582", "0.4850542", "0.4840049", "0.4823561", "0.48180205", "0.48119983", "0.47737998", "0.47688553", "0.47634283", "0.4759531", "0.47285232", "0.47269067", "0.47268283", "0.47161716", "0.47161716", "0.47156322", "0.47048882", "0.47022936", "0.46986037", "0.4697788", "0.46961966", "0.46836656", "0.46783873", "0.46777973", "0.46758863", "0.46720445", "0.46672708", "0.46637902", "0.46610585", "0.46597058", "0.46445683", "0.46408534", "0.4626604", "0.4624178", "0.46166208", "0.4611245", "0.46057677", "0.45956272", "0.45931378", "0.45866168", "0.45758128", "0.45656717", "0.45545846", "0.45503277", "0.45500532", "0.45443666", "0.45391583", "0.45387483", "0.45387036", "0.45362586", "0.45362586", "0.45354897", "0.45209286", "0.45193446", "0.45178086", "0.45132396", "0.45104307", "0.4508156", "0.4505066", "0.4501628", "0.44978514" ]
0.67320865
1
Get the specified integration.
def get_integration_with_http_info(app_id, integration_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: IntegrationApi.get_integration ..." end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling IntegrationApi.get_integration" end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.get_integration" end # resource path local_var_path = "/apps/{appId}/integrations/{integrationId}".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['jwt'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'IntegrationResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#get_integration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integration\n @integration\n end", "def get_integration(app_id, integration_id, opts = {})\n data, _status_code, _headers = get_integration_with_http_info(app_id, integration_id, opts)\n return data\n end", "def set_integration\n @integration = Integration.find(params[:id])\n end", "def set_integration\n @integration = Integration.find(params[:id])\n end", "def integration_name; end", "def integration_path(integration)\n \"spec/integration/#{integration}\"\nend", "def find_canvas_integration_url\n response = client.integration_urls\n\n loop do\n response.entries.each do |integration_url|\n return integration_url if integration_url.name == INTEGRATION_URL_NAME\n end\n\n # Get the next page if it exists\n response = response.next\n\n break unless response\n end\n\n return nil\n end", "def show\n begin\n @integration = current_user.integrations.find(params[:id])\n rescue Exception => e\n flash[:notice] = \"You are not authorized to access that Integration\"\n Services::Slog.exception e\n redirect_to :root\n end\n end", "def set_slack_integration\n @slack_integration = SlackIntegration.find(params[:id])\n end", "def get(endpoint)\n client.get(endpoint)\n end", "def get(endpoint)\n client.get(endpoint)\n end", "def get(endpoint)\n client.get(endpoint)\n end", "def set_integration_store\n @integration_store = IntegrationStore.find(params[:id])\n end", "def get_webhooks_integration(webhook_name, opts = {})\n data, _status_code, _headers = get_webhooks_integration_with_http_info(webhook_name, opts)\n data\n end", "def get(endpoint_name)\n self[endpoint_name]\n end", "def current_subscription\n self.subscriptions.current.first\n end", "def get_integration_menu(app_id, integration_id, opts = {})\n data, _status_code, _headers = get_integration_menu_with_http_info(app_id, integration_id, opts)\n return data\n end", "def integration_name\n @integration_name ||= begin\n name = self.name.split('::').last\n name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n name.downcase!\n name.to_sym\n end\n end", "def get endpoint, wrap_name: 'response', **params\n response = HTTParty.get(@base_uri+endpoint, query: params)\n response.parsed_response[wrap_name]\n end", "def intersys_get(property)\n intersys_property(property).get\n end", "def get_subscription(survey_id)\r\n (s = self.subscriptions.by_survey(survey_id)) && s.first\r\n end", "def get_subscription(survey_id)\r\n (s = self.subscriptions.by_survey(survey_id)) && s.first\r\n end", "def get_allocation(integration_point)\n @session.post('facebook.admin.getAllocation', :integration_point_name => integration_point.to_s).to_i\n end", "def get_allocation(integration_point)\n @session.post('facebook.admin.getAllocation', :integration_point_name => integration_point.to_s).to_i\n end", "def get(setting, default = nil)\n prov = backend.provider\n raise Errors::NoProviderSpecifiedError unless prov\n\n prov.get(setting, site_name, environment_name, default)\n end", "def get(_spec)\n raise NotImplementedError, not_implemented_msg(:get)\n end", "def set_integration\n begin\n @integration = Integration.find(params[:id])\n rescue Exception => e\n Services::Slog.exception e\n flash[:notice] = \"Sorry, <i class=\\\"icon-shuffle\\\"></i> couldn't find the integration identified by <em>#{params[:id]}</em>.\"\n redirect_to :controller => \"templates\", :action => \"index\"\n end\n end", "def get(call_uuid)\n valid_param?(:call_uuid, call_uuid, [String, Symbol], true)\n perform_get(call_uuid)\n end", "def get endpoint\n do_request :get, endpoint\n end", "def plugin_get(hook, call_params=nil)\n Aurita::Plugin_Register.get(hook, self, call_params)\n end", "def integrations; end", "def integrations; end", "def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end", "def get_subscription(subscription_id)\n get(url_(\"subscription\", subscription_id))\n end", "def get_sale\n sales.first\n end", "def set_sqs_integration\n @sqs_integration = SqsIntegration.find(params[:id])\n end", "def integration\n if consumer_specified? && provider_specified?\n OpenStruct.new(consumer: consumer, provider: provider)\n else\n nil\n end\n end", "def get_sensor(sensor)\n get_sensors_list([sensor])[sensor]\n end", "def integral\n return Signal.new(:sample_rate => @sample_rate, :data => Calculus.integral(@data))\n end", "def delete_guild_integration(guild_id, integration_id)\n request(\n :guilds_gid_integrations_iid, guild_id,\n :delete,\n \"guilds/#{guild_id}/integrations/#{integration_id}\"\n )\n end", "def get_slack_integration_channel(account_name, channel_name, opts = {})\n data, _status_code, _headers = get_slack_integration_channel_with_http_info(account_name, channel_name, opts)\n data\n end", "def new_session\n IntegrationSession.new\n end", "def integrate!\n raise NotImplementedError.new\n end", "def show\n @integral = Integral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @integral }\n end\n end", "def get(sym)\n call(sym)\n end", "def get(subscription_key)\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::GET_SUBSCRIPTION.gsub(\"{subscription-key}\", ERB::Util.url_encode(subscription_key))\n\n puts \"========== GET A SUBSCRIPTION ============\"\n\n begin\n @z_client.get(args) do |resp|\n ap resp\n return resp if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end", "def get_gateway_by_id(gateway_id)\r\n valid_id?(gateway_id)\r\n url = CLX.paths[:gateway] + '/' + gateway_id.to_s\r\n @http_client.get(url)\r\n end", "def workforce_integrations\n return @workforce_integrations\n end", "def get_subscription subscription_name, options = {}\n subscriber.get_subscription subscription: subscription_path(subscription_name, options)\n end", "def get_slack_integration_channel_with_http_info(account_name, channel_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlackIntegrationAPI.get_slack_integration_channel ...'\n end\n # verify the required parameter 'account_name' is set\n if @api_client.config.client_side_validation && account_name.nil?\n fail ArgumentError, \"Missing the required parameter 'account_name' when calling SlackIntegrationAPI.get_slack_integration_channel\"\n end\n # verify the required parameter 'channel_name' is set\n if @api_client.config.client_side_validation && channel_name.nil?\n fail ArgumentError, \"Missing the required parameter 'channel_name' when calling SlackIntegrationAPI.get_slack_integration_channel\"\n end\n # resource path\n local_var_path = '/api/v1/integration/slack/configuration/accounts/{account_name}/channels/{channel_name}'.sub('{account_name}', CGI.escape(account_name.to_s).gsub('%2F', '/')).sub('{channel_name}', CGI.escape(channel_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'SlackIntegrationChannel'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_slack_integration_channel,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SlackIntegrationAPI#get_slack_integration_channel\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_single(scope) \n JSON[RestClient.get \"#{@site}/unit/#{scope}\", :accept=>'json'][0]\n end", "def get_metric start, stop, step\n\t\t@store.get_metric self, start, stop, step\n\tend", "def get!\n throw NotImplementedError\n end", "def get!\n throw NotImplementedError\n end", "def get_integration_log(pk, sk, opts = {})\n data, _status_code, _headers = get_integration_log_with_http_info(pk, sk, opts)\n data\n end", "def get_conversations_messaging_integrations_line_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_line_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.get_conversations_messaging_integrations_line_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/line/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LineIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_line_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def api\n return @api\n end", "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def to_get_request\n 'get_%ss' % api_name\n end", "def get_endpoint()\n end", "def delete_integration(auth, server_id, integration_id)\n MijDiscord::Core::API.request(\n :guilds_sid_integrations_iid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/integrations/#{integration_id}\",\n Authorization: auth\n )\n end", "def get_stock(stock_ticker)\n stock = StockQuote::Stock.quote(stock_ticker)\n return stock\nend", "def get_conversations_messaging_integrations_twitter_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_twitter_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.get_conversations_messaging_integrations_twitter_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/twitter/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TwitterIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_twitter_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get(instance)\n get!(instance)\n end", "def set_cargapp_integration\n @cargapp_integration = CargappIntegration.find(params[:id])\n end", "def get\n raise NotImplementedError\n end", "def get(x = None, y = None)\n execute(:get, x, y)\n end", "def initialize(integration)\n @integration = integration\n @references = [ ]\n end", "def institution_getit_url\n current_primary_institution.getit_url if current_primary_institution.respond_to?(:getit_url)\n end", "def get_current_transport\n x = transport_list\n x[:transports][0]\n end", "def current_invoice\n invoices.opened.first\n end", "def integration_gemfile(integration)\n \"BUNDLE_GEMFILE=#{integration_path(integration)}/Gemfile\"\nend", "def get\n Habberdash::Persistence::Mongoid::Dashboard.first.try(:configuration)\n end", "def get_conversations_messaging_integrations_facebook_integration_id_with_http_info(integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ConversationsApi.get_conversations_messaging_integrations_facebook_integration_id ...\"\n end\n \n \n # verify the required parameter 'integration_id' is set\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling ConversationsApi.get_conversations_messaging_integrations_facebook_integration_id\" if integration_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/conversations/messaging/integrations/facebook/{integrationId}\".sub('{format}','json').sub('{' + 'integrationId' + '}', integration_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FacebookIntegration')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConversationsApi#get_conversations_messaging_integrations_facebook_integration_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_integrations_action(action_id, opts = {})\n data, _status_code, _headers = get_integrations_action_with_http_info(action_id, opts)\n return data\n end", "def get(invoice_id, invoice_sequence)\n get_request(t_url(:invoice, invoice_id, invoice_sequence))\n end", "def get(index = nil)\n @local_index.get(index)\n end", "def get_workspace(workspace_namespace, workspace_name)\n path = self.api_root + \"/api/workspaces/#{uri_encode(workspace_namespace)}/#{uri_encode(workspace_name)}\"\n process_firecloud_request(:get, path)\n end", "def api\n self.well_info.api\n end", "def get_current_client\n get_current_hub&.current_client\n end", "def [](metric)\n registry.get(metric.to_sym)\n end", "def get_webhooks_integration_with_http_info(webhook_name, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhooksIntegrationAPI.get_webhooks_integration ...'\n end\n # verify the required parameter 'webhook_name' is set\n if @api_client.config.client_side_validation && webhook_name.nil?\n fail ArgumentError, \"Missing the required parameter 'webhook_name' when calling WebhooksIntegrationAPI.get_webhooks_integration\"\n end\n # resource path\n local_var_path = '/api/v1/integration/webhooks/configuration/webhooks/{webhook_name}'.sub('{webhook_name}', CGI.escape(webhook_name.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'WebhooksIntegration'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :get_webhooks_integration,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhooksIntegrationAPI#get_webhooks_integration\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get\n execute(:get).to_s\n end", "def run\n integration.run(self)\n end", "def get_plugin(hook)\n get_plugin_by_caller(eval(\"__FILE__\", hook.binding))\n end", "def config_get(id)\n Configuration.get(id)\n end", "def list_integrations_with_http_info(app_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.list_integrations ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.list_integrations\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations\".sub('{' + 'appId' + '}', app_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'types'] = opts[:'types'] if !opts[:'types'].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 = ['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 => 'ListIntegrationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#list_integrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_transcription(transcription_id)\n @client.make_request(:get, @client.concat_user_path(\"#{RECORDING_PATH}/#{id}/transcriptions/#{transcription_id}\"))[0]\n end", "def get\n execute(:get)\n end", "def get\n execute(:get)\n end", "def subscription_for(topic)\n subscriptions.where(:topic_id => topic.id).first\n end", "def gcp_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/integration/gcp\", nil, nil, false)\n end", "def get_api(path, params = {}, env = {})\n current_session.get(\"#{$settings.url}/#{path}\", params, env)\n last_response.body ? Oj.load(last_response.body) : nil\n end", "def get_current_user_api\n $SDK_API\nend", "def test_connection\n return ShopifyAPI::Shop.current\n end", "def active_subscription\n self.active_subscriptions.first\n end", "def get(id)\n @service.get(id)\n end", "def get_integration_log_file(pk, sk, uuid, opts = {})\n data, _status_code, _headers = get_integration_log_file_with_http_info(pk, sk, uuid, opts)\n data\n end", "def get_plugin(name)\n raise \"Unknown plugin: #{ name }\" unless Capistrano::EXTENSIONS.keys.include?(name)\n self.send(name)\n end", "def license\n licenses.first\n end" ]
[ "0.72498006", "0.67320865", "0.615705", "0.615705", "0.6006859", "0.5965343", "0.57735324", "0.5680734", "0.5329793", "0.529376", "0.529376", "0.529376", "0.5270806", "0.52328277", "0.5192563", "0.51766986", "0.5165119", "0.5150433", "0.51286215", "0.5099464", "0.5062347", "0.5062347", "0.50529593", "0.50529593", "0.5040469", "0.50330824", "0.49965283", "0.49961323", "0.49745053", "0.49533373", "0.49418512", "0.49418512", "0.49067074", "0.48967212", "0.4889753", "0.48871642", "0.4882371", "0.487373", "0.4857509", "0.48537582", "0.4850542", "0.4840049", "0.4823561", "0.48180205", "0.48119983", "0.47737998", "0.47688553", "0.47634283", "0.4759531", "0.47285232", "0.47269067", "0.47268283", "0.47161716", "0.47161716", "0.47156322", "0.47048882", "0.47022936", "0.46986037", "0.4697788", "0.46961966", "0.46836656", "0.46783873", "0.46777973", "0.46758863", "0.46720445", "0.46672708", "0.46637902", "0.46610585", "0.46597058", "0.46445683", "0.46408534", "0.4626604", "0.4624178", "0.46166208", "0.4611245", "0.46057677", "0.45956272", "0.45931378", "0.45866168", "0.45758128", "0.45656717", "0.45545846", "0.45503277", "0.45500532", "0.45443666", "0.45391583", "0.45387483", "0.45387036", "0.45362586", "0.45362586", "0.45354897", "0.45209286", "0.45193446", "0.45178086", "0.45132396", "0.45104307", "0.4508156", "0.4505066", "0.4501628", "0.44978514" ]
0.59372413
6
Get the specified integration's menu.
def get_integration_menu(app_id, integration_id, opts = {}) data, _status_code, _headers = get_integration_menu_with_http_info(app_id, integration_id, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMenu(menu)\n end", "def menu\n response[\"menu\"]\n end", "def menu\n @menu ||= Interface::Menu.new(self)\n end", "def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end", "def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end", "def menu\n @menu ||= Menu.new\n end", "def main_Menu_Name\n Goldberg.menu.main_Menu_Name\n end", "def get_Menu_Item\n item_name = session[:goldberg][:menu_item]\n end", "def current_menu_item\n controller.current_menu_item\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 active_menu\n active[:main_menu].try(:to_s)\n end", "def type\n \"mymenu\"\n end", "def get_html_menu(req)\n @menu_vis = 'menu-visible-secondary'\n get_html(req)\n end", "def get_item(item_name)\n return @menu[item_name]\n end", "def get_menu_path\n until @yaml\n Yuyi.say 'Navigate to a menu file...', :type => :success\n Yuyi.ask \"...or just press enter to load `#{Yuyi::DEFAULT_MENU}`\", :readline => true do |user_path|\n menu_path = user_path.empty? ? Yuyi::DEFAULT_MENU : user_path\n load_from_file menu_path\n end\n end\n end", "def menu_items\n menu.items(self)\n end", "def menu_items\n menu.items(self)\n end", "def createMenuItems(invocation)\r\n \r\n menu = []\r\n\r\n # Which part of the interface the user selects\r\n ctx = invocation.getInvocationContext()\r\n\r\n # Sitemap history, Proxy History will show menu item if selected by the user\r\n @stdout.println('Menu TYPE: %s\\n' % ctx)\r\n if ctx == 5 or ctx == 6 or ctx == 7\r\n\r\n faradayMenu = JMenuItem.new(\"Send to Faraday\", nil)\r\n\r\n faradayMenu.addActionListener do |e|\r\n eventScan(invocation, ctx)\r\n end\r\n\r\n menu.push(faradayMenu)\r\n end\r\n \r\n return menu\r\n end", "def resource\n @menu ||= params[:id].present? ? Transit::Menu.find(params[:id]) : Transit::Menu.new\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(req)\n @menu_vis = 'menu-visible-primary'\n inventory(req)\n end", "def createMenuItems(invocation)\n\n menu = []\n\n # Which part of the interface the user selects\n ctx = invocation.getInvocationContext()\n\n # Sitemap history, Proxy History, Request views, and Scanner will show menu item if selected by the user\n #@stdout.println('Menu TYPE: %s\\n' % ctx)\n if ctx == 5 or ctx == 6 or ctx == 2 or ctx == 7\n\n \t faradayMenu = JMenuItem.new(\"Send to Faraday\", nil)\n\n \t faradayMenu.addActionListener do |e|\n \t eventScan(invocation, ctx)\n \t end\n\n \t menu.push(faradayMenu)\n end\n\n return menu\n end", "def navmenu_id which\n \"#{which}-navmenu\"\n end", "def main_menu\n main_menu = parent\n return main_menu if main_menu.present?\n\n parent_menu = parent_item\n parent_menu.main_menu if parent_menu.present?\n end", "def open_menu\n touch_screen_element menu_icon\n end", "def index\n @root_menus = @system_config.menus.root_menus\n end", "def menus\n Vedeu::Menus.registered\n end", "def iterm_menu\n terminal_process = Appscript.app(\"System Events\").processes[\"iTerm\"]\n terminal_process.menu_bars.first\n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def get_integration_menu_with_http_info(app_id, integration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.get_integration_menu ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.get_integration_menu\"\n end\n # verify the required parameter 'integration_id' is set\n if @api_client.config.client_side_validation && integration_id.nil?\n fail ArgumentError, \"Missing the required parameter 'integration_id' when calling IntegrationApi.get_integration_menu\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations/{integrationId}/menu\".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_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 = ['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 => 'MenuResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#get_integration_menu\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def menu_html\n menu = wiki.settings.menu\n if !menu.nil?\n html = \"<ul>\\n\"\n menu.each do |item|\n title, href = item['title'], item['href']\n if version != 'master' && item['href'].index('/') == 0\n prefix = version.start_with?('v') ? \"/#{version}\" : \"/v#{version}\"\n else\n prefix = \"\"\n end\n html << \"<li class=\\\"minibutton\\\"><a href=\\\"#{prefix}#{href}\\\">#{title}</a></li>\\n\"\n end\n html << \"</ul>\\n\"\n end\n end", "def current_menu_item\n if action_name == \"index\"\n loaded_menu_items[-2]\n else\n loaded_menu_items[-1]\n end\n end", "def computeNewMenu\n @NewMenu = Wx::Menu.new\n @Controller.getIntegrationPlugins.each do |iPluginID, iPluginInfo|\n lNewMenuItem = Wx::MenuItem.new(@NewMenu, Wx::ID_ANY, iPluginInfo[:Title])\n lNewMenuItem.bitmap = @Controller.getPluginBitmap(iPluginInfo)\n @NewMenu.append_item(lNewMenuItem)\n # The event\n # Clone variables to make them persistent in the Proc context\n lPluginIDCloned = iPluginID\n evt_menu(lNewMenuItem) do |iEvent|\n @Controller.accessIntegrationPlugin(lPluginIDCloned) do |iPlugin|\n @DisplayedList << [\n lPluginIDCloned,\n [],\n true,\n iPlugin.getDefaultOptions,\n [ nil, nil ]\n ]\n end\n refreshList\n end\n end\n end", "def get_minimenu_item(minimenu, selection_type = nil)\r\n #initialize selection_type if needed\r\n selection_type = 0 if selection_type == nil\r\n #flag window as waiting\r\n @waiting = true\r\n #create the minimenu sprite\r\n menu = Sprite_ZeldaCMS_Minimenu.new(minimenu, @cursor)\r\n menu.x, menu.y = @xy_pos[@index]\r\n #loop until an item has been selected or cancelled\r\n loop do\r\n Graphics.update\r\n Input.update\r\n menu.update\r\n break if Input.trigger(InputC) Input.trigger(InputB) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[0]) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[1]) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[2])\r\n end\r\n #get the item\r\n item = menu.item\r\n item = nil if Input.trigger(InputB)\r\n selection_type = 0 if Input.trigger(XAS_COMMANDITEM_ACTION[0])\r\n selection_type = 1 if Input.trigger(XAS_COMMANDITEM_ACTION[1])\r\n selection_type = 2 if Input.trigger(XAS_COMMANDITEM_ACTION[2])\r\n #dispose the menu\r\n menu.dispose\r\n #move menu cursor\r\n @cursor.x, @cursor.y = @xy_pos[@index][0], @xy_pos[@index][1]\r\n #return the item\r\n return item, selection_type\r\n end", "def return_menu\n MenuControllerContracts.invariant(self)\n @current_view = @views[0]\n MenuControllerContracts.invariant(self)\n end", "def menu_extras\n self[:menu_extras] || []\n end", "def assigned_menu\n\n end", "def get( wrapped_page_layout, resource_position=0 )\n key = wrapped_page_layout.to_key \n menu_tree = nil\n unless menus_cache.key? key\n #wrapped_page_layout.assigned_menu_id may not exist for some reason. \n assigned_menu_id = wrapped_page_layout.assigned_menu_id(resource_position)\n if assigned_menu_id>0 and SpreeTheme.taxon_class.exists?( assigned_menu_id )\n menu_tree = SpreeTheme.taxon_class.find( assigned_menu_id ).self_and_descendants\n end\n menus_cache[key] = menu_tree \n end\n \n if menus_cache[key].blank?\n # get default menu\n if wrapped_page_layout.section.present?\n wrapped_resource = wrapped_page_layout.section.section_piece.wrapped_resources[resource_position]\n if wrapped_resource.present?\n menus_cache[key] = DefaultTaxonRoot.instance_by_context( wrapped_resource.context ).self_and_descendants\n end\n end\n end\n#Rails.logger.debug \"wrapped_page_layout=#{key}, menu_tree=#{menu_tree}\" \n if menus_cache[key].present?\n WrappedMenu.new( self, menus_cache[key].first)\n else \n nil \n end\n end", "def menu_items\n\n menu.items(self)\n\n end", "def set_menu\n set_system_config\n @menu = @system_config.menus.find(params[:id])\n end", "def menu_router\n selection = display_menu\n case selection\n when 'My List'\n my_list\n when 'Recommendations'\n recommendations_menu\n else\n case_menu(selection)\n end\n end", "def menu(selected)\n @menu = selected\n end", "def init_menu\n @menus.set_selected(\"dashboard\")\n end", "def menu\n @streams.select { |stream| stream.is_a? MenuStream }\n end", "def set_api_menu\n @api_menu = Menu.find(params[:id])\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 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 main_menu_link; MAIN_MENU_LINK; end", "def system_menu\n reply = []\n\n reply << if current_user == User.anonymous\n MenuItem.new('Sign In', new_session_path)\n else\n MenuItem.new('Profile', current_user)\n end\n\n reply += [\n MenuItem.new('Dashboard', admin_root_path),\n MenuItem.new('Content', admin_nodes_path, [\n MenuItem.new('New', new_admin_node_path, ScratchPad::Addon::NodeExtension.enabled.sort.map { |extension|\n MenuItem.new(extension.title, new_admin_node_path(:node_type => extension.machine_name))\n })\n ]),\n MenuItem.new('Taxonomy', admin_vocabularies_path, [\n MenuItem.new('New', new_admin_vocabulary_path)\n ]),\n MenuItem.new('Filters', admin_filter_groups_path, [\n MenuItem.new('New', new_admin_filter_group_path)\n ]),\n MenuItem.new('Themes', admin_themes_path, [\n MenuItem.new('Frontend', admin_themes_path(:scope => :frontend)),\n MenuItem.new('Backend', admin_themes_path(:scope => :backend))\n ]),\n MenuItem.new('Users', admin_users_path, [\n MenuItem.new('New', new_admin_user_path)\n ]),\n MenuItem.new('Groups'),\n MenuItem.new('Permissions'),\n MenuItem.new('Settings', admin_settings_path),\n MenuItem.new('Addon Configuration', admin_addon_configurations_path, ScratchPad::Addon::Base.addon_types.map { |addon_type|\n MenuItem.new(addon_type.title.pluralize, admin_addon_configurations_path(addon_type.machine_name))\n })\n ] if authorize\n\n reply\n end", "def menu(current)\n Model::MENU.map{ |m|\n li_class =\n [current == m[:section] ? \"active\" : \"\", m[:cls].to_s].join(\" \")\n \"<li class=\\\"#{li_class}\\\"><a href=\\\"#{m[:href]}\\\">#{m[:label]}</a>\"\n }.join(\"\")\n end", "def menu # can do custom methods within a method/class\n end", "def name\n object.try(:menu_display_name)\n end", "def return_to_menu(input)\n if input.downcase == \"menu\"\n menu_items\n end\nend", "def current_order_item\n order = Order.where(\"user_id = ? and is_ordered = false\", self.id)\n if (order.length > 0)\n order[0].order_menus\n else\n []\n end \n end", "def selection_menu\n h = {\n a: :select_all,\n u: :unselect_all,\n s: :toggle_select,\n '*' => 'toggle_multiple_selection',\n 'x' => 'toggle_visual_mode',\n 'm' => 'toggle_selection_mode',\n v: :view_selected_files\n }\n menu 'Selection Menu', h\nend", "def wiki_menu_select\n wiki_menu\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Search by Character\",\n \" [2] Search by House\",\n \" [3] Main Menu\",\n \" [4] Exit App\"\n ]\n prompt.select(\" \", menu_choices)\nend", "def get_current_menu_item\n return @jsession_store.get_session[:active_transaction].pdt_method.program_name.to_s if(@jsession_store.get_session[:active_transaction]!=nil && self.class.name != @jsession_store.get_session[:active_transaction].class.name)\n if @pdt_method\n return @pdt_method.program_name\n end\n return nil\n end", "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 _command\n send_cmd(\"menu #{_command}\")\n end", "def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\n end", "def admin_menu_items\n menu = []\n menu.push([t(\"menu.home\"), admin_home_path, Proc.new {controller_name == \"home\"}])\n if current_user\n menu.push([t(\"menu.projects\"), admin_projects_path, Proc.new {controller_name == \"projects\" || controller_name == \"project_to_users\"}])\n menu.push([t(\"menu.users\"), admin_users_path, Proc.new {controller_name == \"users\"}])\n menu.push([t(\"menu.profile\"), admin_profile_path, Proc.new {controller_name == \"profile\"}])\n menu.push([t(\"menu.logout\"), logout_path])\n end\n menu\n end", "def menu_from_tag(t)\n if t.menu && t.target_tag.present?\n [(t.target_tag.predefined_class.blank? ? feature_path(t.target_tag.slug) : predefined_tags[t.target_tag.predefined_class]), '#', t.target_name].join\n else\n predefined_tags[t.predefined_class] || feature_path(t.slug)\n end\n end", "def header_menu\n return [] unless current_user\n permissions = current_user.permissions.pluck(:name)\n permissions << 'administration_section' if current_user.admin_permission?\n MENU['permissions'].select do |key, value|\n value if permissions.include? key\n end\n end", "def display_menu(menu)\n puts menu.title\n menu.menu_items.each_with_index { |item| puts \"#{item.key_user_returns}.\\t #{item.user_message}\" }\n end", "def menu\nend", "def get_menu_index(menu, name)\n menu.find_index{|item| item[:title] == name }\n end", "def get( wrapped_page_layout, resource_position=0 )\n key = wrapped_page_layout.to_key \n unless menus_cache.key? key\n menu_tree = nil\n #wrapped_page_layout.assigned_menu_id may not exist for some reason. \n assigned_menu_id = wrapped_page_layout.assigned_menu_id(resource_position)\n if assigned_menu_id>0 and SpreeTheme.taxon_class.exists?( assigned_menu_id )\n menu_tree = SpreeTheme.taxon_class.find( assigned_menu_id ).self_and_descendants\n end\n menus_cache[key] = menu_tree \n end\n if menus_cache[key].present?\n WrappedMenu.new( self, menus_cache[key].first)\n else\n nil \n end\n end", "def get_menu_choice\n\t\tchoices = [\"1. Play Hangman\", \"2. Load Saved Game\", \"3. Delete Saved Game\",\n\t\t\t\"4. List Saved Games\", \"5. Quit\"]\n\t\tdisplay_menu choices\n\n\t\twhile true\n\t\t\tprint \"Enter Selection (1 - #{ choices.length }): \"\n\t\t\tchoice = gets.chomp.to_i\n\t\t\treturn choice if choice.between?(1, choices.length)\n\t\tend\n\tend", "def menu_selection \nend", "def fetch!(client)\n client.menu(self.guid)\n end", "def current_menu_link\n @current_menu_link ||= (InternalTab.where(controller: controller_name, action: action_name).first || InternalTab.where(controller: controller_name).first || InternalTab.new)\n end", "def current_menu(cntrl)\n true if controller.controller_name.eql?(cntrl)\n end", "def ivr_menu\n begin\n _call = direction\n if _call.present?\n urls = _call.ivr_menu(params) if defined?(_call.ivr_menu)\n end\n rescue => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n end\n render :plain => urls, content_type: \"text/plain\", :status => 200\n end", "def parent parent\n @menu.parent parent\n end", "def menu_primary\n Lynr::View::Menu.new('Menu', \"/menu/#{@dealership.slug}\", :menu_admin) unless @dealership.nil?\n end", "def menu(options)\n return nil if options.empty?\n \n return_hash = options[0].kind_of?(Hash)\n\n _options = Hash.new\n _options[\"items\"] = (\n if return_hash\n options.collect { |e| e['separator'] ? '-' : e['title'] }\n else\n options.collect { |e| e == nil ? '-' : e }\n end )\n _options[\"no-newfile\"] = \"\"\n\n res = cocoa_dialog(\"menu\", _options)\n\n return nil unless res\n index = res.to_i - 1\n\n return return_hash ? options[index] : index\n end", "def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end", "def menu\n if self.has_parent?\n menu = self.parent.menu\n else\n menu = {:levels=>0,:items=>Array.new}\n end\n\n if !self.menu_items.empty?\n menu[:items][ menu[:levels] ] = self.menu_items\n menu[:levels] = menu[:levels]+1\n end\n\n return menu\n end", "def index\n if @menu\n @menu_items = @menu.items\n else\n @menu_items = MenuItem.all\n end\n end", "def show # Show method\n menu # Show menu method above\n end", "def create_activity_menu\n # Create an array for the menu to display the activity names\n menu = []\n @activities.each { |activity| menu.push(activity.name)}\n return menu\n end", "def case_menu(selection)\n case selection\n when 'Playlist'\n @playlist.menu\n when 'Account Details'\n account_details\n when 'Exit'\n p \"Is this exiting?\"\n end\n end", "def set_current_menu\r\n @current_menu = params[:controller].to_sym\r\n @current_sub_menu = nil\r\n end", "def select_menu(path)\r\n menu_item(path).click\r\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 select_menu_item app, *path\n app.application.select_menu_item *path\n end", "def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend", "def refinery_menu_pages\n Menu.new Page.fast_menu\n end", "def set_menu _menu_name\n send_cmd(\"set_menu #{_menu_name}\")\n end", "def analyze_menu\n analyze = Menu.new(\"What would you like to see?\")\n analyze.add_menu_item({key_user_returns: 1, user_message: \"Get all time/theatres for a particular movie.\", do_if_chosen: [\"get_time_location_for_movie\"]})\n analyze.add_menu_item({key_user_returns: 2, user_message: \"Get all times for a particular theatre.\", do_if_chosen: [\"get_time_location_for_location\"]})\n analyze.add_menu_item({key_user_returns: 3, user_message: \"Get all movies played at this time.\", do_if_chosen: [\"get_all_movies_for_this_time\"]})\n analyze.add_menu_item({key_user_returns: 4, user_message: \"Get all time/theatres that are sold out or not sold out.\", do_if_chosen: [\"get_sold_time_locations\"]})\n analyze.add_menu_item({key_user_returns: 5, user_message: \"Get all movies from a particular studio or rating.\", do_if_chosen: [\"get_movies_like_this\"]})\n analyze.add_menu_item({key_user_returns: 6, user_message: \"Get all theatres that are booked or not fully booked.\", do_if_chosen: [\"get_available_locations\"]})\n analyze.add_menu_item({key_user_returns: 7, user_message: \"Get number of staff needed for a time slot.\", do_if_chosen: [\"get_num_staff_needed\"]})\n analyze.add_menu_item({key_user_returns: 8, user_message: \"Return to main menu.\", do_if_chosen: \n [\"main_menu\"]})\n run_menu_and_call_next(analyze)\n end", "def main_menu(identifier)\n find('nav.navbar a', text: identifier)\n end", "def menu\n \nend", "def item(*args)\n @__submenu_generation__.item(*args)\n end", "def menu_item(path)\r\n current_menu_items = root_menu_items\r\n matching_menu_item = nil\r\n path.each_with_index do |target_menu_item, index|\r\n case current_menu_items\r\n when Array\r\n matching_menu_item = current_menu_items.find {|node| node.name == target_menu_item} #TODO: make this work with regexes as well as strings...\r\n raise Bewildr::ElementDoesntExist if matching_menu_item.nil?\r\n when Bewildr::Element\r\n if current_menu_items.name == target_menu_item #TODO: make this work with regexes as well as strings...\r\n matching_menu_item = current_menu_items\r\n else\r\n raise Bewildr::ElementDoesntExist\r\n end\r\n end\r\n raise Bewildr::ElementDoesntExist if matching_menu_item.nil?\r\n if path.size != index + 1\r\n matching_menu_item.expand\r\n current_menu_items = matching_menu_item.sub_menus\r\n end\r\n end\r\n return matching_menu_item\r\n end", "def menu_title\n to_s\n end", "def index\n @custom_menus = @sub_project.custom_menus.all\n end", "def index\n #@fdn_menus = Fdn::Menu.all\n @fdn_menu = Fdn::Menu.top_level.first\n end", "def current_menu_entries(e=nil)\n @cursor_helper.current_menu_entries(menu)\n end", "def menu_items(menu_id, &block)\n _index(\"menus/#{menu_id}/items\", \"items\", &block)\n end" ]
[ "0.8057258", "0.73783845", "0.7023886", "0.69802", "0.69117165", "0.6782335", "0.67647916", "0.6726301", "0.6502469", "0.6478615", "0.6383293", "0.6349364", "0.63136274", "0.62679", "0.6260542", "0.6230084", "0.6230084", "0.61998355", "0.6198331", "0.6192469", "0.6186416", "0.6177117", "0.6153864", "0.61222327", "0.61112195", "0.6098552", "0.60707873", "0.60684586", "0.60528034", "0.60528034", "0.60519636", "0.6028977", "0.60203356", "0.60074717", "0.5994749", "0.59640604", "0.59522116", "0.5929518", "0.59123194", "0.5909012", "0.5898139", "0.58965313", "0.5876963", "0.5863571", "0.58629334", "0.58612764", "0.58550394", "0.5853805", "0.585318", "0.5837007", "0.58244073", "0.5823011", "0.5822819", "0.5805271", "0.5796243", "0.57929265", "0.5792552", "0.5787593", "0.5779188", "0.5772051", "0.5770417", "0.5749241", "0.57405806", "0.57382727", "0.5727742", "0.5722552", "0.5711622", "0.5681769", "0.5678659", "0.56638426", "0.5660633", "0.56605077", "0.56424004", "0.56295794", "0.5622157", "0.56098807", "0.5606177", "0.56013757", "0.5592445", "0.55749094", "0.557475", "0.5568948", "0.55657715", "0.55649924", "0.55545044", "0.5553905", "0.55526763", "0.5546971", "0.55380213", "0.5526995", "0.55258846", "0.55253404", "0.55205303", "0.5510149", "0.5508524", "0.5504618", "0.54943246", "0.5491663", "0.5485007", "0.5482984" ]
0.6116323
24
Get the specified integration&39;s menu.
def get_integration_menu_with_http_info(app_id, integration_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: IntegrationApi.get_integration_menu ..." end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling IntegrationApi.get_integration_menu" end # verify the required parameter 'integration_id' is set if @api_client.config.client_side_validation && integration_id.nil? fail ArgumentError, "Missing the required parameter 'integration_id' when calling IntegrationApi.get_integration_menu" end # resource path local_var_path = "/apps/{appId}/integrations/{integrationId}/menu".sub('{' + 'appId' + '}', app_id.to_s).sub('{' + 'integrationId' + '}', integration_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['jwt'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'MenuResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#get_integration_menu\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMenu(menu)\n end", "def menu\n response[\"menu\"]\n end", "def main_Menu_Name\n Goldberg.menu.main_Menu_Name\n end", "def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end", "def get_Menu_Item\n item_name = session[:goldberg][:menu_item]\n end", "def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\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\n @menu ||= Interface::Menu.new(self)\n end", "def type\n \"mymenu\"\n end", "def active_menu\n active[:main_menu].try(:to_s)\n end", "def wiki_menu_select\n wiki_menu\n prompt = TTY::Prompt.new\n menu_choices = [\n \" [1] Search by Character\",\n \" [2] Search by House\",\n \" [3] Main Menu\",\n \" [4] Exit App\"\n ]\n prompt.select(\" \", menu_choices)\nend", "def iterm_menu\n terminal_process = Appscript.app(\"System Events\").processes[\"iTerm\"]\n terminal_process.menu_bars.first\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 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 open_menu\n touch_screen_element menu_icon\n end", "def menu _command\n send_cmd(\"menu #{_command}\")\n end", "def current_menu_item\n controller.current_menu_item\n end", "def menu ()\n menu_string = \"1. Show Menu\\n\"\n menu_string += \"2. Add Numbers\\n\"\n menu_string += \"3. Subtract Numbers\\n\"\n menu_string += \"4. Quit\\n\"\n return menu_string\nend", "def navmenu_id which\n \"#{which}-navmenu\"\n end", "def menu_html\n menu = wiki.settings.menu\n if !menu.nil?\n html = \"<ul>\\n\"\n menu.each do |item|\n title, href = item['title'], item['href']\n if version != 'master' && item['href'].index('/') == 0\n prefix = version.start_with?('v') ? \"/#{version}\" : \"/v#{version}\"\n else\n prefix = \"\"\n end\n html << \"<li class=\\\"minibutton\\\"><a href=\\\"#{prefix}#{href}\\\">#{title}</a></li>\\n\"\n end\n html << \"</ul>\\n\"\n end\n end", "def get_integration_menu(app_id, integration_id, opts = {})\n data, _status_code, _headers = get_integration_menu_with_http_info(app_id, integration_id, opts)\n return data\n end", "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 get_html_menu(req)\n @menu_vis = 'menu-visible-secondary'\n get_html(req)\n end", "def menu\n @menu ||= Menu.new\n end", "def showCommandingMenu _args\n \"showCommandingMenu _args;\" \n end", "def menu_items\n menu.items(self)\n end", "def menu_items\n menu.items(self)\n end", "def createMenuItems(invocation)\r\n \r\n menu = []\r\n\r\n # Which part of the interface the user selects\r\n ctx = invocation.getInvocationContext()\r\n\r\n # Sitemap history, Proxy History will show menu item if selected by the user\r\n @stdout.println('Menu TYPE: %s\\n' % ctx)\r\n if ctx == 5 or ctx == 6 or ctx == 7\r\n\r\n faradayMenu = JMenuItem.new(\"Send to Faraday\", nil)\r\n\r\n faradayMenu.addActionListener do |e|\r\n eventScan(invocation, ctx)\r\n end\r\n\r\n menu.push(faradayMenu)\r\n end\r\n \r\n return menu\r\n end", "def ivr_menu\n begin\n _call = direction\n if _call.present?\n urls = _call.ivr_menu(params) if defined?(_call.ivr_menu)\n end\n rescue => e\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n end\n render :plain => urls, content_type: \"text/plain\", :status => 200\n end", "def interactive_menu\n loop do\n print_menu\n selection\n end\nend", "def menus\n Vedeu::Menus.registered\n end", "def main_menu_link; MAIN_MENU_LINK; end", "def print_menu\n puts \"Which action [list|add|delete|mark|idea|quit]?\"\nend", "def createMenuItems(invocation)\n\n menu = []\n\n # Which part of the interface the user selects\n ctx = invocation.getInvocationContext()\n\n # Sitemap history, Proxy History, Request views, and Scanner will show menu item if selected by the user\n #@stdout.println('Menu TYPE: %s\\n' % ctx)\n if ctx == 5 or ctx == 6 or ctx == 2 or ctx == 7\n\n \t faradayMenu = JMenuItem.new(\"Send to Faraday\", nil)\n\n \t faradayMenu.addActionListener do |e|\n \t eventScan(invocation, ctx)\n \t end\n\n \t menu.push(faradayMenu)\n end\n\n return menu\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 menu(req)\n @menu_vis = 'menu-visible-primary'\n inventory(req)\n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def menu(context={})\n \n app = context[:app]\n\n menu_items = [ \n ] \n \n end", "def get_item(item_name)\n return @menu[item_name]\n end", "def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end", "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def show_com_menu\n TactBattleManager.selecting(true)\n show_tb_command_window_tb\n end", "def get_current_menu_item\n return @jsession_store.get_session[:active_transaction].pdt_method.program_name.to_s if(@jsession_store.get_session[:active_transaction]!=nil && self.class.name != @jsession_store.get_session[:active_transaction].class.name)\n if @pdt_method\n return @pdt_method.program_name\n end\n return nil\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 get_minimenu_item(minimenu, selection_type = nil)\r\n #initialize selection_type if needed\r\n selection_type = 0 if selection_type == nil\r\n #flag window as waiting\r\n @waiting = true\r\n #create the minimenu sprite\r\n menu = Sprite_ZeldaCMS_Minimenu.new(minimenu, @cursor)\r\n menu.x, menu.y = @xy_pos[@index]\r\n #loop until an item has been selected or cancelled\r\n loop do\r\n Graphics.update\r\n Input.update\r\n menu.update\r\n break if Input.trigger(InputC) Input.trigger(InputB) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[0]) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[1]) \r\n Input.trigger(XAS_COMMANDITEM_ACTION[2])\r\n end\r\n #get the item\r\n item = menu.item\r\n item = nil if Input.trigger(InputB)\r\n selection_type = 0 if Input.trigger(XAS_COMMANDITEM_ACTION[0])\r\n selection_type = 1 if Input.trigger(XAS_COMMANDITEM_ACTION[1])\r\n selection_type = 2 if Input.trigger(XAS_COMMANDITEM_ACTION[2])\r\n #dispose the menu\r\n menu.dispose\r\n #move menu cursor\r\n @cursor.x, @cursor.y = @xy_pos[@index][0], @xy_pos[@index][1]\r\n #return the item\r\n return item, selection_type\r\n end", "def main_menu\n puts \"Main Menu\"\n puts \"(a) - Basic calculator\"\n puts \"(b) - Advanced calculator\"\n puts \"(c) - Special calculators\"\n puts \"(q) - Quit\"\nend", "def menu # can do custom methods within a method/class\n end", "def menu_selection \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 get_menu_choice\n\t\tchoices = [\"1. Play Hangman\", \"2. Load Saved Game\", \"3. Delete Saved Game\",\n\t\t\t\"4. List Saved Games\", \"5. Quit\"]\n\t\tdisplay_menu choices\n\n\t\twhile true\n\t\t\tprint \"Enter Selection (1 - #{ choices.length }): \"\n\t\t\tchoice = gets.chomp.to_i\n\t\t\treturn choice if choice.between?(1, choices.length)\n\t\tend\n\tend", "def get_menu_path\n until @yaml\n Yuyi.say 'Navigate to a menu file...', :type => :success\n Yuyi.ask \"...or just press enter to load `#{Yuyi::DEFAULT_MENU}`\", :readline => true do |user_path|\n menu_path = user_path.empty? ? Yuyi::DEFAULT_MENU : user_path\n load_from_file menu_path\n end\n end\n end", "def menu(current)\n Model::MENU.map{ |m|\n li_class =\n [current == m[:section] ? \"active\" : \"\", m[:cls].to_s].join(\" \")\n \"<li class=\\\"#{li_class}\\\"><a href=\\\"#{m[:href]}\\\">#{m[:label]}</a>\"\n }.join(\"\")\n end", "def assigned_menu\n\n end", "def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend", "def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(q) - quit\"\nend", "def menu_items\n\n menu.items(self)\n\n end", "def strass_menu_help\n puts \"Available Options for the String Assistant Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"show basic \".light_yellow + \" => \".white + \"Show Basic Functions\".light_red\n puts \"show build \".light_yellow + \" => \".white + \"Show Builder Functions\".light_red\n puts \"show tamper \".light_yellow + \" => \".white + \"Show Tamper Functions\".light_red\n puts \"show append \".light_yellow + \" => \".white + \"Show Append Functions\".light_red\n puts \"show space \".light_yellow + \" => \".white + \"Show Whitespace Functions\".light_red\n puts \"show comma \".light_yellow + \" => \".white + \"Show Comma Functions\".light_red\n puts \"show floor \".light_yellow + \" => \".white + \"Show Floor() Functions\".light_red\n print_line(\"\")\nend", "def return_to_menu(input)\n if input.downcase == \"menu\"\n menu_items\n end\nend", "def index\n @root_menus = @system_config.menus.root_menus\n end", "def main_menu\n puts\"(b) - basic calculator\"\n puts\"(a) - advanced calculator\"\n puts\"(bmi) - body mass index\"\n puts\"(t) - trip calculator\"\n puts\"(m) - morgage\"\n puts\"(q) - quit\"\nend", "def computeNewMenu\n @NewMenu = Wx::Menu.new\n @Controller.getIntegrationPlugins.each do |iPluginID, iPluginInfo|\n lNewMenuItem = Wx::MenuItem.new(@NewMenu, Wx::ID_ANY, iPluginInfo[:Title])\n lNewMenuItem.bitmap = @Controller.getPluginBitmap(iPluginInfo)\n @NewMenu.append_item(lNewMenuItem)\n # The event\n # Clone variables to make them persistent in the Proc context\n lPluginIDCloned = iPluginID\n evt_menu(lNewMenuItem) do |iEvent|\n @Controller.accessIntegrationPlugin(lPluginIDCloned) do |iPlugin|\n @DisplayedList << [\n lPluginIDCloned,\n [],\n true,\n iPlugin.getDefaultOptions,\n [ nil, nil ]\n ]\n end\n refreshList\n end\n end\n end", "def testnumberedmenu\n list1 = %w{ ruby perl python erlang rake java lisp scheme chicken }\n list1[0] = %w{ ruby ruby1.9 ruby1.8.x jruby rubinius ROR }\n list1[5] = %w{ java groovy grails }\n str = numbered_menu list1, { :title => \"Languages: \", :prompt => \"Select :\" }\n $log.debug \"17 We got #{str.class} \"\n message \"We got #{str} \"\nend", "def menu\n account = Account.where(:consume_phone_number => params[:To]).first\n menu_option = account.menu_options.where(:name => params[:object_name].downcase.strip).first\n response = menu_option.build_voice_response(params[:Digits])\n \n render :text => response.text\n end", "def current_menu_entries(e=nil)\n @cursor_helper.current_menu_entries(menu)\n end", "def menu(selected)\n @menu = selected\n end", "def backend_menu\n config = AccountAccess.maps_for(current_account).collect(&:project_modules).flatten.uniq.collect(&:config)\n config << { :text => I18n.t(\"backend.menus.help\", :default => \"Help\"), :handler => \"function() { Backend.app.openHelp() }\".to_l }\n return config.to_json\n end", "def set_menu _menu_name\n send_cmd(\"set_menu #{_menu_name}\")\n end", "def main_menu\n h = { \n \"1\" => :view_article,\n \"2\" => :view_comments,\n :f => :display_forum,\n :v => :view_menu,\n :r => :reload,\n :m => :fetch_more,\n :R => :reddit_options,\n :H => :hacker_options,\n :s => :sort_menu, \n :C => :config_menu,\n :a => :view_article,\n :c => :view_comments,\n :x => :extras\n }\n=begin\n :a => :ack,\n \"/\" => :ffind,\n :l => :locate,\n :v => :viminfo,\n :z => :z_interface,\n :d => :child_dirs,\n :r => :recent_files,\n :t => :dirtree,\n \"4\" => :tree,\n :F => :filter_menu,\n :c => :command_menu ,\n :B => :bindkey_ext_command,\n :M => :newdir,\n \"%\" => :newfile,\n=end\n\n menu \"Main Menu\", h\nend", "def main_menu\n\tputs \"[a] - addition\"\n\tputs \"[s] - subtraction\"\n\tputs \"[m] - multiplication\"\n\tputs \"[d] - divison\"\n\tputs \"[exp] - exponent\"\n\tputs \"[sqrt] - square root\"\n\tputs \"[q] - quit\"\nend", "def display_menu(menu)\n puts menu.title\n menu.menu_items.each_with_index { |item| puts \"#{item.key_user_returns}.\\t #{item.user_message}\" }\n end", "def case_menu(selection)\n case selection\n when 'Playlist'\n @playlist.menu\n when 'Account Details'\n account_details\n when 'Exit'\n p \"Is this exiting?\"\n end\n end", "def menu\n gets.chomp\nend", "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 print_menu\n print <<MENU\n \\nPlease choose one of the following options:\n 1. Encrypt\n 2. Decrypt\n 3. Exit\nMENU\nend", "def menu\n puts \"Menu\"\n puts \"1. List Channels\"\n puts \"2. List Users\"\n puts \"3. Select User\"\n puts \"4. Select Channel\"\n puts \"5. Send Message\"\n puts \"6. Quit\"\nend", "def menu\nend", "def init_menu\n @menus.set_selected(\"teambox\")\n @menus.set_selected(\"licenses\")\n end", "def call_menu\n call_idle($game_player.old_character_name, false)\n syn_map_menu\n end", "def main_menu\n selection = input(@menu) {|o| (1..2) === o.to_i }.to_i\n \n if 1 == selection\n :continue\n elsif 2 == selection\n :quit\n end\n end", "def get_menu_choice\n\n valid_cmds = [ # array of valid commands we will accept\n \"exit\",\n \"0\", \"00\",\n \"1\",\"2\",\"3\",\"4\",\"5\",\n \"show recent\",\n \"scrape more\",\n \"search\",\n \"search by pay\",\n \"results\"\n ]\n\n response = \"\"\n until valid_cmds.include?(response)\n print \"Please Enter a Command or Number: \".blue\n response = gets.chomp.downcase\n end\n\n clear_screen\n response\n end", "def system_menu\n reply = []\n\n reply << if current_user == User.anonymous\n MenuItem.new('Sign In', new_session_path)\n else\n MenuItem.new('Profile', current_user)\n end\n\n reply += [\n MenuItem.new('Dashboard', admin_root_path),\n MenuItem.new('Content', admin_nodes_path, [\n MenuItem.new('New', new_admin_node_path, ScratchPad::Addon::NodeExtension.enabled.sort.map { |extension|\n MenuItem.new(extension.title, new_admin_node_path(:node_type => extension.machine_name))\n })\n ]),\n MenuItem.new('Taxonomy', admin_vocabularies_path, [\n MenuItem.new('New', new_admin_vocabulary_path)\n ]),\n MenuItem.new('Filters', admin_filter_groups_path, [\n MenuItem.new('New', new_admin_filter_group_path)\n ]),\n MenuItem.new('Themes', admin_themes_path, [\n MenuItem.new('Frontend', admin_themes_path(:scope => :frontend)),\n MenuItem.new('Backend', admin_themes_path(:scope => :backend))\n ]),\n MenuItem.new('Users', admin_users_path, [\n MenuItem.new('New', new_admin_user_path)\n ]),\n MenuItem.new('Groups'),\n MenuItem.new('Permissions'),\n MenuItem.new('Settings', admin_settings_path),\n MenuItem.new('Addon Configuration', admin_addon_configurations_path, ScratchPad::Addon::Base.addon_types.map { |addon_type|\n MenuItem.new(addon_type.title.pluralize, admin_addon_configurations_path(addon_type.machine_name))\n })\n ] if authorize\n\n reply\n end", "def main_menu\n puts \"(b) - basic calculator\"\n puts \"(a) - advanced calculator\"\n puts \"(bmi) - BMI calculator\"\n puts \"(m) - mortgage calculator\"\n puts \"(t) - trip calculator\"\n puts \"(q) - quit\"\nend", "def menu\n\tputs \"(b)asic, (a)dvanced, or (q)uit\"\n\t$menu_choice = gets.chomp.downcase\nend", "def right_js_unit_menu(unit)\n content_tag :ul, unit.unit_methods.all.collect { |method|\n menu_link_to(method.name, method)\n }\n end", "def menu_router\n selection = display_menu\n case selection\n when 'My List'\n my_list\n when 'Recommendations'\n recommendations_menu\n else\n case_menu(selection)\n end\n end", "def display_menu()\n return 'Welcome to the Chicken Farm Simulator'\nend", "def show_menu\n puts \"Type 'q' to quit\"\n puts \"Or press Return to continue\"\nend", "def current_menu_item\n if action_name == \"index\"\n loaded_menu_items[-2]\n else\n loaded_menu_items[-1]\n end\n end", "def press_menu\n driver.pressQuickMenuItem(text, true);\n end", "def main_menu(identifier)\n find('nav.navbar a', text: identifier)\n end", "def menu_extras\n self[:menu_extras] || []\n end", "def init_menu\n @menus.set_selected(\"dashboard\")\n end", "def menu(options)\n return nil if options.empty?\n \n return_hash = options[0].kind_of?(Hash)\n\n _options = Hash.new\n _options[\"items\"] = (\n if return_hash\n options.collect { |e| e['separator'] ? '-' : e['title'] }\n else\n options.collect { |e| e == nil ? '-' : e }\n end )\n _options[\"no-newfile\"] = \"\"\n\n res = cocoa_dialog(\"menu\", _options)\n\n return nil unless res\n index = res.to_i - 1\n\n return return_hash ? options[index] : index\n end", "def menu\n puts '1) Promedio de notas'\n puts '2) Inasistencia alumnos'\n puts '3) Alumnos aprobados'\n puts '4) Salir'\nend", "def build_menu(application_name, method_names)\n #take array of method names and turn into menu\n puts \"#{application_name.humanize}\"\n method_names.each_with_index {|method_name, index| puts \"#{index + 1}: #{method_name.to_s.humanize}\"}\n puts \"\\nPlease enter your selection:\"\nend", "def menu_from_tag(t)\n if t.menu && t.target_tag.present?\n [(t.target_tag.predefined_class.blank? ? feature_path(t.target_tag.slug) : predefined_tags[t.target_tag.predefined_class]), '#', t.target_name].join\n else\n predefined_tags[t.predefined_class] || feature_path(t.slug)\n end\n end", "def current_menu(cntrl)\n true if controller.controller_name.eql?(cntrl)\n end", "def menu\n puts \"EEG query app\"\n puts \"1: return EEG value\"\n puts \"2: return attention value\"\n puts \"3: return meditation value\"\n gets.chomp\nend", "def select_menu_item app, *path\n app.application.select_menu_item *path\n end", "def current_order_item\n order = Order.where(\"user_id = ? and is_ordered = false\", self.id)\n if (order.length > 0)\n order[0].order_menus\n else\n []\n end \n end" ]
[ "0.738", "0.6905551", "0.65372527", "0.6433806", "0.6427877", "0.6426081", "0.63800097", "0.62675285", "0.6221076", "0.6219634", "0.6149875", "0.61408615", "0.60928905", "0.5998326", "0.59744567", "0.5964217", "0.59331447", "0.59310305", "0.59239626", "0.5912258", "0.58638066", "0.5855784", "0.58192885", "0.5814035", "0.5791055", "0.57789946", "0.57789946", "0.5755175", "0.57519627", "0.5738741", "0.5735519", "0.57299036", "0.57026404", "0.570251", "0.56917423", "0.56863976", "0.5685162", "0.5685162", "0.56671894", "0.56567013", "0.56512105", "0.564798", "0.56177235", "0.5614621", "0.56071764", "0.55781305", "0.5573684", "0.5566295", "0.5564332", "0.555443", "0.5552914", "0.5543941", "0.55405706", "0.55209255", "0.55209255", "0.551862", "0.5516843", "0.55054986", "0.55043745", "0.5492884", "0.54872906", "0.54785836", "0.5471039", "0.5471033", "0.54443514", "0.5439842", "0.5438371", "0.54343045", "0.54327786", "0.54324245", "0.5432117", "0.54283434", "0.5425219", "0.54222214", "0.54143906", "0.5411968", "0.5411066", "0.5408964", "0.5404837", "0.540308", "0.53951895", "0.5394444", "0.5393921", "0.53928363", "0.5391929", "0.5388395", "0.5376837", "0.5368795", "0.5366987", "0.5351335", "0.53408146", "0.5334705", "0.5324694", "0.5307633", "0.53058887", "0.5305455", "0.5305286", "0.52962273", "0.5287801", "0.5287272" ]
0.57358354
30
List integrations for the specified app.
def list_integrations(app_id, opts = {}) data, _status_code, _headers = list_integrations_with_http_info(app_id, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_integrations_with_http_info(app_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: IntegrationApi.list_integrations ...\"\n end\n # verify the required parameter 'app_id' is set\n if @api_client.config.client_side_validation && app_id.nil?\n fail ArgumentError, \"Missing the required parameter 'app_id' when calling IntegrationApi.list_integrations\"\n end\n # resource path\n local_var_path = \"/apps/{appId}/integrations\".sub('{' + 'appId' + '}', app_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'types'] = opts[:'types'] if !opts[:'types'].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 = ['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 => 'ListIntegrationsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IntegrationApi#list_integrations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @cargapp_integrations = CargappIntegration.all\n end", "def gcp_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/integration/gcp\", nil, nil, false)\n end", "def list\n Requests::ListAppLocations.new.\n send_to_api(:get, endpoint_path(:v14))\n end", "def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\n end", "def azure_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/integration/azure\", nil, nil, false)\n end", "def index\n @erp_integrations = ErpIntegration.all\n end", "def index\n @registered_apps = RegisteredApp.all\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def index\n @apps = Addon.all\n end", "def index\n @apps = @call.app_class.unscoped.all(:order => :id)\n end", "def apps\n apps_search = []\n App.all.each do |app|\n apps_search << {\n title: app.name,\n description: app.package_id,\n url: app_path(id: app.id)\n }\n end\n gon.apps = apps_search\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def index\n @integrations = current_user.integrations\n @events = Event.by_user_limit current_user\n end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def index\n @applists = Applist.all\n end", "def index\n @app_instances = AppInstance.all\n end", "def index\n validate_arguments!\n\n installed = api.get_addons(app).body\n if installed.empty?\n display(\"#{app} has no add-ons.\")\n else\n available, pending = installed.partition { |a| a['configured'] }\n\n unless available.empty?\n styled_header(\"#{app} Configured Add-ons\")\n styled_array(available.map do |a|\n [a['name'], a['attachment_name'] || '']\n end)\n end\n\n unless pending.empty?\n styled_header(\"#{app} Add-ons to Configure\")\n styled_array(pending.map do |a|\n [a['name'], app_addon_url(a['name'])]\n end)\n end\n end\n end", "def index\n @integrations = Integration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @integrations }\n end\n end", "def index\n @app_users = @app.app_users.all\n end", "def apps_grid(apps)\n initialize_grid(\n apps,\n name: \"apps\",\n order: \"apps.created_at\",\n order_direction: \"desc\",\n per_page: 100,\n include: [{ user: :org }, :latest_version_app, { taggings: :tag }],\n )\n end", "def list_apps\n render :text => app_configs.keys\n end", "def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end", "def applications_list\n get \"applications\"\n end", "def get_addons(app=nil)\n path = if app\n \"/apps/#{app}/addons\"\n else\n \"/addons\"\n end\n request(\n :expects => 200,\n :method => :get,\n :path => path\n )\n end", "def index\n @applists = Applist.includes(user_applists: [:user]).page(params[:page])\n end", "def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @user_edorg = session[:edOrgId]\n\n load_apps()\n\n # create a list of app auth info including edorgs element, count of authorized edorgs, and app name\n @app_auth_info = []\n user_app_auths = ApplicationAuthorization.findAllInChunks\n user_app_auths.each do |auth|\n info = {}\n app = @apps_map[auth.appId]\n info[:edorg_auth] = auth\n info[:count] = get_edorg_auth_count(auth)\n info[:name] = app ? app.name : ''\n @app_auth_info.push(info)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n @payment_apps = PaymentApp.all\n end", "def list_aws_logs_integrations(opts = {})\n data, _status_code, _headers = list_aws_logs_integrations_with_http_info(opts)\n data\n end", "def index\n @apps = Application.order(:name).all\n end", "def index\n @integration_stores = IntegrationStore.all\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def index\n @app_requests = AppRequest.all\n end", "def index\n @cotiz_apps = CotizApp.all\n end", "def index\n @appList = AppProdu.getAppIdAndNameList current_member.id\n end", "def list\n apps = Hermes::Route.list(Hash[options.map{|(k,v)| [k.to_sym,v]}])\n if !apps.empty?\n puts \"Apps:\"\n apps.each do |app|\n puts \" - #{app}\"\n end\n else\n puts \"No apps routed\"\n end\n end", "def integrations_loaded\n integrations = instrumented_integrations\n return if integrations.empty?\n\n integrations.map { |name, integration| \"#{name}@#{integration.class.version}\" }.join(',')\n end", "def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end", "def index\n installed = heroku.installed_addons(app)\n if installed.empty?\n display \"No addons installed\"\n else\n available, pending = installed.partition { |a| a['configured'] }\n\n available.map do |a|\n if a['attachment_name']\n a['name'] + ' => ' + a['attachment_name']\n else\n a['name']\n end\n end.sort.each do |addon|\n display(addon)\n end\n\n unless pending.empty?\n display \"\\n--- not configured ---\"\n pending.map { |a| a['name'] }.sort.each do |addon|\n display addon.ljust(24) + \"http://#{heroku.host}/myapps/#{app}/addons/#{addon}\"\n end\n end\n end\n end", "def index\n @app_users = AppUser.all\n end", "def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end", "def index\n @api_v1_shopping_lists = ShoppingList.all\n end", "def index\n @customer_apps = CustomerApp.for_account(active_account)\n end", "def list_integration_installation_repositories(options = {})\n opts = ensure_api_media_type(:integrations, options)\n paginate \"/installation/repositories\", opts\n end", "def endpoints_list\n get \"endpoints\"\n end", "def filter_apps\n @apps = ThirdpartyService.get_app_version(@url, AUTH, @http)['list']\n filter_result = render_to_string(partial: 'home/app_list', layout: false)\n render json: { filter_result: filter_result }\n end", "def addons(app_env)\n app_setting_list('addons', app_env)\n end", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def index\n @app = App.find(params[:app_id])\n @promo_codes = PromoCode.find_all_by_app_id(params[:app_id])\n end", "def list_experiments\n @interface.list_experiments\n end", "def apps\n return @apps\n end", "def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end", "def index\n @instructor_apps = InstructorApp.all\n end", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend", "def index\n @webhook_endpoints = WebhookEndpoint.all\n end", "def all(include_deleted: false)\n r = client.iaps(app_id: self.application.apple_id)\n return_iaps = []\n r.each do |product|\n attrs = product\n attrs[:application] = self.application\n loaded_iap = Tunes::IAPList.factory(attrs)\n next if loaded_iap.status == \"deleted\" && !include_deleted\n return_iaps << loaded_iap\n end\n return_iaps\n end", "def apps\n @apps.keys\n end", "def index\n @test_apps = TestApp.all\n end", "def index\n @test_apps = TestApp.all\n end", "def index\n @phone_apps = PhoneApp.all\n end", "def index\n @desarrollo_apps = DesarrolloApp.all\n end", "def index\n @manage_app_versions = Manage::AppVersion.all\n end", "def app_list\n host_os_family.app_list( self )\n end", "def list_endpoints\n render json: @endpoints, status: 200\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end", "def index\n @appdata = Appdatum.all\n end", "def get_models(app_name)\n index = @apps.index(app_name)\n models = @apps[index].models\n end", "def index\n @tourist_site_app_services = TouristSiteAppService.all\n end", "def get_apps(scope)\n\t\tcase scope\n\t\twhen :added\n\t\t\treturn ClientApplication.select(\"client_applications.*\").\n\t\t\tjoins(:oauth_tokens).\n\t\t\twhere(\"oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null and oauth_tokens.type = 'AccessToken'\").\n\t\t\twhere(\"client_applications.id = oauth_tokens.client_application_id and oauth_tokens.user_id = #{id}\").\n\t\t\tgroup(\"client_applications.id\").\n\t\t\torder(\"oauth_tokens.authorized_at DESC\")\n\t\t\n\t\twhen :created\n\t\t\treturn apps\n\t\tend\n\tend", "def app_lists(id = nil, opts = {})\n load_resource(AppList, id, opts)\n end", "def index\n @user ||= current_user\n @apps = @user.apps.all\n # @app = @user.apps.find(params[:id]) \n\n end", "def index\n skip_policy_scope\n @applications = current_user&.oauth_applications\n if @applications&.empty?\n skip_authorization\n else\n @applications&.each do |app|\n authorize app, policy_class: Oauth::ApplicationPolicy\n end\n end\n end", "def list()\n _params = {}\n return @master.call 'webhooks/list', _params\n end", "def apps\n collect\n end", "def index\n @switterapps = Switterapp.all\n end", "def index\n @endpoints = @project.endpoints.all\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def index\n respond_with @applications = Application.all\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def index\n @apps = current_user.apps.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @apps }\n end\n end", "def index\n @otg_clients = OtgClient.all\n end", "def list_all_webhook_subscription_for_tool_proxy(opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end", "def index\n add_breadcrumb :index, :index\n @admin_apps = initialize_grid(App, per_page: 20)\n end", "def list(opts = {})\n search_provider.list(opts)\n end", "def index\n @api_subscriptions = Api::Subscription.all\n end", "def index\n @doctor_apps = DoctorApp.all\n end", "def get_application_list(opts = {})\n data, _status_code, _headers = get_application_list_with_http_info(opts)\n data\n end", "def index\n @herga_applications = HergaApplication.all\n end", "def list_org\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n org = current_org and current_org!(prm, org)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n opt = { locals: { name: org&.label } }\n respond_to do |format|\n format.html { render 'account/index', **opt }\n format.json { render 'account/index', **opt }\n format.xml { render 'account/index', **opt }\n end\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend" ]
[ "0.69517565", "0.66954434", "0.6122563", "0.6005462", "0.5984", "0.59315574", "0.588744", "0.587151", "0.5828431", "0.58080006", "0.5699765", "0.56705964", "0.56573564", "0.5644541", "0.5643877", "0.5595212", "0.55887514", "0.55709916", "0.5567373", "0.55255437", "0.5505226", "0.5492654", "0.546956", "0.5463734", "0.5447096", "0.54025126", "0.5401343", "0.536651", "0.536651", "0.536651", "0.536651", "0.536651", "0.53635633", "0.53447866", "0.53423214", "0.53124374", "0.52936935", "0.528253", "0.5257772", "0.5257772", "0.5257503", "0.5245907", "0.5235543", "0.52293944", "0.5229377", "0.52246255", "0.51942563", "0.5185889", "0.5183953", "0.51802456", "0.51782", "0.51733774", "0.5160245", "0.5154327", "0.5134871", "0.5117706", "0.5117706", "0.51147115", "0.5111315", "0.5107938", "0.50804734", "0.50784785", "0.5077276", "0.5063882", "0.5063778", "0.50220114", "0.5017668", "0.5012117", "0.5012117", "0.5010117", "0.5008995", "0.5005823", "0.49992058", "0.49943277", "0.4992889", "0.49898016", "0.4985546", "0.49696338", "0.49695286", "0.4959804", "0.49529576", "0.49442977", "0.49409196", "0.4937388", "0.4933419", "0.4907695", "0.49065796", "0.49049166", "0.49019253", "0.4901132", "0.49002957", "0.48882335", "0.4885619", "0.4881478", "0.4869088", "0.48690292", "0.48678046", "0.48653576", "0.48633328", "0.48627254" ]
0.7768685
0
List integrations for the specified app.
def list_integrations_with_http_info(app_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: IntegrationApi.list_integrations ..." end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling IntegrationApi.list_integrations" end # resource path local_var_path = "/apps/{appId}/integrations".sub('{' + 'appId' + '}', app_id.to_s) # query parameters query_params = {} query_params[:'types'] = opts[:'types'] if !opts[:'types'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['jwt'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ListIntegrationsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: IntegrationApi#list_integrations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_integrations(app_id, opts = {})\n data, _status_code, _headers = list_integrations_with_http_info(app_id, opts)\n return data\n end", "def index\n @cargapp_integrations = CargappIntegration.all\n end", "def gcp_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/integration/gcp\", nil, nil, false)\n end", "def list\n Requests::ListAppLocations.new.\n send_to_api(:get, endpoint_path(:v14))\n end", "def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\n end", "def azure_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/integration/azure\", nil, nil, false)\n end", "def index\n @erp_integrations = ErpIntegration.all\n end", "def index\n @registered_apps = RegisteredApp.all\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def index\n @apps = Addon.all\n end", "def index\n @apps = @call.app_class.unscoped.all(:order => :id)\n end", "def apps\n apps_search = []\n App.all.each do |app|\n apps_search << {\n title: app.name,\n description: app.package_id,\n url: app_path(id: app.id)\n }\n end\n gon.apps = apps_search\n end", "def index\n @apps = Array.new\n App.find_all_by_accepted(true).each do |a|\n campaign = a.getActiveCampaign\n if !campaign.nil?\n if campaign.isAvailable\n @apps << a\n end\n end\n end\n\n @applist = Array.new\n device = nil\n\n if params.has_key?(:device_uid)\n device = Device.find_by_uuid(params[:device_uid])\n end\n\n @apps.collect do |app|\n app_image = nil\n available_tokens = get_available_tokens(app, device)\n\n if (app.image.url != nil)\n app_image = \"#{app.image.url}\"\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :image => app_image, :rating => available_tokens, :timeRemaining => -1 }\n else\n @applist << { :id => app.id, :name => app.name, :description => app.description, :url => app.url, :rating => available_tokens, :timeRemaining => -1 }\n end\n end\n\n json_apps = @applist.to_json\n render status: 200, json: json_apps\n end", "def index\n @integrations = current_user.integrations\n @events = Event.by_user_limit current_user\n end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def index\n @applists = Applist.all\n end", "def index\n @app_instances = AppInstance.all\n end", "def index\n validate_arguments!\n\n installed = api.get_addons(app).body\n if installed.empty?\n display(\"#{app} has no add-ons.\")\n else\n available, pending = installed.partition { |a| a['configured'] }\n\n unless available.empty?\n styled_header(\"#{app} Configured Add-ons\")\n styled_array(available.map do |a|\n [a['name'], a['attachment_name'] || '']\n end)\n end\n\n unless pending.empty?\n styled_header(\"#{app} Add-ons to Configure\")\n styled_array(pending.map do |a|\n [a['name'], app_addon_url(a['name'])]\n end)\n end\n end\n end", "def index\n @integrations = Integration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @integrations }\n end\n end", "def index\n @app_users = @app.app_users.all\n end", "def apps_grid(apps)\n initialize_grid(\n apps,\n name: \"apps\",\n order: \"apps.created_at\",\n order_direction: \"desc\",\n per_page: 100,\n include: [{ user: :org }, :latest_version_app, { taggings: :tag }],\n )\n end", "def list_apps\n render :text => app_configs.keys\n end", "def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end", "def applications_list\n get \"applications\"\n end", "def get_addons(app=nil)\n path = if app\n \"/apps/#{app}/addons\"\n else\n \"/addons\"\n end\n request(\n :expects => 200,\n :method => :get,\n :path => path\n )\n end", "def index\n @applists = Applist.includes(user_applists: [:user]).page(params[:page])\n end", "def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @apps = App.all\n end", "def index\n @user_edorg = session[:edOrgId]\n\n load_apps()\n\n # create a list of app auth info including edorgs element, count of authorized edorgs, and app name\n @app_auth_info = []\n user_app_auths = ApplicationAuthorization.findAllInChunks\n user_app_auths.each do |auth|\n info = {}\n app = @apps_map[auth.appId]\n info[:edorg_auth] = auth\n info[:count] = get_edorg_auth_count(auth)\n info[:name] = app ? app.name : ''\n @app_auth_info.push(info)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n @payment_apps = PaymentApp.all\n end", "def list_aws_logs_integrations(opts = {})\n data, _status_code, _headers = list_aws_logs_integrations_with_http_info(opts)\n data\n end", "def index\n @apps = Application.order(:name).all\n end", "def index\n @integration_stores = IntegrationStore.all\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def index\n @app_requests = AppRequest.all\n end", "def index\n @cotiz_apps = CotizApp.all\n end", "def index\n @appList = AppProdu.getAppIdAndNameList current_member.id\n end", "def list\n apps = Hermes::Route.list(Hash[options.map{|(k,v)| [k.to_sym,v]}])\n if !apps.empty?\n puts \"Apps:\"\n apps.each do |app|\n puts \" - #{app}\"\n end\n else\n puts \"No apps routed\"\n end\n end", "def integrations_loaded\n integrations = instrumented_integrations\n return if integrations.empty?\n\n integrations.map { |name, integration| \"#{name}@#{integration.class.version}\" }.join(',')\n end", "def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end", "def index\n installed = heroku.installed_addons(app)\n if installed.empty?\n display \"No addons installed\"\n else\n available, pending = installed.partition { |a| a['configured'] }\n\n available.map do |a|\n if a['attachment_name']\n a['name'] + ' => ' + a['attachment_name']\n else\n a['name']\n end\n end.sort.each do |addon|\n display(addon)\n end\n\n unless pending.empty?\n display \"\\n--- not configured ---\"\n pending.map { |a| a['name'] }.sort.each do |addon|\n display addon.ljust(24) + \"http://#{heroku.host}/myapps/#{app}/addons/#{addon}\"\n end\n end\n end\n end", "def index\n @app_users = AppUser.all\n end", "def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end", "def index\n @api_v1_shopping_lists = ShoppingList.all\n end", "def index\n @customer_apps = CustomerApp.for_account(active_account)\n end", "def list_integration_installation_repositories(options = {})\n opts = ensure_api_media_type(:integrations, options)\n paginate \"/installation/repositories\", opts\n end", "def endpoints_list\n get \"endpoints\"\n end", "def filter_apps\n @apps = ThirdpartyService.get_app_version(@url, AUTH, @http)['list']\n filter_result = render_to_string(partial: 'home/app_list', layout: false)\n render json: { filter_result: filter_result }\n end", "def addons(app_env)\n app_setting_list('addons', app_env)\n end", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def index\n @app = App.find(params[:app_id])\n @promo_codes = PromoCode.find_all_by_app_id(params[:app_id])\n end", "def list_experiments\n @interface.list_experiments\n end", "def apps\n return @apps\n end", "def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end", "def index\n @instructor_apps = InstructorApp.all\n end", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend", "def index\n @webhook_endpoints = WebhookEndpoint.all\n end", "def all(include_deleted: false)\n r = client.iaps(app_id: self.application.apple_id)\n return_iaps = []\n r.each do |product|\n attrs = product\n attrs[:application] = self.application\n loaded_iap = Tunes::IAPList.factory(attrs)\n next if loaded_iap.status == \"deleted\" && !include_deleted\n return_iaps << loaded_iap\n end\n return_iaps\n end", "def apps\n @apps.keys\n end", "def index\n @test_apps = TestApp.all\n end", "def index\n @test_apps = TestApp.all\n end", "def index\n @phone_apps = PhoneApp.all\n end", "def index\n @desarrollo_apps = DesarrolloApp.all\n end", "def index\n @manage_app_versions = Manage::AppVersion.all\n end", "def app_list\n host_os_family.app_list( self )\n end", "def list_endpoints\n render json: @endpoints, status: 200\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(PAGE_SIZE)\n jobs.each { |job| job.current_user = @context.user }\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: \"jobs\", meta: count(page_dict[:total_count]).\n merge({ pagination: page_dict }), adapter: :json\n end", "def index\n @appdata = Appdatum.all\n end", "def get_models(app_name)\n index = @apps.index(app_name)\n models = @apps[index].models\n end", "def index\n @tourist_site_app_services = TouristSiteAppService.all\n end", "def get_apps(scope)\n\t\tcase scope\n\t\twhen :added\n\t\t\treturn ClientApplication.select(\"client_applications.*\").\n\t\t\tjoins(:oauth_tokens).\n\t\t\twhere(\"oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null and oauth_tokens.type = 'AccessToken'\").\n\t\t\twhere(\"client_applications.id = oauth_tokens.client_application_id and oauth_tokens.user_id = #{id}\").\n\t\t\tgroup(\"client_applications.id\").\n\t\t\torder(\"oauth_tokens.authorized_at DESC\")\n\t\t\n\t\twhen :created\n\t\t\treturn apps\n\t\tend\n\tend", "def app_lists(id = nil, opts = {})\n load_resource(AppList, id, opts)\n end", "def index\n @user ||= current_user\n @apps = @user.apps.all\n # @app = @user.apps.find(params[:id]) \n\n end", "def index\n skip_policy_scope\n @applications = current_user&.oauth_applications\n if @applications&.empty?\n skip_authorization\n else\n @applications&.each do |app|\n authorize app, policy_class: Oauth::ApplicationPolicy\n end\n end\n end", "def list()\n _params = {}\n return @master.call 'webhooks/list', _params\n end", "def apps\n collect\n end", "def index\n @switterapps = Switterapp.all\n end", "def index\n @endpoints = @project.endpoints.all\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def index\n respond_with @applications = Application.all\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def index\n @apps = current_user.apps.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @apps }\n end\n end", "def index\n @otg_clients = OtgClient.all\n end", "def list_all_webhook_subscription_for_tool_proxy(opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end", "def index\n add_breadcrumb :index, :index\n @admin_apps = initialize_grid(App, per_page: 20)\n end", "def list(opts = {})\n search_provider.list(opts)\n end", "def index\n @api_subscriptions = Api::Subscription.all\n end", "def index\n @doctor_apps = DoctorApp.all\n end", "def get_application_list(opts = {})\n data, _status_code, _headers = get_application_list_with_http_info(opts)\n data\n end", "def index\n @herga_applications = HergaApplication.all\n end", "def list_org\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n org = current_org and current_org!(prm, org)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n opt = { locals: { name: org&.label } }\n respond_to do |format|\n format.html { render 'account/index', **opt }\n format.json { render 'account/index', **opt }\n format.xml { render 'account/index', **opt }\n end\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend" ]
[ "0.7768685", "0.66954434", "0.6122563", "0.6005462", "0.5984", "0.59315574", "0.588744", "0.587151", "0.5828431", "0.58080006", "0.5699765", "0.56705964", "0.56573564", "0.5644541", "0.5643877", "0.5595212", "0.55887514", "0.55709916", "0.5567373", "0.55255437", "0.5505226", "0.5492654", "0.546956", "0.5463734", "0.5447096", "0.54025126", "0.5401343", "0.536651", "0.536651", "0.536651", "0.536651", "0.536651", "0.53635633", "0.53447866", "0.53423214", "0.53124374", "0.52936935", "0.528253", "0.5257772", "0.5257772", "0.5257503", "0.5245907", "0.5235543", "0.52293944", "0.5229377", "0.52246255", "0.51942563", "0.5185889", "0.5183953", "0.51802456", "0.51782", "0.51733774", "0.5160245", "0.5154327", "0.5134871", "0.5117706", "0.5117706", "0.51147115", "0.5111315", "0.5107938", "0.50804734", "0.50784785", "0.5077276", "0.5063882", "0.5063778", "0.50220114", "0.5017668", "0.5012117", "0.5012117", "0.5010117", "0.5008995", "0.5005823", "0.49992058", "0.49943277", "0.4992889", "0.49898016", "0.4985546", "0.49696338", "0.49695286", "0.4959804", "0.49529576", "0.49442977", "0.49409196", "0.4937388", "0.4933419", "0.4907695", "0.49065796", "0.49049166", "0.49019253", "0.4901132", "0.49002957", "0.48882335", "0.4885619", "0.4881478", "0.4869088", "0.48690292", "0.48678046", "0.48653576", "0.48633328", "0.48627254" ]
0.69517565
1
open stream if it is not opened
def openInputStream(stream) if stream.getByteStream stream else stream.getSystemId url = URL.new(stream.getSystemId) if url.scheme == 'file' && url.login == 'localhost' s = open(url.urlpath) stream.setByteStream(s) return stream end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stream\n synchronize { open! if @stream.nil?; @stream }\n end", "def open\n [head, open_stream] * \"\"\n end", "def open_for_read\n end", "def opened\n raise NotImplementedError\n end", "def opened\n end", "def open?(uri); end", "def open\n raise NotImplementedError\n end", "def opening; end", "def opening; end", "def opening; end", "def open_for_read\n self.eof_flag = false\n open_data_for_read\n end", "def open?\n end", "def open\n object.open\n end", "def stream?\n return false\n end", "def open\n yield self\n ensure\n @io.close unless @io.closed?\n end", "def initialize\n open\n end", "def open?\n @open || true\n end", "def stream?\n @stream\n end", "def stream?\n @stream\n end", "def open?\n @open\n end", "def open?\n @open\n end", "def open?\n fail NotImplementedError\n end", "def open?\n is_open\n end", "def open_resource(url_file_stream_or_string, options)\n options[:handlers] ||= []\n\n if url_file_stream_or_string.respond_to?(:read)\n return url_file_stream_or_string\n\n elsif url_file_stream_or_string == '-'\n return $stdin\n end\n \n # open-uri freaks out if there's leading spaces.\n url_file_stream_or_string.strip!\n \n \n uri = Addressable::URI.parse(url_file_stream_or_string)\n if uri && ['http','https','ftp'].include?(uri.scheme)\n auth = nil\n\n if uri.host && uri.password\n auth = Base64::encode64(\"#{uri.user}:#{uri.password}\").strip\n uri.password = nil\n url_file_stream_or_string = uri.to_s\n end\n\n req_headers = {} \n req_headers[\"User-Agent\"] = options[:agent] || USER_AGENT\n req_headers[\"If-None-Match\"] = options[:etag] if options[:etag]\n \n if options[:modified]\n if options[:modified].is_a?(String)\n req_headers[\"If-Modified-Since\"] = parse_date(options[:modified]).httpdate\n elsif options[:modified].is_a?(Time)\n req_headers[\"If-Modified-Since\"] = options[:modified].httpdate\n elsif options[:modified].is_a?(Array)\n req_headers[\"If-Modified-Since\"] = py2rtime(options[:modified]).httpdate\n end\n end\n \n req_headers[\"Referer\"] = options[:referrer] if options[:referrer]\n req_headers[\"Accept-encoding\"] = 'gzip, deflate' # FIXME make tests\n req_headers[\"Authorization\"] = \"Basic #{auth}\" if auth\n req_headers['Accept'] = ACCEPT_HEADER if ACCEPT_HEADER\n req_headers['A-IM'] = 'feed' # RFC 3229 support \n \n begin\n return open(url_file_stream_or_string, req_headers) \n rescue OpenURI::HTTPError => e\n return e.io\n rescue\n end\n end\n\n # try to open with native open function (if url_file_stream_or_string is a filename)\n begin \n return open(url_file_stream_or_string)\n rescue\n end\n # treat url_file_stream_or_string as string \n return StringIO.new(url_file_stream_or_string.to_s)\n end", "def open?\n @open\n end", "def open_safely!\n yield current_file.open\n ensure\n current_file.close\n end", "def open(*args, &block)\n end", "def stream\n @stream ||=\n ::File.open(file, \"w+\")\n end", "def file_stream\n @file_stream ||= File.open(@file_path, \"rb\")\n end", "def open\n if !@path.nil?\n @stream = File.open(file, @mode)\n end\n\n results = nil\n\n begin\n results = yield @stream if block_given?\n ensure\n if !@path.nil?\n @stream.close\n @stream = nil\n end\n end\n\n results\n end", "def open?\n @open\n end", "def open?(filename); end", "def is_file_open?\n (@file_handle != nil)\n end", "def is_file_open?\n (@file_handle != nil)\n end", "def open?\n shell ? shell.open? : false\n end", "def open_for_write\n end", "def open?\n !closed?\n end", "def open?\n !(closed?)\n end", "def open(io)\n return open_file(io) if file\n \n case io\n when String\n StringIO.new(io)\n when Integer\n IO.open(io)\n else \n io\n end\n end", "def onopen(&blk); super; end", "def open\n raise NotImplementedError.new(\"Method 'open' not implemented by '#{self.class.name}'\")\n end", "def open_for_write\n self.eof_flag = false\n open_data_for_write\n end", "def open\n\t \texec 'open '+@params[0]\n\t end", "def open\n writer.open\n end", "def opened?\n !closed?\n end", "def stream\n @stream ||=\n connect!\n end", "def open(url, prx = false)\n res = raw_open(url, prx)\n end", "def open(filename, mode = 'r', &block)\n raise NotImplementedError\n end", "def get_stream(options)\n options[:file].nil? ?\n $stdin :\n open(File.expand_path(options[:file]))\nend", "def open?\n @data_bytes[1] != 0\n end", "def close\n @stream.close unless @stream.nil? || @stream.closed?\n end", "def open_file(io)\n io.kind_of?(File) ? io : File.open(io)\n end", "def open path, mode=\"r\", &blk\n end", "def open_feed_file(test=false)\n open_file(self.link, test)\n end", "def reopen(logdev = nil)\n close\n @stream = file_stream\n end", "def streaming?\n !stream.nil?\n end", "def stream?\n !!@stream\n end", "def stream?\n !!@stream\n end", "def open(uri, options = T.unsafe(nil)); end", "def open?\n @opened\n end", "def open?\n return @opened\n end", "def open\n @spoolfile.close if @spoolfile\n @spoolfile = ::File.open(@path, 'r+')\n __setobj__(@spoolfile)\n end", "def stream; end", "def stream; end", "def stream; end", "def stream; end", "def open? uri\n result = nil\n @change_semaphore.synchronize do\n result = library.open?(uri_to_file(uri))\n end\n result\n end", "def open path, mode=\"r\", &blk\n end", "def open?\n @connection.open?\n end", "def open?\n !closed?\n end", "def open?\n !closed?\n end", "def open(_filename, _mode = 'r')\n raise NotImplementedError\n end", "def open(path, &block)\n @io = File.open(path, 'r+') # TODO: r+ will create the file if it doesn't exist =( Do a exists? check before this and simply return nil? Or raise error? I hate errorrrs\n sleep(0.1) until !@io.eof?\n\n @io.readbyte # Sync\n\n if block_given?\n yield(self)\n\n close\n end\n\n self\n end", "def closed?\n io.closed?\n end", "def is_open?\n @open\n end", "def open\n return nil if @open.nil?\n @open ? '1' : '0'\n end", "def open?\n type == 'open'\n end", "def closed?\n io.closed?\n end", "def open!(*args)\n @status = :opening\n self.buffer.open # @buffer.status to :opening\n\n self.set_timer\n self.set_alive_checker\n self.finish\n end", "def supports_streaming?; end", "def input_stream; end", "def open(path_or_url, ext = T.unsafe(nil), options = T.unsafe(nil)); end", "def assert_has_stream(stream); end", "def fat_stream \n @fat_stream ||= create_fat_stream\n end", "def reopen\n @mutex.synchronize {\n if defined? @io and @io\n flush\n @io.close rescue nil\n end\n @io = ::File.new(@fn, @mode)\n }\n super\n self\n end", "def file_open(*args, &block)\n if __transport_connection\n content = __transport_connection.file(args[0]).content\n string_io = StringIO.new content\n yield string_io if block_given?\n string_io\n else\n File.open(*args, &block)\n end\n end", "def open?(thing)\n false\n end", "def open_uri(uri)\n case uri.scheme\n when \"file\"\n path = URI.decode(uri.path)\n @@logger.debug \"Attempting to open #{path}\"\n raise MissingAssetError unless File.exist?(path)\n io = File.open(path)\n when \"http\", \"https\"\n io = Tempfile.new(\"common_mapping_file\")\n Net::HTTP.start(uri.host, uri.port) do |http|\n http.request_get(uri.path) do |resp|\n raise MissingAssetError, \"Received a #{resp.code} while trying to retrieve #{uri}\" if resp.code != \"200\"\n resp.read_body do |segment|\n io.write(segment)\n end\n end\n end\n io.rewind\n else\n raise NotImplementedError\n end\n io\n end", "def open_data_for_read\n @data_file = CSV.open(data_file_full_path,\"r\", @data_lib.csv_opt)\n @data_stream = @data_file\n end", "def open(uri, text, version); end", "def open!(file, *args, &block); end", "def is_open?\n\t\treturn !!@open\n\tend", "def streamable?\n streamable\n end", "def create_stream\n Stream.new(self)\n end", "def open(uri_s, options = T.unsafe(nil), &error_block); end", "def infinite_stream\n Net::HTTP.start(@uri.host, @uri.port, :use_ssl => @uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new @uri\n request['Authorization'] = @header['Authorization'] #applying authentication header obtained by user\n http.request request do |response|\n open @stream_temp_file, 'w' do |io|\n response.read_body do |chunk|\n io.write chunk\n end\n end\n end\n end\n end", "def open(opt = {}, &block)\n return open_with_block(opt, block) if block\n\n open_without_block(opt)\n end", "def close\n close_stream\n end", "def _open(filename)\n File.open(filename, 'rb')\n end", "def file\n __advance!\n @_st_stream\n end" ]
[ "0.7339549", "0.7217188", "0.7017325", "0.68971705", "0.6892756", "0.68614554", "0.6831465", "0.67196023", "0.67196023", "0.67196023", "0.6670562", "0.6632796", "0.6599022", "0.659435", "0.6583291", "0.65678537", "0.6554574", "0.65405786", "0.65405786", "0.649767", "0.649767", "0.64378434", "0.6426804", "0.6392231", "0.63863444", "0.63630044", "0.63282305", "0.6322974", "0.6322118", "0.6314626", "0.6262051", "0.62363696", "0.623525", "0.6234697", "0.6232061", "0.623145", "0.62127316", "0.6206115", "0.6197333", "0.61841303", "0.61741304", "0.6164731", "0.6162199", "0.61570436", "0.6148579", "0.61424446", "0.61383843", "0.6134814", "0.6113279", "0.6102294", "0.60989004", "0.60969734", "0.60914606", "0.60850513", "0.60627925", "0.60626876", "0.6059645", "0.6059645", "0.6049074", "0.60474306", "0.6046179", "0.6041448", "0.60196143", "0.60196143", "0.60196143", "0.60196143", "0.600735", "0.59884274", "0.5984329", "0.598012", "0.598012", "0.5979964", "0.59741855", "0.59597695", "0.5959641", "0.5946924", "0.59269875", "0.59148556", "0.5904721", "0.59046865", "0.58974403", "0.5895541", "0.5895141", "0.5880897", "0.58799386", "0.58769727", "0.58742297", "0.5870738", "0.5867166", "0.5866549", "0.58629715", "0.58595175", "0.58527", "0.5851532", "0.5847447", "0.58380425", "0.583186", "0.5830405", "0.5826363", "0.5809336" ]
0.7028352
2
locator is DummyLoacator or SAXParser
def pushLocator(locator) @locators.push(locator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n super\n @parser = Nokogiri::XML::SAX::Parser.new(self)\n end", "def pluggable_parser; end", "def xpath; end", "def xpath; end", "def guarded_locator\n return unguarded_locator if unguarded_locator\n self.locator = case \n when template_id \n then %Q{//#{XMLManipulation::CDA_NAMESPACE}:section[./#{XMLManipulation::CDA_NAMESPACE}:templateId[@root = '#{template_id}']]}\n when locate_by == :attribute\n then \"@#{section_key.to_s.camelcase(:lower)}\"\n when section_key =~ /[^\\w]/\n # non word characters--asume an xpath locator is the section_key\n then section_key\n when section_key.to_s =~ /^\\w+/\n # all word characters--assume an element reference\n then \"#{XMLManipulation::CDA_NAMESPACE}:#{section_key.to_s.camelcase(:lower)}\"\n end \n end", "def parser_type(x)\n 'libxml'\n end", "def at_xpath(*args); end", "def at_xpath(*args); end", "def parser(parser, didStartElement:element, namespaceURI:uri, qualifiedName:name, attributes:attrs)\n if element == 'item'\n @current_item = RSSItem.new\n elsif element == 'enclosure'\n @current_item.enclosure = attrs\n end\n @current_element = element\n end", "def parse(xml)\n raise NotImplementedError, \"inheritor should define #{__method__}\"\n end", "def html_parser=(_arg0); end", "def html_parser=(_arg0); end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def parse(&block)\n @block = block\n puts \"Parsing #{xml_url}\"\n @parser.parse\n end", "def test_it_can_get_instance_of_parser\n parser = Rubasteme.parser\n refute_nil parser\n end", "def get_node(locator)\n return nil if @dirties > 0\n case locator\n when /^id=/, /^name=/\n locator = locator.gsub(\"'\",\"\\\\\\\\'\").gsub(/([a-z]+)=([^ ]*) */, \"[@\\\\1='\\\\2']\")\n locator = locator.sub(/\\]([^ ]+) */, \"][@value='\\\\1']\")\n return @studied_page.at_xpath(\"//*#{locator}\")\n when /^link=/\n # Parse the link through loc (which may simplify it to an id or something).\n # Then try get_studied_node again. It should not return to this spot.\n return get_node(loc(locator[5,locator.length], 'link'))\n when /^css=/\n return @studied_page.at_css(locator[4,locator.length])\n when /^xpath=/, /^\\/\\//\n return @studied_page.at_xpath(locator.sub(/^xpath=/,''))\n when /^dom=/, /^document\\./\n # Can't parse dom=\n return nil\n else\n locator = locator.sub(/^id(entifier)?=/,'')\n retval = @studied_page.at_xpath(\"//*[@id='#{locator}']\")\n retval = @studied_page.at_xpath(\"//*[@name='#{locator}']\") unless retval\n return retval\n end\n end", "def html_parser; end", "def has_parser?(name); end", "def parser=(_arg0); end", "def parser\n attributes.fetch(:parser)\n end", "def after_parse; end", "def after_parse; end", "def test_parse_valid_xml_returns_hash\n name = \"A name\"\n type = \"A type\"\n xml = \"<data><name>#{name}</name><type>#{type}</type></data>\"\n parser = ChainReactor::Parsers::XmlSimpleParser.new get_logger\n cause = parser.parse(xml,[],false)\n assert_equal name, cause['name'].first\n assert_equal type, cause['type'].first\n end", "def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end", "def follow(n, pointer)\n # We already checked that nodes have at most one of these in the XmlParser.\n if n.key?('ref')\n reference = n['ref']\n if reference[':']\n namespace, reference = reference.split(':', 2)\n end\n\n node = lookup(reference, n.name)\n\n visit(node, pointer)\n\n elsif n.key?('type')\n reference = n['type']\n if default_value_r208(pointer, reference)\n return\n end\n\n node = lookup(reference, 'complexType', 'simpleType')\n\n if node.name == 'complexType'\n case reference\n when 'cpv_set'\n # Always expand, as mapping differs.\n when 'empty'\n # Do nothing with empty elements.\n when 'val', 'val_range', 'country', 'nuts', 'no_works', 'supplies', 'non_published'\n # Do nothing with simple elements.\n when 'text_ft_single_line', 'text_ft_multi_lines', 'btx'\n # Hardcode common types to make sample smaller.\n paragraph = BuildNode.new('P')\n paragraph.contents << SecureRandom.hex(8)\n pointer.children << paragraph\n return\n else\n # This edge case avoids extra XPaths in F08.\n if basename == 'F08_2014' && reference == 'contact_contracting_body'\n reference = 'contact_buyer'\n end\n # Reference repeated types to make sample smaller. (Sample will be invalid.)\n if @types.key?(reference)\n add_node('comment', pointer, content: \"see #{@types[reference]}\")\n return\n end\n @types[reference] = n.attributes.fetch('name')\n end\n end\n visit(node, pointer)\n\n elsif n.key?('base')\n if n.name == 'extension'\n reference = n['base']\n if default_value_r208(pointer, reference)\n return\n end\n\n node = lookup(reference, 'complexType', 'simpleType')\n\n if node.name == 'complexType' && ['text_ft_multi_lines', 'btx'].include?(reference)\n # Hardcode common types to make sample smaller. Drops attributes. Only for CRITERIA_EVALUATION on F13.\n paragraph = BuildNode.new('P')\n paragraph.contents << SecureRandom.hex(8)\n pointer.children << paragraph\n return\n end\n visit(node, pointer)\n\n # Based on the analysis in `visit`, we can skip visiting `base` if within a `complexType`, but not if within a `simpleType`.\n elsif n.parent.name == 'simpleType'\n reference = n['base']\n if reference[':']\n namespace, reference = reference.split(':', 2)\n end\n\n if namespace != 'xs'\n node = lookup(reference, 'simpleType')\n\n visit(node, pointer)\n end\n end\n end\n\n n.element_children.each do |c|\n visit(c, pointer)\n end\n end", "def parser_type(x)\n 'rexml'\n end", "def new_parser_with_data\n\tdoc = load_sample_xml\n\tparser = GreenButton::Parser.new(doc)\nend", "def after_parse\n end", "def xpath(*args); end", "def xpath(*args); end", "def parse()\n #This is a stub, used for indexing\n end", "def initialize(f) # f can be pathname or string\n @doc = Nokogiri::XML::Document.parse(f, &:noblanks) # Nokogiri handles both\n @top = @doc.search(\"body\").first\n self.firstSummit()\n end", "def default_handler anElement\r\n if log\r\n puts \"#{self.class} - default handling:#{anElement.name}\"\r\n end\r\n end", "def parse_response(xml)\n raise NotImplementedError\n end", "def parserDidStartDocument(parser)\n puts \"starting parsing..\"\n end", "def locator_namespace\n @locator_namespace ||= Locators\n end", "def parse_sibling(scanner)\n parse(scanner)\n end", "def parse_xml\n\n raise \"parse_xml method has not been implemented in this class\"\n \n end", "def initialize(input)\n # Set the input document attribute\n @input_document = REXML::Document.new(input)\n\n # Retrieve all of the handler info values and store them in a hash variable named @info_values.\n @info_values = {}\n REXML::XPath.each(@input_document, \"/handler/infos/info\") do |item|\n @info_values[item.attributes[\"name\"]] = item.text.to_s.strip\n end\n\t\n # Determine if debug logging is enabled. Value is set in the info.xml.\n @debug_logging_enabled = @info_values['enable_debug_logging'] == 'Yes'\n puts(\"Logging enabled.\") if @debug_logging_enabled\n\n # Store parameters from the node.xml in a hash attribute named @parameters.\n @parameters = {}\n REXML::XPath.match(@input_document, '/handler/parameters/parameter').each do |node|\n @parameters[node.attribute('name').value] = node.text\n end\n puts(format_hash(\"Handler Parameters:\", @parameters)) if @debug_logging_enabled\n\n # Initialize an Array to track any errors that come up during validation.\n errors = []\n\n # If there are any errors in the errors Array, raise an exception that contains\n # all of the error messages.\n if errors.any?\n raise %|The following errors were found while validating the parameters:\\n#{errors.join(\"\\n\")}|\n end\n\t\n end", "def parser(name = T.unsafe(nil)); end", "def parse\n raise \"absctract method called\"\n end", "def locator(name)\n locator_by_type(:base, name)\n end", "def parser_class\n case @url\n when 'post.html' then HackerNews::Parser ## example case\n when @url then HackerNews::Parser\n # when @url =~ /.*reddit.*/ then HackerNews::Reddit\n else\n raise MissingParserError\n end\n end", "def parsed\n raise NotImplementedError\n end", "def before data\n classes = document.class.name.split('::')\n classes[-1] = 'SAX::Parser'\n\n parser = eval(classes.join('::')).new(BeforeHandler.new(self, data))\n parser.parse(data)\n end", "def xpath_for(string, prefix, visitor); end", "def initialize(*args)\n super\n decorators(Nokogiri::XML::Node) << Nokogiri::Decorators::XBEL\n decorate!\n\n# self.root = '<xbel version=\"1.0\"></xbel>'\n end", "def handle_unknown_tag(tag, attrs)\r\n super\r\n handle_start_tag(tag, attrs)\r\n end", "def initialize(xml)\n @source = isxml?(xml) ? xml : File.read(xml)\n @doc_stream = AltoDocStream.new\n parser = Nokogiri::XML::SAX::Parser.new(doc_stream)\n parser.parse(@source)\n end", "def Slop(*args, &block)\n Nokogiri(*args, &block).slop!\n end", "def initialize block_parser\n @block_parser = block_parser\nend", "def configure_parser; end", "def test_parse_valid_xml_returns_hash_with_symbol_keys\n name = \"A name\"\n type = \"A type\"\n xml = \"<data><name>#{name}</name><type>#{type}</type></data>\"\n parser = ChainReactor::Parsers::XmlSimpleParser.new get_logger\n cause = parser.parse(xml,[],true)\n assert_equal name, cause[:name].first\n assert_equal type, cause[:type].first\n end", "def parsing(parser)\n yield\n resolve parser\n self\n end", "def parse(thing, &block); end", "def parse(thing, &block); end", "def valid_locator_type? type\n %w(id class css name xpath).include? type\nend", "def valid_locator_type? type\n %w(id class css name xpath).include? type\nend", "def parser_listener\n # create on demand. not always used\n @parser_listener = NvdFsParserListener.new(self,@enable_xml_save) if @parser_listener.nil?\n @parser_listener\n end", "def initialize parser\n @parser = parser\n end", "def parse(content,browser=nil)\n\t\t\t@ret=Nokogiri::XML(content)\n\t\t\t@sniffed_type=sniff(@ret)\n\t\t\tcase @sniffed_type\n\t\t\twhen :acquisition then return OPDS::AcquisitionFeed.from_nokogiri(@ret,browser)\n\t\t\twhen :navigation then return OPDS::NavigationFeed.from_nokogiri(@ret,browser)\n\t\t\twhen :entry then return OPDS::Entry.from_nokogiri(@ret,nil,browser)\n\t\t\tend\n\t\tend", "def parser_wrapper\n yield\n rescue ::Occi::Core::Errors::ParsingError => ex\n logger.error \"Request parsing failed: #{ex.class} #{ex.message}\"\n raise Errors::ParsingError, ex.message\n end", "def sniff(doc)\n\t\t\treturn :entry if doc.root.name=='entry'\n\t\t\tentries = doc.xpath('/xmlns:feed/xmlns:entry',doc.root.namespaces)\n\t\t\tif entries.size > 0\n\t\t\t\treturn :acquisition if entries.all? do |entry|\n\t\t\t\t\tentry.xpath('xmlns:link').any? do |link| \n\t\t\t\t\t\tl=link.attributes['rel']\n\t\t\t\t\t\tunless l.nil?\n\t\t\t\t\t\t\tl.value.include?('http://opds-spec.org/acquisition') \n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\treturn :navigation\n\t\t\tend\n\t\t\treturn nil\n\t\trescue \n\t\t\tnil\n\t\tend", "def lookup\n @root_el = parent_el || browser\n lookup_sequence.each { |locator| @root_el = lookup_step(locator) }\n rescue\n @root_el = nil\n raise\n end", "def parse\n @started = false\n begin\n parser = REXML::Parsers::SAX2Parser.new @stream \n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n if @current.nil?\n @current = REXML::Element::new(qname)\n else\n e = REXML::Element::new(qname)\n @current = @current.add_element(e)\n end\n @current.add_attributes attributes\n if @current.name == 'stream'\n @listener.receive(@current)\n @started = true\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"stream:stream\"\n @started = false\n else\n @listener.receive(@current) if @current.parent.name == 'stream'\n @current = @current.parent\n end\n end\n parser.listen( :characters ) do | text |\n @current.text = (@current.text.nil? ? '' : @current.text) + text\n end\n parser.listen( :cdata ) do | text |\n raise \"Not implemented !\"\n end\n parser.parse\n rescue REXML::ParseException\n @listener.parse_failure\n end\n end", "def linkparser_error ; @lp_error; end", "def xml_at_element_top( xml, name )\r\n xml.interface {\r\n xml.name name\r\n xml.unit { \r\n xml.name '0'\r\n return xml\r\n }\r\n } \r\n end", "def process(parser)\n end", "def smart_parse_compare(xml, expected, handler = AllSax, opts = {}, handler_attr = :calls)\n parse_compare(xml, expected, handler, opts.merge(smart: true, skip: :skip_white), handler_attr)\n end", "def initialize(xml, fileName, pa, responseDir)\r\n @responseDir = responseDir\r\n @xml = REXML::Document.new(xml) \r\n @fileName = fileName\r\n @nps = []\r\n @seed = 0\r\n\r\n \tif pa == nil\r\n\t \t@parseAdapter = ParseAdapter.new\r\n\t else\r\n\t \t@parseAdapter = pa\r\n \tend\r\n end", "def resolve(parser)\n end", "def parsed; end", "def parsed; end", "def locate\r\n if @how == :jssh_name\r\n @element_name = @what\r\n elsif @how == :xpath\r\n @element_name = element_by_xpath(@container, @what)\r\n else\r\n @element_name = locate_tagged_element('A', @how, @what)\r\n end\r\n @o = self\r\n end", "def match parser, index\r\n raise \"Must override match\"\r\n end", "def response_parser; end", "def parsed(&block)\n parse unless @parsed\n block.call\n end", "def set_parser\n @parser = Parser.find(params[:id])\n end", "def validation_hook_during_parsing(kd_el, xml_node)\n # override this method in validating subclass of self\n end", "def discover\n # Look for rss link, e.g.\n # <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\"\n # href=\"http://feeds.feedburner.com/TheRssBlog\">\n # Tricky: Hpricot CSS attribute selectors are written like XPath selectors\n [:atom, :rss].each do |flavor|\n if x=@doc.at(\"head link[@type=application/#{flavor}+xml]\")\n return x[:href]\n end\n end\n if x=@doc.at(\"head link[@type=text/xml]\")\n return x[:href]\n end\n return nil\n end", "def set_parser\n @parser = Parser.find(params[:id])\n end", "def set_parser\n @parser = Parser.find(params[:id])\n end", "def get_xml_info(xml, xp)\n return '' unless block_given?\n doc = Nokogiri.XML xml\n doc.xpath(xp).map {\n |node| yield node\n }\n end", "def parse\n parser = REXML::Parsers::SAX2Parser.new @stream \n parser.listen( :start_element ) do |uri, localname, qname, attributes|\n case qname\n when \"CougaarEvents\"\n @node = attributes['Node']\n @experiment = attributes['experiment']\n #puts \" Node: #{@node} Experiment: #{@experiment}\"\n @started = true\n when \"CougaarEvent\" \n @current = CougaarEvent.new\n @current.node = @node\n @current.data = \"\"\n @current.experiment = @experiment\n @current.event_type = attributes['type']\n @current.cluster_identifier = attributes['clusterIdentifier']\n @current.component = attributes['component']\n else\n @current.data << \"<#{qname}\"\n attributes.each do |key, value| \n @current.data << \" #{key} = \\\"#{value}\\\"\"\n end\n @current.data << \" >\"\n end\n end\n parser.listen( :end_element ) do |uri, localname, qname|\n case qname\n when \"CougaarEvents\"\n @node = nil\n @started = false\n when \"CougaarEvent\"\n @current.data = [@current.data].pack(\"m\")\n @listener.call(@current)\n @current = nil\n else\n @current.data << \"</#{qname}>\"\n end\n end\n parser.listen( :characters ) do | text |\n @current.data << text if @current\n end\n parser.listen( :cdata ) do | text |\n @current.data << text if @current\n end\n parser.parse\n end", "def method_missing(meth, *args, &blk) \n if meth.to_s =~ /^(.*)!$/\n self << XML.new($1.to_sym, *args, &blk)\n else\n real_method_missing(meth, *args, &blk)\n end\n end", "def best_available!\n @@parser = best_available\n end", "def parser(parser, didEndElement:element, namespaceURI:uri, qualifiedName:name)\n if element == 'item'\n @items << @current_item\n end\n end", "def initialize(input)\n # Set the input document attribute\n @input_document = REXML::Document.new(input)\n\n # Determine if debug logging is enabled.\n @debug_logging_enabled = get_info_value(@input_document, 'enable_debug_logging') == 'Yes'\n puts(\"Logging enabled.\") if @debug_logging_enabled\n\n # Store parameters in the node.xml in a hash attribute named @parameters.\n @parameters = {}\n REXML::XPath.match(@input_document, '/handler/parameters/parameter').each do |node|\n @parameters[node.attribute('name').value] = node.text\n end\n puts(\"Handler Parameters: #{@parameters.inspect}\") if @debug_logging_enabled\n\n # Store infos in the node.xml in a hash attribute named @info_values.\n @info_values = {}\n REXML::XPath.match(@input_document, '/handler/infos/info').each do |node|\n @info_values[node.attribute('name').value] = node.text\n end\n puts(\"Connecting to #{@info_values['server_url']} as #{@info_values['username']}.\") if @debug_logging_enabled\n end", "def locate_by\n options_by_type(:locate_by) || :element\n end", "def method_missing(name,*args,&block)\n self.class.send :define_method,\"parse_#{name}\" do |node,contents|\n block.call node,contents\n end\n end", "def set_locator\n @locator = Locator.find(params[:id])\n end", "def setup\n @html_parser = Hatemile::Util::Html::NokogiriLib::NokogiriHTMLDOMParser.new(\n \"<!DOCTYPE html>\n <html>\n <head>\n <title>HaTeMiLe Tests</title>\n <meta charset=\\\"UTF-8\\\" />\n </head>\n <body>\n <section>\n <header></header>\n <article>\n \\n\n </article>\n <footer><!-- Footer --></footer>\n </section>\n <span attribute=\\\"value\\\" data-attribute=\\\"custom_value\\\">\n <!-- Comment -->\n Text node\n <strong>Strong text</strong>\n <hr />\n </span>\n <div></div>\n <p>\n <del>Deleted text</del>\n </p>\n <table>\n <thead><tr>\n <th>Table header</th>\n </tr></thead>\n <tbody>\n <tr>\n <td>Table <ins>cell</ins></td>\n </tr>\n </tbody>\n <tfoot><!-- Table footer --></tfoot>\n </table>\n <ul>\n <li id=\\\"li-1\\\">1</li>\n <li id=\\\"li-3\\\">3</li>\n </ul>\n <ol>\n <li>1</li>\n <li>2</li>\n <li>3</li>\n <li>4</li>\n <li>5</li>\n </ol>\n #{ASIDE_CONTENT}\n <form>\n <label>\n Text:\n <input type=\\\"text\\\" name=\\\"number\\\" />\n </label>\n </form>\n <h1></h1>\n <h2></h2>\n </body>\n </html>\"\n )\n end", "def locate_element(how, what)\n return super unless @nokogiri\n\n el = @query_scope.browser.doc.send(\"at_#{how}\", what)\n Watigiri::Element.new element: el, selector: {how => what}\n end", "def force_parse; end", "def parse_link; end", "def parse(io)\n self.doc = Nokogiri::XML(io)\n end", "def define_on_parser(name, used_parser, *args)\n @parsers[name] = Proc.new { @parsers[used_parser].call(*args) }\n end" ]
[ "0.54403627", "0.54353094", "0.5331464", "0.5331464", "0.5323597", "0.53094536", "0.52768916", "0.52768916", "0.52514124", "0.52442515", "0.5233952", "0.5233952", "0.52205575", "0.52205575", "0.52205575", "0.52205575", "0.5216149", "0.51741236", "0.5150851", "0.51454365", "0.51443315", "0.5001193", "0.49841326", "0.4957205", "0.4957205", "0.4956736", "0.49550056", "0.49400315", "0.48995385", "0.48930326", "0.4892115", "0.48529953", "0.48529953", "0.484499", "0.48349422", "0.48296165", "0.48254105", "0.48233163", "0.48189956", "0.47890463", "0.47835028", "0.47797263", "0.47796184", "0.47780433", "0.47656462", "0.4760755", "0.47506344", "0.47388816", "0.47350928", "0.47311985", "0.47301447", "0.47142825", "0.46964073", "0.46875733", "0.46863717", "0.46854806", "0.46849692", "0.46684", "0.46684", "0.46658075", "0.46658075", "0.4661181", "0.4660623", "0.46470657", "0.46424484", "0.46415102", "0.4637203", "0.4625096", "0.46241412", "0.46141368", "0.4612233", "0.45953202", "0.45869094", "0.45777497", "0.45742425", "0.45742425", "0.4569464", "0.45691067", "0.45621124", "0.45572755", "0.4540514", "0.4539635", "0.45349365", "0.45348012", "0.45348012", "0.45346907", "0.45339167", "0.4528878", "0.45262423", "0.45252395", "0.45204696", "0.4515352", "0.45143032", "0.4509966", "0.45093888", "0.45034227", "0.449214", "0.4490351", "0.44879094", "0.44773185" ]
0.47519806
46
creates an output string with the attributes
def to_string "Person: #{@name} with ID: #{@id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n %(<#{ @name }#{attributes}>)\n end", "def buildAttrString(attributes)\r\n str = \"\"\r\n\r\n attributes.each do |key, val|\r\n str += \" #{key}='#{val}'\"\r\n end # attributes.each\r\n\r\n puts \"attrib str: #{str}\" if $DEBUG\r\n str\r\n end", "def to_s\n\t\tstr = \"\\n<\" + @type\n\t\t@attributes.each{ |key,value|\n\t\t\tstr += \" \" + key.to_s + \" = \" + value.to_s\n\t\t}\n\t\tif @type == 'text'\n\t\t\tstr += \"> \" + @content[0] + \" </\" + @type + \">\"\n\t\telse\n\t\t\tstr += \"> \"\n\t\t\t@content.each { |c|\n\t\t\t\tstr += c.to_s\n\t\t\t}\n\t\t\tstr += \"\\n</\" + @type + \">\"\n\t\tend\n\t\tstr\n\tend", "def to_s\n text = ''\n\n text << \"#{tag_output_string}\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\\n#{background_output_string}\" if background\n text << \"\\n\\n#{tests_output_string}\" unless tests.empty?\n\n text\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless (description.nil? || description.empty?)\n text << \"\\n\" unless (steps.empty? || description.nil? || description.empty?)\n text << \"\\n\" + steps_output_string unless steps.empty?\n text << \"\\n\\n\" + examples_output_string unless examples.empty?\n\n text\n end", "def inspect\n attributes = [\"seqid=\\\"#{@seqid}\\\"\", \"source=\\\"#{@source}\\\"\", \"type=\\\"#{@type}\\\"\", \"strand=\\\"#{@strand}\\\"\"]\n attributes += @attributes.map { |(attribute, value)| \"#{attribute}=\\\"#{value}\\\"\" }\n \n \"#<#{self.class} #{attributes.join(', ')}>\"\n end", "def to_s\n attributes = @attributes.map do |key, value|\n \"#{key}: \\\"#{value}\\\"\"\n end.join \" \"\n\n \"#<#{self.class} #{attributes}>\"\n end", "def to_s\n text = ''\n\n text << \"#{tag_output_string}\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless rows.empty? || no_description_to_output?\n text << \"\\n#{parameters_output_string}\" if parameter_row\n text << \"\\n#{rows_output_string}\" unless argument_rows.empty?\n\n text\n end", "def basic_output()\n temp_string = String.new()\n\n if (@utype != \"\")\n temp_string = temp_string + \"#{@utype} = \"\n end\n temp_string = temp_string + @commandName\n temp_string = temp_string + \"\\n\"\n @keywordPairs.each {|array| temp_string = temp_string + \"\\t#{array[0]} = #{array[1]}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Parents\\n\"\n @parents.each do |array|\n temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\"\n end\n temp_string = temp_string + \"..\\n\"\n\n temp_string = temp_string + \"$Children\\n\"\n @children.each {|array| temp_string = temp_string + \"$\\t#{array.utype} = #{array.commandName}\\n\" }\n temp_string = temp_string + \"..\\n\"\n\n end", "def return_att\n return \"Name:\\t#{@name}\\nSize:\\t#{@size}\\nColour:\\t#{@colour}\\n\"\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Feature:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\\n\" + background_output_string if background\n text << \"\\n\\n\" + tests_output_string unless tests.empty?\n\n text\n end", "def to_s\n \t\tattributes.each_with_object(\"\") do |attribute, result|\n \t\tresult << \"#{attribute[1].to_s} \"\n \t\tend\n\tend", "def stringOutput\n\t\tend", "def stringOutput\n\t\tend", "def to_s\n text = ''\n\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless steps.empty? || no_description_to_output?\n text << \"\\n#{steps_output_string}\" unless steps.empty?\n\n text\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Examples:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\" unless description_text.empty?\n text << \"\\n\" + parameters_output_string\n text << \"\\n\" + rows_output_string unless rows.empty?\n\n text\n end", "def attribute_string\n s = []\n s << \"PROGRAM-ID=#{ (program_id || 1).to_i }\"\n s << \"BANDWIDTH=#{ bandwidth.to_i }\"\n s << \"CODECS=\\\"#{ codecs }\\\"\" if codecs\n s << \"RESOLUTION=#{ resolution }\" if resolution\n s.join(',')\n end", "def to_s\n each_with_object([]) do |(name, value), array|\n if value.is_a?(Component::Attr)\n # Flatten nested hashs and inject them unless empty\n value = value.to_s\n array << value unless value.empty?\n else\n name = [@prefix, name].compact.join(\"-\").gsub(/[\\W_]+/, \"-\")\n array << %(#{name}=\"#{value}\") unless value.nil?\n end\n end.sort.join(\" \")\n end", "def display_attributes\n puts\n puts @str.tr(NULL, \"!\")\n bit = 1\n 16.times do |bno|\n line = \"\"\n @str.length.times do |i|\n if (@attrs[i] & bit) == 0\n line << \" \"\n else\n if bno.zero?\n line << \"S\"\n else\n line << (\"%d\" % (bno+1))\n end\n end\n end\n puts(line) unless line =~ /^ *$/\n bit <<= 1\n end\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def inspect\n attributes_for_inspect = self.attributes.collect do |attr|\n \"#{attr}: \" + self.instance_variable_get(\"@#{attr}\").to_s\n end.join(\", \")\n return \"#<#{self.class} #{attributes_for_inspect}>\"\n end", "def tag(tagname, attributes={})\n# Output the tag name\n@out << \"<#{tagname}\"\n# Get the allowed attributes for this tag.\nallowed = self.class.allowed_attributes[tagname]\n# First, make sure that each of the attributes is allowed.\n# Assuming they are allowed, output all of the specified ones.\nattributes.each_pair do |key,value|\nraise \"unknown attribute: #{key}\" unless allowed.include?(key)\n@out << \" #{key}='#{value}'\"\nend\nend", "def to_xml\n\t\t\t\"<#{@name} #{attributes_string} />\"\n\t\tend", "def to_s\n attrs = self.class.attributes.map do |attr|\n \"#{attr.name}=#{self.send(attr.name)}\"\n end.join(', ')\n\n \"[#{self.class.name.split('::').last}] #{attrs}\"\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Scenario Outline:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\" unless steps.empty? || description_text.empty?\n text << \"\\n\" + steps_output_string unless steps.empty?\n text << \"\\n\\n\" + examples_output_string unless examples.empty?\n\n text\n end", "def to_s\n # Start with the name\n string = sprintf \"%-9s\", \"#{self.name}:\"\n # Print the attr mods\n self.raceattrs.each do |a|\n string += sprintf \" %s %+i,\", a.short, a.value if a.value != 0\n end\n return string.chomp(\",\")\n end", "def template_like_str(attributes, indent = true)\n if indent\n ind_enter = \"\\n\"\n ind_tab = ' '\n else\n ind_enter = ''\n ind_tab = ' '\n end\n\n str = attributes.collect do |key, value|\n next unless value\n\n str_line = ''\n\n if value.class == Array\n\n value.each do |value2|\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n if value2 && value2.class == Hash\n str_line << value2.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n end\n str_line << \"\\n]\\n\"\n end\n\n elsif value.class == Hash\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n str_line << value.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n\n str_line << \"\\n]\\n\"\n\n else\n str_line << key.to_s.upcase << '=' << \"\\\"#{value}\\\"\"\n end\n str_line\n end.compact.join(\"\\n\")\n\n str\n end", "def template_like_str(attributes, indent = true)\n if indent\n ind_enter = \"\\n\"\n ind_tab = ' '\n else\n ind_enter = ''\n ind_tab = ' '\n end\n\n attributes.collect do |key, value|\n next unless value\n\n str_line = ''\n\n if value.class == Array\n\n value.each do |value2|\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n if value2 && value2.class == Hash\n str_line << value2.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n end\n str_line << \"\\n]\\n\"\n end\n\n elsif value.class == Hash\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n str_line << value.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n\n str_line << \"\\n]\\n\"\n\n else\n str_line << key.to_s.upcase << '=' << \"\\\"#{value}\\\"\"\n end\n str_line\n end.compact.join(\"\\n\")\n end", "def print_attribute(*) end", "def print_primary_attributes\n \"Strenght(STR):#{str}, Dexterity(DEX):#{dex}, Inteligence(INT):#{int}, Constitution(CON):#{con}, Appearence(APP):#{app}, Power(POW):#{pow}, Size:#{siz}, Education:#{edu}\"\n end", "def to_s\n \"#{@filename}: #{@name}#{@args}\\n\"\n end", "def inspect\n vals = ATTRS.map { |field| \"#{field}: #{public_send(field).inspect}\" }\n \"#<#{self.class.name} #{vals.join(', ')}>\"\n end", "def inspect\n klass = self.class\n attrs = klass\n .attribute_names\n .reject { |key| key == :data }\n .map { |key| \" #{key}=#{@attributes[key].inspect}\" }\n .join\n \"#<#{klass.name || klass.inspect}#{attrs}>\"\n end", "def to_s\n pieces = []\n pieces << self.class.name\n pieces << \"id:##{id.inspect}\"\n pieces << \"standardized:\" + (is_standard? ? 'standard' : (standard_id.nil? ? 'no' : \"copy-of-#{standard_id}\"))\n pieces << \"mission:#{mission_id.inspect}\"\n pieces.join(', ')\n end", "def to_s(attributes = nil)\r\n assert_exists\r\n hash_properties = {\"text\"=>\"innerHTML\"}\r\n hash_properties.update(attributes) if attributes != nil\r\n r = super(hash_properties)\r\n #r = string_creator\r\n #r += span_div_string_creator\r\n return r.join(\"\\n\")\r\n end", "def output\n temp_string = basic_output()\n if @polygon != nil\n temp_string = temp_string + \"$Polygon\\n\"\n temp_string = temp_string + \"$\\t#{@polygon.utype} = #{@polygon.commandName}\\n\"\n end\n if @zone != nil\n temp_string = temp_string + \"$Zone\\n\"\n temp_string = temp_string + \"$\\t#{@zone.utype} = #{@zone.commandName}\\n\"\n end\n return temp_string\n end", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end", "def to_s\n str = \n%{Petri Net [#{@name}]\n----------------------------\nDescription: #{@description}\nFilename: #{@filename}\n\nPlaces\n----------------------------\n#{str = ''; @places.each_value {|p| str += @objects[p].to_s + \"\\n\"}; str }\nTransitions\n----------------------------\n#{str = ''; @transitions.each_value {|t| str += @objects[t].to_s + \"\\n\" }; str }\nArcs\n----------------------------\n#{str = ''; @arcs.each_value {|a| str += @objects[a].to_s + \"\\n\" }; str}\n}\n return str\n end", "def to_s\n ret = \"--- #{@attrs[:event_name]} ---\\n\"\n attrs = @attrs.collect { |k,v| [k.to_s, v] }\n attrs.reject! { |k,_| k == 'event_name' }\n attrs.sort.each do |k,v|\n # Adjust the length of the attribute name\n line = \"#{k[0,MAX_ATTR_NAME-2]}:#{' '*MAX_ATTR_NAME}\"[0,MAX_ATTR_NAME] \n \n # Beautify the attribute\n v = v.join(', ') if v.class <= Array\n v = v.to_s\n unless @full_event_display\n v = v[0,MAX_ATTR_VALUE] if v.length > MAX_ATTR_VALUE\n end\n i = 0\n while i < v.length do\n v[i,1] = \"\\\\x#{'%02x' % v[i]}\" unless _printable?(v[i])\n i += 1\n end\n unless @full_event_display\n v = v[0,MAX_ATTR_VALUE] if v.length > MAX_ATTR_VALUE\n end\n ret << \" #{line}#{v}\\n\"\n end\n ret << \"\\n\"\n end", "def to_s\n out = ''\n self.metadata.each{|k,v| out << \"#{k}: #{v}\\n\"}\n out << \"--------------------\\n\"\n self.steps.each{|s| out << s.to_s }\n out\n end", "def inspect\n inspected_attributes = attribute_names.sort\n attributes_list = \"(#{inspected_attributes.join(\", \")})\" unless inspected_attributes.empty?\n \"#{name}#{attributes_list}\"\n end", "def to_s\n\t\tout = \"\";\n\t\t# title\n\t\tout += \"# #{@title[:name].gsub!(/_/,'\\_')}: #{@title[:title]}\\n\\n\"\n\t\t# environment\n\t\tout += \"## Environment:\\n\" if @environment.size > 0\n\t\t@environment.each { |pk,pv|\n\t\t\tout += \"### #{pk}\\n```\\n#{pv}\\n```\\n\"\t\n\t\t}\n\t\t# prerequisites\n\t\tout += \"## Prerequisites:\\n\" if @prerequisites.size > 0\n\t\t@prerequisites.each { |pk,pv|\n\t\t\tout += \"### #{pk}\\n```\\n#{pv}\\n```\\n\"\t\n\t\t}\n\t\t# execution\n\t\tout += \"## Execution:\\n\" if @execution.size > 0\n\t\t# p execution.size, execution\n\t\t@execution.each { |pk,pv|\n\t\t\tout += \"### #{pk}\\n```\\n#{pv}\\n```\\n\"\t\n\t\t}\n\t\t# appLog\n\t\tout += \"### Application logs:\\n\" if @appLog.size > 0\n\t\t@appLog.each { |pk,pv|\n\t\t\tout += \"#### #{pk}\\n```\\n#{pv}\\n```\\n\"\t\n\t\t}\n\t\treturn out\n\tend", "def inspect\n attribute_string = self.class.attributes.map do |key|\n \"#{key}: #{read_attribute(key).inspect}\"\n end.join(', ')\n \"#<#{self.class} #{attribute_string}>\"\n end", "def to_str\n \"#{@name} - #{@type}: @(#{@xPos},#{@yPos}), HP: #{@hp}, CP: #{@cp}, #{@life_cyc}\"\n end", "def inspect\n attributes_as_nice_string = ([\"id\"] + self.class.attributes).collect { |name|\n \"#{name}: #{send(name).inspect}\"\n }.compact.join(\", \")\n \"#<#{self.class} #{attributes_as_nice_string}>\"\n end", "def to_s\n attributes = ALLOWED_ATTRIBUTES.select { |a| @attributes[a] }.map do |a|\n case a\n when :httponly\n 'HttpOnly' if @attributes[a]\n when :secure\n 'Secure' if @attributes[a]\n when :maxage\n 'Max-Age=' + @attributes[a].to_s\n when :expires\n 'Expires=' + rfc2822(@attributes[a])\n when :comment\n 'Comment=' + escape(@attributes[a].to_s)\n else\n a.to_s.sub(/^\\w/) { $&.capitalize } + '=' + @attributes[a].to_s\n end\n end\n\n ([escape(name) + '=' + escape(value)] + attributes).join('; ')\n end", "def to_s()\n return sprintf(\"{id='%s'; main='%s'; description='%s'; icon='%s'}\", @id, @main, @description, @icon)\n end", "def print_secondary_attributes\n \"Sanity:#{san}, Health:#{health}, Luck:, Know: Magic:, \"\n end", "def to_s\n css = \"#{@name} {\\n\"\n @properties.each_pair { |k, v| css += \" #{k}: #{v};\\n\" }\n css += \"}\\n\\n\"\n @children.each { |c| css += c.to_s }\n css\n end", "def inspect\n %{<#{self.class.name} #{self.class.props.reduce([]) do |s, d| \n s << [d.first, send(d.first).inspect].join(\"=\")\n end.join(\" \")}>}\n end", "def to_s()\r\n\t\tres = \"Printing Statistic -#{self.object_id}-\\n\\t\"\r\n\t\tres += \" - Time : #{@time}\\n\\t\"\r\n\t\tres += \" - Penalty : #{@penalty}\\n\\t\"\r\n\t\tres += \" - isFinished : #{@isFinished}\\n\\t\"\r\n\t\tres += \" - Used help : #{@usedHelp}\\n\\t\"\r\n\t\tres += \" - Nb Stars : #{@numberOfStars}\\n\\t\"\r\n\t\tres += \" - NbClick : #{@nbClick}\\n\\t\"\r\n\t\treturn res\r\n\tend", "def to_s\n\t\treturn self.stringify_nodes( @output )\n\tend", "def to_s\n Semantic.check_class(self) do\n str = \"function #{name}(#{@parameters.join(', ')}) {\\n\"\n Indentation.indent do\n str << \"#{@attributes.map(&:to_s).join(\"\\n\")}\\n\" unless\n @attributes.empty?\n str << \"#{Indentation.get}var self = this;\\n\\n\"\n str << \"#{function2method(@constructor)}\"\n unless @private_methods.empty?\n str << \"\\n#{@private_methods.map(&:to_s).join(\"\\n\")}\"\n end\n unless @public_methods.empty?\n str << \"\\n\"\n str << @public_methods.map { |m| function2method(m) }.join(\"\\n\")\n end\n str << \"\\n#{Indentation.get}this.init(#{@parameters.join(', ')});\\n\"\n end\n \"#{str}#{Indentation.get}}\\n\"\n end\n end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n str = ''\n str << \"Command: #{@feature} #{@name}\\n\"\n @hash.each { |key, value| str << \" #{key}: #{value}\\n\" }\n str\n end", "def required_attributes_to_s\n str = \"#{self.count}D#{self.dietype}\"\n str << \"+\" if self.static > 0\n str << \"#{self.static}\" if options.static != 0\n str\n end", "def to_s(log = false)\n str = ''\n TestRun.attrs.each do |attr| #need to fix this. this looks at the Test class specifically and not whatever child class called it\n str << \"#{attr}: #{send(attr)}\\n\" unless attr == :log && !log\n end\n str\n end", "def attribute_string(attributes)\n attributes.map { |name, value| \"#{name}=\\\"#{value}\\\"\" }\n end", "def to_s\n \"<#{@name}\" + @attrs.sort.map{|k,v| \" #{k}='#{v.xml_attr_escape}'\"}.join +\n if @contents.size == 0\n \"/>\"\n else\n \">\" + @contents.map{|x| if x.is_a? String then x.xml_escape else x.to_s end}.join + \"</#{name}>\"\n end\n end", "def inspect\n output = \"#<#{self.class}:#{(object_id << 1).to_s(16)}\"\n\n %i[username token idle_timeout duration].each do |attribute|\n value = instance_variable_get \"@#{attribute}\".to_sym\n output += \" @#{attribute}=#{value}\" unless value.nil?\n end\n\n output += '>'\n output\n end", "def to_s\n\n # The desired format is: duration | timing-function | delay |\n # iteration-count | direction | fill-mode | play-state | name\n # Although currently not all attributes are supported.\n css = [\n seconds(@duration),\n @timing_function\n ]\n\n css << seconds(@delay) if @delay > 0\n\n css << @iteration_count\n\n css << @name\n\n css.join(' ')\n end", "def to_s\n puts \"Character Name: #{@name}\"\n puts \"Character Race: #{@race}\"\n puts \"Character Hit Points: #{@hit_points}\"\n print \"Character Weapons: \"\n for weapon in @weapons\n print weapon\n print \" , \"\n end\n puts \"\"\n puts \"Character Gold: #{@gold}\"\n print \"Character Clothing: \"\n for cloth in @clothing\n print cloth\n print \" , \"\n end\n puts \"\"\n end", "def to_s\n return \"Name: #{@first_name} #{@last_name}\\nAge: #{@age}\\nHair Color: #{@hair_color}\\nEye Color: #{@eye_color}\"\n end", "def to_s\n \"#{@color} #{@make} #{@model}\\n\"\n end", "def to_s\n (\"Name: #{@name}\\n\" \\\n \"Type: #{@type}\\n\" \\\n \"IP: #{@ip}\\n\" \\\n \"Username: #{@username}\\n\" \\\n \"Destination Folder: #{@dest_folder}\\n\")\n #puts \"Private Key: #{@private_key}\"\n end", "def to_s\n text =\"\"\n {'type'=>@type, 'copy'=>(@copy) ? \":copy\" : nil, 'target'=>@target}.each do |name,item|\n if ['target'].index(name)\n text += \"\\\"#{item}\\\" \" unless item.nil?\n else\n text += \"#{item} \" unless item.nil?\n end\n\n end\n text[text.length-1] = \";\" if text.length > 0\n text\n end", "def to_s() @out.to_s end", "def to_s\n \"iostream(input=#{@input.to_s},output=#{@output.to_s})\"\n end", "def to_s\n \"#{output}\\n[#{version}]\"\n end", "def to_s\n \"\"\"\n <tr>\n <td>#{@name}</td>\n <td>#{@version}</t>\n <td>#{@release}</td>\n <td>#{@architecture}</td>\n <td>#{@description}</td>\n <tr>\n \"\"\"\n end", "def to_s\r\n \"<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}\"\r\n end", "def out(*args); to_s(*args); end", "def sprintf(indent = \"\")\n s = indent + \"<\" + @name\n key_count = 0\n @attrkeys.each do |key|\n s = s + \" \" + key.to_s + \"=\\\"\" + @attrvals[key_count].to_s + \"\\\"\"\n key_count = key_count + 1\n end\n s = s + \">\"\n if(@children.size() > 0)\n s = s + \"\\n\"\n end\n @children.each do |child|\n unless(child.class.name.eql?(\"NaElement\"))\n abort(\"Unexpected reference found, expected NaElement not \" + child.class.name)\n end\n s = s + child.sprintf(indent + \"\\t\")\n end\n @content = NaElement::escapeHTML(@content)\n s = s + @content.to_s\n if(@children.size() > 0)\n s = s + indent\n end\n s = s + \"</\" + @name + \">\\n\"\n s\n end", "def to_s\n\t\tparts = [ self.oid ]\n\n\t\tparts << \"NAME %s\" % Treequel::Schema.qdescrs( self.names ) unless self.names.empty?\n\n\t\tparts << \"DESC '%s'\" % [ self.desc ] if self.desc\n\t\tparts << \"OBSOLETE\" if self.obsolete?\n\t\tparts << \"APPLIES %s\" % [ Treequel::Schema.oids(self.attr_oids) ]\n\t\tparts << self.extensions.strip unless self.extensions.empty?\n\n\t\treturn \"( %s )\" % [ parts.join(' ') ]\n\tend", "def inspect\n attributes = [\n \"feature_name=#{feature_name.inspect}\",\n \"gate_key=#{gate_key.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def to_s\n text = \"# #{name}\\n\"\n text += \"#{@type}\" + ((disabled?) ? \" false #\" : \"\")\n if conditions.count > 1\n text += \" #{@join} (\" + conditions.join(\", \") + \")\"\n else\n text += \" \" + conditions[0].to_s\n end\n text += \"\\n{\\n\"\n text += \"\\t\" + actions.join(\"\\n\\t\") if actions.count > 0\n text += \"\\n}\\n\"\n rescue => e\n puts e.to_s\n end", "def to_s\n res = \"\\n\" + @objs + ':'\n res += ' ' + @deps.uniq.join(' ') if @deps\n res += \"\\n\"\n @dirs_to_create.each do |dir|\n res += \"\\t\" + Platform.mkdir(dir) + \"\\n\"\n end\n @files_to_copy.each do |k,v|\n res += \"\\t\" + Platform.cp(v, k) + \"\\n\"\n end\n @rules.each { |r| res += \"\\t\" + r + \"\\n\" }\n res\n end", "def build_examples_output output\n output.join(\"\\n\\n\\t\")\n end", "def to_s\n #Build the string we are going to print\n \ts=\"\"\n\ts=@name+\" \"+@calories.to_s\n\ts\n end", "def list_attributes\n list = \"Age: #{@age} Earth years old\\nSize: #{@size}\\nVisitor Count: #{@visitor_count}\\nInhabitants: #{@inhabitants}\\n\"\n return list\n end", "def write_attribute_text(prefix, line)\n print prefix\n line.each do |achar|\n print achar.char\n end\n puts\n end", "def output(*instance_variable_names)\n instance_variable_names.each do |name|\n outputs[name.to_sym] = \"@#{name}\"\n end\n end", "def to_s()\n desc = \"person(\" + @id.to_s() + \",\" + @name\n if (@style != \"\")\n desc += \",\" + @style\n end\n desc += \",\" + @allegiance.to_s()\n desc += \",\" + @faction.to_s()\n desc += \",\" + @faction_for_chapter.to_s()\n if (@note != \"\")\n desc += \",\" + @note\n end\n desc += \")\"\n return desc\n end", "def format_attributes(attributes)\n if attributes.size > 0\n \" \" + attributes.map{ |k, v, attr| format_attribute(k, v, attr)}.join(\" \")\n else\n \"\"\n end\n end", "def inspect\n out = []\n out << string_name\n out << string_mappings\n out << string_data\n out.compact.join(' ') + '>'\n end", "def to_s\n \"\\nName: #{name}\\nRace: #{race}\\nHit Points: #{hit_points}\\nWeapons: #{weapons}\\nGold: #{gold}\\nClothing: #{clothing}\\n\"\n end", "def to_s\n output = @name\n output << \"\\n#{'=' * @name.size}\\n\"\n output << \"Platos: #{@platos.join(', ')}\\n\"\n output << \"Precio total del menu: #{@precios.reduce(:+)}\\n\"\n output << \"\\nValor calorico total del menu: #{@valor_energetico.reduce(:+).round(1)}\"\n output << \"\\nValor de las emisiones de CO2 del menu: #{@valor_ambiental.reduce(:+).round(1)} \\n\"\n\n end", "def attributor(attributes)\n inject_s(attributes) {|key, value| \" #{key.to_s}=\\\"#{value.to_s}\\\"\"}\n end", "def to_s ### return all parameters\r\n return \"#{@name} uses a #{@tool} #{@phtest_writer} and can be reached at email: #{@email} or phone: #{@phone} and the total number of all state changes was #{@@totalInstances} workers\"\r\n end", "def inspect\n s = ''\n @props.each do |key,val|\n s << sprintf(\"%-20.20s : %-40.40s\\n\", key.to_s, val.inspect)\n end\n s\n end", "def begintag(name, attributes=[])\r\n\tattribs = \"\"\r\n\tif (!attributes.empty)\r\n\t\tattributes.each do |(key,value)| \r\n\t\t\tattribs = \" #{key.strip}=\\\"#{value.strip}\\\"\"\r\n\t\tend\r\n\tend\r\n\treturn \"<\" + name.strip + \" \" + attribs + \">\"\r\nend", "def inspect\n \"#<#{classname} :#{attribute}>\"\n end", "def mk_attr_str **attr_map\n attr_map.map{|k,v|\" #{k}='#{v}'\"}.join\n end", "def to_s\n \"#{@name}, \" \\\n \"#{model.upcase}: \" \\\n \"#{data.values.join(\"/\")}, \" \\\n \":#{@type}\"\n end", "def to_s\n [\n \"Id: #{@id}\",\n \"Test Class Name: #{@class_name}\",\n \"Test File Path: #{@path}\",\n \"Log Level: #{@log_level}\",\n \"Data: #{@data}\",\n 'Flags:',\n @flags.map { |flag, value| \"#{flag} => #{value}\" }.join(\"\\n\")\n ].join(\"\\n\")\n end", "def obabelOutput(name, smiles)\n insert = %Q_> <id>\\n#{smiles}\\n\\n> <Name>\\n#{name}\\n\\n$$$$_\n response = %x_obabel -:\"#{smiles}\" -osdf --gen2D_.rstrip.split(/\\n/)\n response[-1] = insert\n return response.join(\"\\n\")\nend", "def to_s\n\t\tres = \"\\nname: \" + name.to_s + \"\\nid: \" + id.to_s + \"\\nservice: \" + service.to_s + \"\\ntitle: \" + title.to_s + \"\\nthumbnail: \" + thumbnail.to_s + \"\\nhref: \" + href.to_s\n\t\tres\n\tend", "def gen_raw_line\n return nil unless self.valid?\n line = ''\n data = []\n SUB_STR_ATTRIBUTES.each do |field,field_regex|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n line = \"#{data.join ' ,'}\"\n end\n\n data = []\n BOOL_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n if line == ''\n line += \"#{data.join ','} \"\n else\n line += \",#{data.join ','} \"\n end\n end\n\n data = []\n ARR_STR_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n if line == ''\n line += \"#{data.join ','} \"\n else\n line += \", #{data.join ','} \"\n end\n end\n\n data = []\n STR_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n line += data.join ' '\n return line\n end" ]
[ "0.70676124", "0.69913065", "0.69572973", "0.6885285", "0.6814431", "0.6814334", "0.6723114", "0.6710767", "0.66344506", "0.6621498", "0.6596937", "0.65846497", "0.6574082", "0.6574082", "0.65589637", "0.6546136", "0.6447666", "0.6438252", "0.6433854", "0.64112175", "0.64112175", "0.64112175", "0.6410061", "0.63606215", "0.6357872", "0.6336997", "0.6328389", "0.6270117", "0.6255396", "0.62433994", "0.62377125", "0.62256986", "0.6197991", "0.61772", "0.61649555", "0.61625165", "0.6161771", "0.6156895", "0.6154631", "0.6153504", "0.6149619", "0.6121515", "0.61213505", "0.6115077", "0.61028343", "0.60980564", "0.60762954", "0.60687196", "0.60637796", "0.6062103", "0.60582083", "0.604239", "0.6028983", "0.60146", "0.6014476", "0.6013673", "0.6001564", "0.5998157", "0.5995622", "0.5979131", "0.59725106", "0.5970237", "0.59699047", "0.59675854", "0.59604657", "0.59514976", "0.5948488", "0.5943352", "0.59426814", "0.59412664", "0.5936733", "0.59359485", "0.5934855", "0.5934075", "0.5932285", "0.59274125", "0.5926778", "0.5923593", "0.59148085", "0.5912042", "0.59111834", "0.5910387", "0.59096503", "0.5908572", "0.5897486", "0.58963305", "0.58924896", "0.5892467", "0.58920825", "0.5888625", "0.5888258", "0.5884246", "0.5878652", "0.5874401", "0.58735573", "0.58556175", "0.5838207", "0.58305365", "0.58261126", "0.58254623", "0.5823765" ]
0.0
-1
creates an output string for the storage in a file. The format serves the output format of the output file
def to_file "#{@name};#{@id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output\n super(@file_format => @file_path)\n end", "def output(format = :pls)\n format = format.to_sym\n raise ArgumentError.new(\"Format must be one of #{FORMATS.join(', ')}\") unless FORMATS.include? format\n\n case format\n when :text\n create_text\n when :m3u\n create_m3u\n else\n create_pls\n end\n end", "def export_as_string(format)\n sio = StringIO.new()\n export_to_io(sio, format)\n return sio.string\n end", "def output_file\n @output\n end", "def output\n out = <<~ZONE\n ;\n ; Database file #{@filename || 'unknown'} for #{@origin || 'unknown'} zone.\n ; Zone version: #{soa[:serial]}\n ;\n ZONE\n\n out << \"$ORIGIN #{@origin}.\\n\" if @origin\n out << \"$TTL #{@ttl}\\n\" if @ttl\n\n out << \"\\n\" << <<~ZONE\n #{soa[:origin]}\\t#{soa[:ttl]}\\tIN\\tSOA\\t(\n \\t\\t\\t\\t\\t#{soa[:primary]}\\t; primary\n \\t\\t\\t\\t\\t#{soa[:email]}\\t; email\n \\t\\t\\t\\t\\t#{soa[:serial]}\\t; serial number\n \\t\\t\\t\\t\\t#{soa[:refresh]}\\t; refresh\n \\t\\t\\t\\t\\t#{soa[:retry]}\\t; retry\n \\t\\t\\t\\t\\t#{soa[:expire]}\\t; expire\n \\t\\t\\t\\t\\t#{soa[:minimumTTL]}\\t; minimum TTL\n \\t\\t\\t\\t)\n ZONE\n\n RECORDS.each do |name, (type, *fields)|\n out << format_rr(name, type, *fields)\n end\n\n out\n end", "def output(filename)\r\n outs = File.new(filename , \"w\")\r\n outs.puts self.to_s\r\n outs.close\r\n end", "def outputFormat\n\tif File.exists? 'format.txt'\n\t\treturn File.readlines('format.txt').reject { |e| e.start_with? '#' or e.chomp.empty? }.join(\"\\n\")\n\tend\n\treturn '$name is playing $game for $viewers viewers'\nend", "def output_to_file\n @output=:file\n end", "def format_output(result, format)\n case format\n when :json\n JSON.pretty_generate(result)\n when :yaml\n YAML.dump(result)\n when :text\n result = result.keys if result.respond_to?(:keys)\n result.join(\" \")\n else\n raise ArgumentError, \"Unknown output format #{format}\"\n end\n end", "def output_path(format)\n \"#{output_path_without_extension}.#{format}\"\n end", "def output_name\n @output_name ||=\n case @format\n when :pcore\n \"#{File.basename(@path, '.rb')}.pp\"\n else\n raise _(\"unsupported format '%{format}'.\") % { format: @format }\n end\n end", "def format(outstream)\n file = File.basename(@path, '.*')\n req_attrs = Models::Lookup::get_required_attrs(file)\n\n format_from_stream(File.open(@path), req_attrs, outstream)\n end", "def output_file\n [\n output_root,\n feed_name,\n batch_id + \".\" + output_extension\n ].join(\"/\")\n end", "def output_path\n @output_path ||=\n case @format\n when :pcore\n File.join(@base, 'pcore', 'types', output_name)\n else\n raise _(\"unsupported format '%{format}'.\") % { format: @format }\n end\n end", "def create_file\n file = \"#{@parameters['id']}_#{@parameters['updated_at']}_for_calc.txt\"\n File.open(DIR + file, 'w') do |f|\n f.write(\"Calculate with following variables:\")\n f.write(@parameters.inspect)\n end\n end", "def save_as output_path,output_format , storage_type='Aspose',folder_name='',storage_name=''\n begin\n \n if @filename == ''\n raise('input file not specified')\n end \n \n if output_path == ''\n raise('output path not specified')\n end\n \n if output_format == ''\n raise('output format not specified')\n end\n \n # if not File.exist?(inputFile)\n # raise('input file doesn't exist.')\n # end\n \n \n \n str_uri = $product_uri + '/slides/'+@filename+'?format=' + output_format\n if !folder_name.empty?\n str_uri += '?folder=' + folder_name\n end\n if !storage_name.empty?\n str_uri += '&storage=' + storage_name\n end\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response_stream = RestClient.get(str_signed_uri,{:accept=>'application/json'})\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n if valid_output == '' \n output_path = output_path + Aspose::Cloud::Common::Utils.get_filename(@filename) + '.' + output_format\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 to_s\n \"#{@filename}: #{@name}#{@args}\\n\"\n end", "def print_to_file(dateTime, mem, cpuu, dsu)\n\t#########TO DO########\n\t#this function will take the variables, dateTime, mem, cpuu, & dsu, and put it into a string variable\n\t#if required, format the string.\n\n\t#then before doing the write to file, check if file exists\n\t#if file exists, go ahead and write to the file\n\t#if file doesn't exist, write to new file.\n\n\t#file names: file name will be determined by the month, day , hour. \"07-13_14\"\"month-day_hour\"\nend", "def create_output_file(content)\n\t\t\tf = File.new(@params[:output_file], 'w')\n\t\t\tf << content\n\t\t\tf.close\n\t\tend", "def format_file\n archiveFormat = @archive.to_s.split('\\n')\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.pop()\n archiveFormat.pop()\n archiveFormat\n end", "def format_output(output, requested_format)\n unless %w(json yaml yml).include?(requested_format)\n raise \"Open API Specification only supports generation of json / yaml files\"\n end\n\n data = output.to_hash\n requested_format == 'json' ? data.to_json : data.to_yaml\n end", "def write!\n # 1. skip if file already exists.\n if output_file_already_exists?\n RSpec::Scaffold.log(\"- #{@output_file} - already exists\", :puts)\n return\n end\n\n # 2. ensure parent directories exist\n FileUtils.makedirs(@output_file.parent)\n\n # 3. write to file\n File.open(@output_file, 'wb') do |f| # 'wb' originally\n f << @output_text\n end\n\n RSpec::Scaffold.log(\"+ #{@output_file}\")\n\n return @output_file.to_s\n end", "def to_s\n @file.to_s\n end", "def to_txt_user_file(name = default_name)\n CommonFormatters.to_user_file(name + '.txt', txt_output)\n end", "def to_file( f )\n buf = [@name, @ref.binary_role(), @ref.binary_type(), @ref.name,\n @type, TYPE_SIZES[@type], \n @data.length()].pack(PFORMAT)\n f.write(buf)\n\n fmt_str = \"%s%d\" % [TYPES[@type], data.length]\n buf = data.pack(fmt_str)\n f.write(buf)\n end", "def ascii(type)\n if type == \"products\"\n store_to_file \"\\n _ _ \"\n store_to_file \" | | | | \"\n store_to_file \" _ __ _ __ ___ __| |_ _ ___| |_ ___ \"\n store_to_file \"| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\"\n store_to_file \"| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\"\n store_to_file \"| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\"\n store_to_file \"| | \"\n store_to_file \"|_| \\n\\n \"\n elsif type == \"brands\"\n store_to_file \"\\n _ _ \"\n store_to_file \"| | | | \"\n store_to_file \"| |__ _ __ __ _ _ __ __| |___ \"\n store_to_file \"| '_ \\\\| '__/ _` | '_ \\\\ / _` / __|\"\n store_to_file \"| |_) | | | (_| | | | | (_| \\\\__ \\\\\"\n store_to_file \"|_.__/|_| \\\\__,_|_| |_|\\\\__,_|___/\\n\\n\"\n elsif type == \"sales\"\n store_to_file \"\\n _ _ \"\n store_to_file \" | | | | \"\n store_to_file \" ___ __ _| | ___ ___ _ __ ___ _ __ ___ _ __| |_ \"\n store_to_file \"/ __|/ _` | |/ _ \\\\/ __| | '__/ _ \\\\ '_ \\\\ / _ \\\\| '__| __| \"\n store_to_file \"\\\\__ \\\\ (_| | | __/\\\\__ \\\\ | | | __/ |_) | (_) | | | |_ \"\n store_to_file \"|___/\\\\__,_|_|\\\\___||___/ |_| \\\\___| .__/ \\\\___/|_| \\\\__| \"\n store_to_file \" | | \"\n store_to_file \" |_|\\n\\n\"\n end\nend", "def write(output_to); end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Examples:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\" unless description_text.empty?\n text << \"\\n\" + parameters_output_string\n text << \"\\n\" + rows_output_string unless rows.empty?\n\n text\n end", "def save_to_file\n\t\tFile.open(@output, \"w+\") do |file|\n\t\t\tfile.puts \"[b][align=center]\"\n\t\t\trandomize if @random\n\t\t\t@output_data.each_line { |line| line.delete('\\n') }\n\t\t\tfile.puts @output_data\n\t\t\tfile.puts \"[/align][/b][align=center][sup]Made with [user]kryszanek[/user]'s [url=http://github.com/kryszan/cloudy]cloudy[/url]\\\\m/ [/sup][/align]\"\n\t\tend\n\tend", "def file_format\n @descriptive_detail.file_format\n end", "def public_json_output_file(info, file)\n # format as JSON\n results = JSON.pretty_generate(info)\n\n write_output(file, results)\n\nend", "def to_s\n @file_text\n end", "def to_s\n @file_text\n end", "def to_s\r\n\t\tbuffer_as_applesoft_file(@contents)\r\n\tend", "def to_file(output_file)\r\n File.open(output_file, \"wb\") do |file|\r\n file.write [@number_of_strings].pack(\"I\")\r\n file.write [@offset_to_strings].pack(\"I\")\r\n\r\n sum_lengths = 0\r\n @strings.each_with_index do |str, index|\r\n file.write [index + 1].pack(\"I\")\r\n file.write [sum_lengths].pack(\"I\")\r\n\r\n sum_lengths += @strings[index].size * 2\r\n end\r\n\r\n file.write @strings.join.encode(\"UTF-16LE\")\r\n end\r\n end", "def export(filename)\n\t\tout = File.open(filename, 'w+')\n\t\t\n\t\t# Write file eader information\n\t\tout.puts '# ' + \"#{@input_file} :: #{@fileinfo}\"\n\t\toutstr = \"\"\n\t\t@output_ary.each { |e| \n\t\t\toutstr += \"#{e[:name]}_#{e[:unit]}\\t\"\n\t\t}\n\t\tout.puts outstr.rstrip\n\n\t\t(0..@output_ary[0][:values].size - 1).each { |i|\n\t\t\toutstr = \"\"\n\t\t\t@output_ary.each { |e| \n\t\t\t\toutstr += \"#{'%.8e' % e[:values][i]}\\t\"\n\t\t\t}\n\t\t\tout.puts outstr.rstrip\n\t\t}\n\n\t\tout.close\n\tend", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def to_s\n \"File #{file_identity.inspect} (version #{version}) \" \\\n \"at #{extracted_at.strftime('%Y-%m-%d %H:%M')}. \" \\\n \"#{full? ? 'A full' : 'An update'} extract \" \\\n \"for #{start_date} to #{end_date}.\"\n end", "def transform(file, format:); end", "def export(fileName, format)\n raise \"Not implemented\"\n end", "def to_fsl_txt(output_file = 'out.txt')\n puts \"Writing \" + output_file\n open(output_file, 'w') do |file|\n @data.transpose.each do |line|\n file.puts line.join(' ')\n end\n end\n end", "def save_to_file\n File.open(@output, 'w+') do |file|\n file.puts HEADER if @additional_html\n file.puts @data_for_output.join(\"\\n\")\n file.puts FOOTER if @additional_html\n end\n end", "def dump(target=\"\", options={})\r\n options = {\r\n :mz_precision => nil,\r\n :intensity_precision => nil,\r\n :pepmass_precision => nil,\r\n :headers => nil\r\n }.merge(options)\r\n\r\n target << \"BEGIN IONS\\n\"\r\n (options[:headers] || headers.keys).each do |key|\r\n target << \"#{key.upcase}=#{headers[key]}\\n\"\r\n end\r\n \r\n if charge\r\n target << \"CHARGE=#{charge_to_s}\\n\"\r\n end\r\n \r\n if pepmass\r\n target << \"PEPMASS=#{format options[:pepmass_precision]}\\n\" % pepmass\r\n end\r\n \r\n entry = data[0]\r\n data_format = case\r\n when entry == nil then nil\r\n when entry.kind_of?(Array) && entry.length == 2\r\n \"#{format options[:mz_precision]} #{format options[:intensity_precision]}\\n\"\r\n else\r\n \"#{format options[:mz_precision]}\\n\"\r\n end\r\n \r\n data.each do |data_point|\r\n target << (data_format % data_point)\r\n end\r\n \r\n target << \"END IONS\\n\"\r\n target\r\n end", "def to_file(style = default_style)\n if @queued_for_write[style]\n @queued_for_write[style]\n elsif exists?(style)\n tempfile = Tempfile.new instance_read(:file_name)\n tempfile.binmode\n tempfile.write file_contents(style)\n tempfile.flush\n tempfile.rewind\n tempfile\n else\n nil\n end\n\n end", "def customizeTemplate( \n _displayFormat = \"points\" # specify the type {values, points}\n )\n\n template = File.read(@filename)\n\n\n template.sub!('*****DETAIL*****', @dailyActivity.to_s)\n template.sub!('*****BADGES*****', [].to_s) # empty for now.\n template.sub!('*****FORMAT*****', \"\\\"#{_displayFormat}\\\"\")\n\n template.sub!('*****TOTAL*****', @dailyTotals.to_s)\n template.sub!('*****TARGET*****', @goalTarget.to_s)\n template.sub!('*****START*****', \"\\\"#{@startDate}\\\"\")\n template.sub!('*****END*****', \"\\\"#{@endDate}\\\"\")\n template.sub!('*****NAME*****', \"\\\"#{@name}\\\"\")\n\n return template\n end", "def format\n @data.format == :base ? :file : @data.format\n end", "def output(filename)\n @output = \" #{filename}\"\n end", "def output_file(style_name)\n overrides = {}\n if (format = styles[style_name][:format])\n overrides[:extension] = format\n end\n attachment.interpolate_path(style_name, overrides)\n end", "def format\n @_format\n end", "def to_file( f )\n buf = [ MAGIC, VERSION, @timestamp.to_i, @analyses.length() \n ].pack(PFORMAT)\n f.write(buf)\n\n @analyses.each do |a|\n a.to_file(f)\n end\n end", "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"# Created : \" + ccdd.getDateAndTime() + \"\\n# User : \" + ccdd.getUser() + \"\\n# Project : \" + ccdd.getProject() + \"\\n# Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n \n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n \n ccdd.writeToFileLn(file, \"\")\nend", "def s_to_file file_path_str, new_content_str='' \n File.open(file_path_str, \"w+\") { |f| f.write(new_content_str) }\n end", "def write_stl_file output_path \n @name ||= \"ascii\"\n \n File.open(output_path, 'w') do |f|\n f.puts \"solid #{@name}\"\n @fbuffer.each_triple do |a,b,c|\n facet_normal = @vnbuffer.avg_normal a, b, c\n f.puts \"facet normal #{facet_normal[0].round(5)} #{facet_normal[1].round(5)} #{facet_normal[2].round(5)}\\nouter loop\"\n f.puts \"vertex #{@vbuffer[a].map { |x| x.round(5) }.join(\" \")}\"\n f.puts \"vertex #{@vbuffer[b].map { |x| x.round(5) }.join(\" \")}\"\n f.puts \"vertex #{@vbuffer[c].map { |x| x.round(5) }.join(\" \")}\"\n f.puts \"endloop\\nendfacet\"\n end\n f.puts \"endsolid #{@name}\"\n end\n end", "def format\n raise NotImplementedError\n end", "def stringOutput\n\t\tend", "def stringOutput\n\t\tend", "def to_s\n text = ''\n\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\" unless steps.empty? || no_description_to_output?\n text << \"\\n#{steps_output_string}\" unless steps.empty?\n\n text\n end", "def create_own_results_file(filename,output)\n # Create a blank file and put the output in\n self.create_file(\"#{filename}\", output)\n end", "def file_output output_lines, friend\n # using 'write_to' method with given parameters\n write_to \"#{friend}.txt\" do |file|\n file.write output_lines[0]\n file.write output_lines[1]\n end\nend", "def output_file\n raise \"Invalid empty feed_name()\" if feed_name.nil? || feed_name.empty?\n path = [\n output_root,\n feed_name,\n batch_id || \"output\"\n ].compact.join(\"/\") + \".\" + output_extension\n end", "def export(filename=@location + \"-suntimes-#{@year}.txt\")\n File.write filename, @to_dx.to_s\n end", "def to_s\n file_file_name.to_s\n end", "def string_to_file(st,filename)\n f = File.new(filename,\"w\")\n f.puts st\n f.close\n end", "def output(input,fromfile=nil)\n @filename=@tmpl_cfg[:filename_tmpl]\n input=CqlsDoc.input_from_file(@filename=input) if fromfile\n ## fetch the contents of all saved variables! This fasten the compilation!\n Utils.saved_content_fetch_variables_from_file(@filename,self)\n\n#p @filename\n init_path(input)\n init_tags(input)\n init_keys\n init_model(input)\n#p input\n ## add the tag document in order to replace the user tag preamble and etc. Introduction of styles because of the odt format and the new convention in general to use styles even in latex. \n #txt=\"{#document][#content]\"+input+\"[#}\"\n txt=input\n#p txt\n prepare_user_input\n ## parse the content txt\n out=prepare_output(txt)\n prepare_last_output(out)\n clean_as_is(out)\n return out\n end", "def to_str\n @filename\n end", "def format\n @format\n end", "def output(value)\n @output_file = value\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless (description.nil? || description.empty?)\n text << \"\\n\" unless (steps.empty? || description.nil? || description.empty?)\n text << \"\\n\" + steps_output_string unless steps.empty?\n text << \"\\n\\n\" + examples_output_string unless examples.empty?\n\n text\n end", "def write_file( fname )\n File.open(fname, \"w\") do |f|\n f << TDP.application.result\n end\n TDP.application.result = String.new\n# puts \"...written to #{fname}\"\n end", "def to_file( f )\n buf = [@name, @sym, @value].pack(PFORMAT)\n f.write(buf)\n end", "def write_obj_file output_path\n File.open(output_path, 'w') do |f|\n @vbuffer.each_triple do |a,b,c|\n f.puts \"v #{a} #{b} #{c}\"\n end\n @vnbuffer.each_triple do |a,b,c|\n f.puts \"vn #{a} #{b} #{c}\"\n end\n @fbuffer.each_triple do |a,b,c|\n f.puts \"f #{a+1}//#{a+1} #{b+1}//#{b+1} #{c+1}//#{c+1}\"\n end\n end\n self\n end", "def to_file(style = default_style)\n return @queued_for_write[style] if @queued_for_write[style]\n filename = path(style)\n extname = File.extname(filename)\n basename = File.basename(filename, extname)\n file = Tempfile.new([basename, extname])\n file.binmode\n file.write(self.bucket.objects[path(style)].read)\n file.rewind\n return file\n end", "def write_spec_to_file!\n formatted_output = format_output(output, extension)\n abs_path = File.join(write_path, suggested_filename)\n\n assert_directory_exists!(abs_path)\n write_method.call(abs_path, formatted_output)\n end", "def save(file=nil)\n file = file || path \n text = format.render(number)\n ::File.open(file, 'w'){ |f| f << text }\n end", "def to_s\n text = ''\n\n text << tag_output_string + \"\\n\" unless tags.empty?\n text << \"Feature:#{name_output_string}\"\n text << \"\\n\" + description_output_string unless description_text.empty?\n text << \"\\n\\n\" + background_output_string if background\n text << \"\\n\\n\" + tests_output_string unless tests.empty?\n\n text\n end", "def out_file(out)\n out << \"#{File.basename(@filename)}\"\n in_file_location(out)\n end", "def write_file(metadata)\n return unless @formatter.can_format?(metadata)\n flat_metadata = @formatter.format(metadata)\n File.open(create_full_path(@file_name_prefix), \"w\", DEFAULT_FILE_MODE) do |f|\n flat_metadata.each do |k, v|\n # ensure value is a single line by truncation since most\n # dictionary format parsers expect literal chars on a single line.\n v = self.class.first_line_of(v)\n f.puts \"#{k}=#{v}\"\n end\n end\n true\n end", "def output(result)\n if options[:output]\n File.write(options[:output], result)\n else\n puts result\n end\n\n result\n end", "def save\n ole = File.open(@file_name, 'w')\n ole << header\n ole << fat\n @storages.each { |s| ole << s.to_s }\n ole << Array.new((512-(ole.pos % 512)), 0).pack('c*')\n ole << mini_fat\n ole << mini_fat_stream\n ole << fat_stream\n ole.close\n end", "def generate_json\n if @path\n output = formatted_output\n File.open(@path, 'w') { |f| f.write(output.to_json) }\n end\n end", "def generate_json\n if @path\n output = formatted_output\n File.open(@path, 'w') { |f| f.write(output.to_json) }\n end\n end", "def encode_file(filename, format, options = T.unsafe(nil)); end", "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n\n # Check if any group is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n\n ccdd.writeToFileLn(file, \"*/\\n\")\nend", "def output(base_uri, input_name, output_name, options, gif, output_folder)\n base_uri = base_uri + 'output/'\n if gif\n else\n Dir.mkdir(base_uri) unless Dir.exist?(base_uri)\n end\n\n if output_name.nil?\n rando = '_' + (0...4).map { 65.+(rand(26)).chr }.join.downcase\n settings_file = File.new(base_uri + input_name + rando + '.txt', 'w')\n settings_file.puts(options.to_s)\n settings_file.close\n base_uri + input_name + rando + '.png'\n elsif gif || output_folder\n @base_uri = base_uri + \"#{input_name}/\"\n # needs to be refactored to create an output folder instead of a sequence folder\n FileUtils.mkdir_p(@sequence_folder) unless Dir.exist?(@sequence_folder)\n settings_file = File.new(@sequence_folder + output_name + '.txt', 'w')\n settings_file.puts(options.to_s)\n settings_file.close\n @sequence_folder + output_name + '.png'\n elsif !gif && !output_folder\n settings_file = File.new(base_uri + output_name + '.txt', 'w')\n settings_file.puts(options.to_s)\n settings_file.close\n base_uri + output_name + '.png'\n end\n end", "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n\n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n\n ccdd.writeToFileLn(file, \"*/\")\nend", "def write_to_disk(output)\n path = \"./output.txt\"\n time = output[:time].strftime(\"%H:%M:%S:%N\")\n output_string = output[:value].to_s + \", \" + time + \"\\n\"\n File.open(path, 'a') { |file| file.write(output_string) }\n end", "def generate (path)\n File.open(path, \"w\") do |f|\n @output.each do |line|\n f.puts line\n end\n end \n end", "def to_s()\n\n # Immediately return records that have no data\n if @data.type == GDT_NO_DATA then\n return self.name\n end\n\n # Raise an exception if an invalid record is encountered\n unless RECORD_INFO[@type].valid\n raise \"Record type #{self.name} is not valid\"\n end\n \n # Format other data types...\n case @type\n when GRT_STRING\n self.name + \" \\\"#{@data.to_s}\\\"\"\n when GRT_BGNLIB, GRT_BGNSTR\n # Format dates for library & structure\n out_arr = []\n tmpar = (@type == GRT_BGNLIB) ? [\"LASTMOD\",\"LASTACC\"] : [\"LASTMOD\",\"CREATION\"]\n tmpar.each_with_index do |label, i|\n j = i * 6\n out_arr.push sprintf(\"%s %02d/%02d/%02d %02d:%02d:%02d\",label,\n @data[j],@data[j+1],@data[j+2],\n @data[j+3],@data[j+4],@data[j+5])\n end\n self.name + \"\\n\" + out_arr.join(\"\\n\")\n when GRT_UNITS\n# @@file_user_units[file] = @data[0].to_f\n \"UNITS\\nUSERUNITS #{@data[0].to_s}\\nPHYSUNITS #{data[1].to_s}\"\n when GRT_WIDTH\n units = 1\n# units = @@file_user_units[file] || 1\n self.name + \" #{@data[0]}\"\n when GRT_XY\n units = 1\n# units = @@file_user_units[file] || 1\n out_arr = [\"XY \" + (@data.value.length/2).to_s]\n 0.step(@data.value.length-2, 2) do |i|\n out_arr.push \" X #{@data[i]*units}; Y #{@data[i+1]*units}\"\n end\n out_arr.join(\";\\n\") + ';'\n when GRT_PRESENTATION, GRT_STRANS\n if @type == GRT_PRESENTATION then\n str = [@data.to_s[10,2], @data.to_s[12,2], @data.to_s[14,2]].map {|twobits|\n [(\"0\"*32+twobits)[-32..-1]].pack(\"B32\").unpack(\"N\")[0].to_s\n }.join(',')\n elsif @type == GRT_STRANS then\n str =[@data.to_s[0,1], @data.to_s[13,1], @data.to_s[14,1]].map {|onebit|\n [(\"0\"*32+onebit)[-32..-1]].pack(\"B32\").unpack(\"N\")[0].to_s\n }.join(',')\n end\n self.name + ' ' + str\n else\n self.name + ' ' + @data.to_s\n end\n \n end", "def fprintf(file, format)\n end", "def output_vs_header(output_file)\n if $verbose_mode == 1\n puts \"Creating:\\tVSphere file \"+output_file\n end\n file=File.open(output_file, 'w')\n $q_order.each do |key|\n if $q_struct[key].type == \"output\"\n if !$q_struct[key].parameter.match(/[A-z]/)\n output=$q_struct[key].value+\"\\n\"\n else\n output=$q_struct[key].parameter+\" \"+$q_struct[key].value+\"\\n\"\n puts output\n end\n file.write(output)\n end\n end\n file.close\n return\nend", "def raw_output\n self.read(@filename)\n end", "def file_from_biosequence(path_to_sequence, sequence_format, biosequence)\n ouput_file = File.open(path_to_sequence, \"w\")\n ouput_file.puts biosequence.output(sequence_format)\n ouput_file.close\nend", "def file_name\n file_name = \"h\"\n write_zeros.times { file_name += \"0\" }\n file_name += @@count.to_s + \".txt\"\n end" ]
[ "0.6752186", "0.6707946", "0.6540297", "0.65016735", "0.63808095", "0.6338184", "0.629629", "0.6273258", "0.6243573", "0.6202686", "0.6180343", "0.6178243", "0.6171372", "0.6159488", "0.6127152", "0.6079241", "0.6079177", "0.6078967", "0.60682523", "0.606595", "0.6065869", "0.6060029", "0.5976943", "0.59685624", "0.59626436", "0.5962615", "0.59340125", "0.59236646", "0.59210587", "0.5914426", "0.59130865", "0.59097195", "0.59097195", "0.59044963", "0.5901542", "0.5901289", "0.5900058", "0.5900058", "0.5900058", "0.5900058", "0.5900058", "0.5900058", "0.5900058", "0.5900058", "0.58818865", "0.5880779", "0.58630866", "0.5856557", "0.5847623", "0.5836155", "0.5831257", "0.5829881", "0.5824268", "0.58180046", "0.58137566", "0.58069825", "0.58064455", "0.57737726", "0.57728577", "0.5767182", "0.5736965", "0.5729466", "0.5729466", "0.57049793", "0.57048476", "0.56968594", "0.569087", "0.5688681", "0.56869704", "0.568455", "0.5681448", "0.5674799", "0.5673268", "0.5673065", "0.56702083", "0.5666393", "0.5666324", "0.566489", "0.5662761", "0.56619716", "0.5659558", "0.56457216", "0.56436604", "0.5643348", "0.56393313", "0.56379443", "0.5635696", "0.5635696", "0.56307584", "0.56233543", "0.56198204", "0.56180406", "0.56144375", "0.56096894", "0.5609068", "0.560763", "0.56067187", "0.5599648", "0.5594696", "0.5593215" ]
0.643774
4
Sjaak van den Berg
def solution(str) str.scan(/.{1,2}/).map { |e| e[1].nil? ? e + '_' : e } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schubert; end", "def schumann; end", "def zuruecksetzen()\n end", "def berlioz; end", "def bellini; end", "def berg; end", "def suivre; end", "def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end", "def GueltigBis\n \treturn @GueltigBis\n end", "def verdi; end", "def oben() \n return @fahrbahn.obere_linke_ecke().y() \n end", "def einschalten() \n @schirm.farbe_aendern('gelb')\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n @leuchtstrahl1.farbe_aendern('gelb')\n @leuchtstrahl2.farbe_aendern('gelb')\n @leuchtstrahl3.farbe_aendern('gelb')\n @leuchtstrahl4.farbe_aendern('gelb')\n end", "def bs; end", "def intelligenter_zug(spielfeld, aktueller_spieler)\n zug = nil\n\n spieler = spielfeld.spieler\n gegner = nil\n for s in spieler\n if s.name != aktueller_spieler.name\n gegner = s\n break\n end\n end\n\n # 1. Regel: Zuerst nach einer Gewinnsituation suchen\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Wenn der aktuelle Spieler in einer Reihe bereits zwei Felder\n # besetzt hält und das dritte frei ist, dann natürlich das nehmen\n if (frei.size == 1) and (besetzt[aktueller_spieler].size == 2)\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n\n if zug.nil?\n # 2. Regel: Suche dann nach den Reihen, in denen der Gegner bereits\n # genau 2 Felder besetzt hat und das dritte Feld noch frei ist.\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Gefährlich, wenn Gegner zwei besetzt hält. Wie in der vorherigen\n # Lektion gelernt, erhält man zum Index des aktuellen Spielers\n # in der Spielerliste den Index des Gegners mit der Bitoperation 1^wer\n if (frei.size == 1) and (besetzt[gegner].size == 2)\n # Jetzt muss der Spieler unbedingt das eine freie Feld besetzen!\n # Andernfalls kann der Gegner im nächsten Zug gewinnen.\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n end\n\n # Eckensituation bestimmen\n ecken = {\n 1 => 0, # links oben\n 3 => 0, # rechts oben\n 7 => 0, # links unten\n 9 => 0 # rechts unten\n }\n gegen_ecken = [[1, 9], [9, 1], [3, 7], [7, 3]]\n for z in spielfeld.zuege\n feld = z.nummer\n # Gegner besetzt die Ecke, wenn:\n # feld ist eine Ecke und Gegner besetzt sie\n if (ecken[feld] != nil) and (z.spieler == gegner)\n # Markiere Ecke als vom Gegner besetzt\n ecken[feld] = 1\n end\n end\n\n # 3. Regel: Immer in die Mitte setzten, falls dort frei ist\n # Vorsicht vor der XOX Situation an der Diagonale!\n if zug.nil?\n frei = spielfeld.freie_felder\n mitte = 5\n if frei.include?(mitte)\n zug = Zug.new(aktueller_spieler, mitte)\n else\n # Aha, Mitte ist bereits besetzt.\n # Sofern sie vom aktuellen Spieler besetzt ist, dann nach der XOX\n # Situation Ausschau halten und den nächsten Zug nicht in eine Ecke setzen.\n # XOX (oder OXO) Situation besteht, wenn\n # Ecke 1 und 9 vom Gegner besetzt und aktueller Spieler auf 5 oder\n # Ecke 3 und 7 vom Gegner besetzt und aktueller Spieler auf 5.\n for ecken_paar in gegen_ecken\n besetzt, frei_ecken = spielfeld.reihen_status([ecken_paar[0], mitte, ecken_paar[1]])\n if besetzt[gegner].include?(ecken_paar[0]) and besetzt[gegner].include?(ecken_paar[1])\n if besetzt[aktueller_spieler].include?(mitte)\n # Jetzt also nicht in eine freie Ecke setzen, sondern auf\n # die Felder 2, 4, 6 oder 8, sofern sie frei sind.\n xox_felder = [2, 4, 6, 8]\n for f in xox_felder\n if !frei.include?(f)\n xox_felder.delete(f)\n end\n end\n # Von den freien Ausweichfeldern zufällig eines nehmen\n feld = zufalls_feld(xox_felder)\n if feld != nil\n zug = Zug.new(aktueller_spieler, feld)\n break\n end\n end\n end\n end\n\n end\n end\n\n # 4. Regel: Verteidige gegenüberliegende Ecke\n frei = spielfeld.freie_felder\n if zug.nil?\n # Wenn Ecke 1 besetzt, dann setze auf 9, oder umgekehrt (sofern frei).\n # Wenn Ecke 3 besetzt, dann setze auf 7, oder umgekehrt (sofern frei).\n for ecken_paar in gegen_ecken\n if (ecken[ecken_paar[0]] > 0) and (frei.include?(ecken_paar[1]))\n zug = Zug.new(aktueller_spieler, ecken_paar[1])\n break # nicht weitersuchen\n end\n end\n end\n\n # 5. Regel: Setze in irgendeine freie Ecke.\n # Verwende Variablen 'frei' und 'ecken' von oben\n if zug.nil?\n for ecke in ecken.keys\n if frei.include?(ecke)\n zug = Zug.new(aktueller_spieler, ecke)\n break # nicht weitersuchen\n end\n end\n end\n\n # Andernfalls Zufallszug machen\n if zug.nil?\n zug = zufalls_zug(spielfeld, aktueller_spieler)\n end\n\n zug\n end", "def blg; end", "def im_nachbarraum_umsehen(richtung)\n naechster_raum = @aktueller_raum.ausgang(richtung)\n puts naechster_raum\n end", "def sichtbar_machen()\n end", "def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end", "def blam!\n berzerk? ? w00t! : super\n end", "def terpene; end", "def sichtbar_machen\n @backgrund.sichtbar_machen\n @baum1.sichtbar_machen\n @baum2.sichtbar_machen\n @baum3.sichtbar_machen\n @haus1.sichtbar_machen\n @haus2.sichtbar_machen\n @haus3.sichtbar_machen\n @hund1.sichtbar_machen\n @hund2.sichtbar_machen\n end", "def ausschalten()\n @schirm.farbe_aendern('orange')\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end", "def ausgabe\n\t\t@name\n\t\n\tend", "def sn\n end", "def bizet; end", "def sichtbar_machen()\n # TODO\n end", "def weber; end", "def ausgabe\n\t\t@name\n\tend", "def sichtbar_machen\n @fuss.sichtbar_machen\n @stiel.sichtbar_machen\n @schirm.sichtbar_machen\n unless @tag\n @leuchtstrahl1.sichtbar_machen\n @leuchtstrahl2.sichtbar_machen\n @leuchtstrahl3.sichtbar_machen\n @leuchtstrahl4.sichtbar_machen\n end\n end", "def formation; end", "def langsam_vertikal_bewegen(entfernung)\n absolute_entfernung = entfernung\n if sichtbar? \n delta = 1\n if entfernung < 0 \n delta = -1\n absolute_entfernung = - entfernung\n end \n x_delta = 0\n y_delta = delta\n Leinwand.gib_einzige_instanz().\n bewege(self,absolute_entfernung,x_delta,y_delta)\n end \n @spitze = @spitze + Punkt.new(0,entfernung)\n end", "def jack_handey; end", "def stderrs; end", "def funktionsname\n\tanweisung\nend", "def sea; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def saludanombre(nombre)\n\tputs \"Estimado Señor #{nombre}\"\nend", "def gesendete_lesen\r\n @postausgang.each{|x| puts x}\r\n end", "def sichtbar_machen()\n @fuss.sichtbar_machen()\n @stiel.sichtbar_machen()\n @schirm.sichtbar_machen()\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n end", "def feruchemist; end", "def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end", "def unsichtbar_machen()\n end", "def strain; end", "def sigla; @nome; end", "def sauvegarderJeu()\n\t\t# création de la sauvegarde\n\t\t@sauvegarde = Sauvegarde.creer( self.joueur,self.carte,self.nbTour )\n\n @sauvegardeYaml = SauvegardeYAML.creer(self.joueur.nom)\n @sauvegardeYaml.enregistrement( self.sauvegarde)\n\n\tend", "def mitch_hedberg; end", "def sld; end", "def gounod; end", "def gluck_french; end", "def squeek\r\n\t\treturn \"eeeep\"\r\n\tend", "def unsichtbar_machen\n @fuss.unsichtbar_machen\n @stiel.unsichtbar_machen\n @schirm.unsichtbar_machen\n @leuchtstrahl1.unsichtbar_machen\n @leuchtstrahl2.unsichtbar_machen\n @leuchtstrahl3.unsichtbar_machen\n @leuchtstrahl4.unsichtbar_machen\n end", "def herald; end", "def check_bingo\n\t\t\n\tend", "def wertungWorte (wertung)\n if wertung < 1\n return 'unglaublich schlecht'\n elsif wertung < 2\n return 'wirklich schlecht'\n elsif wertung < 3\n return 'relativ schlecht'\n elsif wertung < 4\n return 'in ordnung'\n elsif wertung < 5\n return 'relativ gut'\n elsif wertung < 6\n return 'wirklich gut'\n elsif wertung < 7\n return 'sehr gut'\n elsif wertung < 8\n return 'hervorragend'\n elsif wertung < 9\n return 'unbeschreiblich gut'\n elsif wertung < 10\n return 'bet&ouml;rend gut'\n elsif wertung < 11\n return 'unwirklich gut'\n else\n return 'katastrophal gut'\n end\n end", "def rossini; end", "def dh; end", "def folge_berechnen(tn,jahr)\n folge = [ \"\" ]\n ges_einsaetze = \"28.12.#{jahr}\".to_date.cweek\n ger_schalter = 1\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n zaehler = 0\n while folge.size <= ges_einsaetze\n namen.each do |name|\n unless tn[name].find_index(folge.size) || folge.size > ges_einsaetze\n folge << name\n zaehler += 1\n end\n end\n if zaehler == 0\n if namen.size < tn.size && ger_schalter == 1\n ger_schalter = 0\n else\n folge << \"nicht besetzt!\"\n ger_schalter = 1\n end\n end\n zaehler = 0\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n end\n return folge \n end", "def singular_siegler; end", "def nach_unten_bewegen\n bewegen_um_punkt(Punkt.new(0,10))\n end", "def buzzword; end", "def buzzword; end", "def mambo_no_5; end", "def gerund\n b = gerundive.sub( /.*\\s+(.*)um.*$/, \"\\\\1\" )\n b += \"ī, ō, etc.\"\n return b\n end", "def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl1.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl2.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl3.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl4.vertikal_bewegen(anzahl_punkte)\n end", "def herebody_s; end", "def drittelworte( wertung )\n if wertung < 1\n string1 = ''\n elsif wertung < 2\n string1 = 'eins'\n elsif wertung < 3\n string1 = 'zwei'\n elsif wertung < 4\n string1 = 'drei'\n elsif wertung < 5\n string1 = 'vier'\n elsif wertung < 6\n string1 = 'f&uuml;nf'\n elsif wertung < 7\n string1 = 'secht'\n elsif wertung < 8\n string1 = 'sieben'\n elsif wertung < 9\n string1 = 'acht'\n elsif wertung < 10\n string1 = 'neun'\n elsif wertung < 11\n string1 = 'zehn'\n elsif wertung < 12\n string1 = 'elf'\n else\n string1 = 'zw&ouml;f'\n end\n rest = sprintf(\"%.1f\",(wertung.to_f % 1))\n if rest.to_f == 0.3\n return string1 + \" ein drittel\"\n elsif rest.to_f == 0.6\n return string1 + \" zwei drittel\"\n elsif rest.to_f == 0\n return string1\n else\n return sprintf(\"%.1f\",wertung.to_s).sub(\".\",\",\")\n end\n end", "def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end", "def unsichtbar_machen()\n @fuss.unsichtbar_machen()\n @stiel.unsichtbar_machen()\n @schirm.unsichtbar_machen()\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end", "def bellini\n fetch('opera.italian.by_vincenzo_bellini')\n end", "def ausgleich\n\t\tsums = {}\n\t\t%w(jo caro).each do |who|\n\t\t\tsums[who] = @db.get_first_value(\"select summe from sum_#{who} where jahr = #{@options[:jahr]} and monat = #{@options[:monat]} and gemeinsam = 'g'\").to_f\n\t\tend\n\n\t\tif(sums['jo'] == sums['caro'])\n\t\t\tputs \"Gleichstand\"\n\t\t\treturn\n\t\tend\n\n\t\tausg = ((sums['jo'] + sums['caro']) / 2 - sums['jo']).abs\n\t\t\n\t\tif(sums['jo'] > sums['caro'])\n\t\t\tprintf(\"Caro an Jo: %.2f EUR\\n\", ausg)\n\t\telse\n\t\t\tprintf(\"Jo an Caro: %.2f EUR\\n\", ausg)\n\t\tend\n\t\t\n\tend", "def bstardrag\n bstar\n end", "def guct\n end", "def romeo_and_juliet; end", "def sb(t, s, c)\n\n end", "def insult_swabbie\n return case self.swab\n when :counter\n self.boatswain\n when :timestamp\n self.coxswain\n else\n \"\"\n end\n end", "def spren; end", "def horizontal_bewegen(anzahl)\n bewegen_um_punkt(Punkt.new(anzahl,0)) \n end", "def malts; end", "def zapis_vysledek(reseni, je_splnitelna) \n @reseni = reseni\n @vysledny_soucet_vah = vrat_soucet_vah(reseni)\n @je_splnitelna = je_splnitelna\n end", "def breathe\n \"i get oxygen from the water\"\n end", "def isbn; end", "def chargementJeu(nomJoueur)\n @sauvegardeYaml = SauvegardeYAML.creer(nomJoueur)\n @sauvegarde = @sauvegardeYaml.chargement()\n @joueur = @sauvegarde.joueur\n nom=@joueur.nom.split(\".\")\n @joueur.nom = nom[0]\n print @joueur.nom\n @carte = @sauvegarde.carte\n @nbTour = @sauvegarde.nbTour\n\tend", "def Blast\n\n\t\nend", "def who_we_are\r\n end", "def An()\n return @RownanieWielomianu.first.Wspolczynnik\n end", "def gram_schmidtR\n gram_schmidt[1]\n end", "def gusts \n \"gusts\" \n end", "def hiss; end", "def PodstawAn(ans) \n @RownanieWielomianu.each{ |wezel| \n if(ans.key?(wezel.Wspolczynnik))\n wezel.Wspolczynnik = ans[wezel.Wspolczynnik]\n end\n }\n end", "def scientist; end", "def england\n end", "def tongue_twister; end", "def probers; end", "def zlosniwa\r\n raise # ponownie zglasza biezacy wyjatek\r\n raise \"Houston, we've got a problem!\" # zglasza RuntimeError\r\n raise InterfaceException, \"Blad klawiatury\", caller # ustawia komunikat i slad stosu\r\nend", "def test_sbb\n puts Sbb.find('geneva', 'berne', Time.utc(2007,\"feb\",8,13,0,0)).inspect\n end", "def mi_carrera\n\n\tend", "def name; termid;end", "def vin; end" ]
[ "0.7576614", "0.70595306", "0.6850953", "0.68300265", "0.6652317", "0.6635704", "0.64665234", "0.63879704", "0.6330819", "0.6307666", "0.62543666", "0.6253937", "0.624926", "0.6169856", "0.61295396", "0.6115479", "0.6113548", "0.6109211", "0.6101353", "0.60676706", "0.6044888", "0.60421085", "0.60111254", "0.60101676", "0.600944", "0.59913373", "0.59817106", "0.59649557", "0.590478", "0.5880659", "0.58578277", "0.5843083", "0.58184266", "0.5812214", "0.58086973", "0.5806323", "0.5806323", "0.5806323", "0.5806323", "0.5767323", "0.5766141", "0.5747116", "0.57454497", "0.57277894", "0.57056093", "0.5702362", "0.5674423", "0.56541294", "0.5639651", "0.56295735", "0.56231767", "0.56141925", "0.56083107", "0.56040084", "0.5592942", "0.55865866", "0.5571775", "0.5541313", "0.5535259", "0.55208844", "0.5517274", "0.5509007", "0.5508371", "0.5508371", "0.5499663", "0.5489449", "0.54837984", "0.5481399", "0.5458728", "0.545015", "0.5447507", "0.5441904", "0.54382044", "0.54280895", "0.54251796", "0.5423542", "0.5417894", "0.5393028", "0.5392647", "0.5391713", "0.5387715", "0.5383053", "0.53825873", "0.5380288", "0.5377187", "0.5375708", "0.53661525", "0.5361911", "0.5354287", "0.5353342", "0.5353063", "0.5351982", "0.53401613", "0.53361946", "0.53290504", "0.5327695", "0.5324891", "0.53243613", "0.5318225", "0.53112805", "0.53094244" ]
0.0
-1
Metodos com as acoes
def clicar_mais botao_mais.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agregarMetodos unaClase\n self.metodos.each do |metodo|\n self.agregar_metodo(unaClase,metodo[0],&metodo[1])\n end\n end", "def mostra_tudo\n apius.mostra_resumo\n apide.mostra_resumo\n apifr.mostra_resumo\n apimt.mostra_resumo\n apies.mostra_resumo\n apigm.mostra_resumo\n apibc.mostra_resumo\n end", "def pontosanunciante\n\n\t\tUsuario.find(self.id_usuario).meuspontos\n\n\tend", "def atributos\n p \"El Modelo del carro es: #{@modelo}, la Marca es: #{@marca} y el Color es: #{@color}\"\n end", "def get_azucares\n @_100=((@azucares*100)/@peso)\n @ir_100=(@_100/90)*100\n @porcion=((@azucares*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/90)*100\n [ @azucares , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end", "def comisiones_asignadas\n asunto.comisiones if asunto\n end", "def impacto_ambiental\n [@gei, @terreno]\n end", "def checaMeta\n\t\t@goals = self.goals\n\t\t@goals.each do |g|\n\t\t\tself.categories.each do |c|\n\t\t\t\tsaldo = c.valor_receita_efetivado - c.valor_despesa_efetivado\n\t\t\t\tif ((g.fim < Date.today) && (saldo < g.valor))\n\t\t\t\t\tg.estado = -1\t\t\t\t\t\n\t\t\t\telsif ((g.fim < Date.today) && (saldo >= g.valor)) \n\t\t\t\t\tg.estado = 1\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t\tg.save\n\t\tend\n\tend", "def mi_carrera\n\n\tend", "def estatisticas_votos_legenda(ano)\n @estatisticas[\"votos_legendas\"] = [\"percentual_votos_entre_legendas\"]\n @estatisticas[\"votos_legendas\"] << \"percentual_votos_do_total\"\n @estatisticas[\"votos_legendas\"] << \"percentual_votos_do_total_valido\"\n\n total_votos_legenda\n @votacao_legendas_hash[ano].each do |chave, votos_de_legenda|\n end\n\n# suspenso ate o termino da implementacao de uma consulta\n=begin\n total_votos_legenda = @resultado_anos[ano].qt_votos_legenda\n total_votos = @resultado_anos[ano].qtd_comparecimento\n total_votos_validos = @resultado_anos[ano].qt_votos_nominais + @resultado_anos[ano].qt_votos_legenda\n @votos_legenda_anos[ano].each do |legenda|\n legenda.percentual_votos_entre_legendas = legenda.\n legenda.percentual_votos_do_total =\n legenda.percentual_votos_do_total_valido =\n end\n=end\n end", "def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end", "def asigna_datos\n return unless taxon.present?\n\n cols = if columnas_array.present?\n columnas_array\n else\n columnas.split(',') if columnas.present?\n end\n\n cols.each do |col|\n\n case col\n when 'x_snib_id'\n if proveedor = taxon.proveedor\n self.taxon.x_snib_id = proveedor.snib_id\n end\n when 'x_snib_reino'\n if proveedor = taxon.proveedor\n self.taxon.x_snib_reino = proveedor.snib_reino\n end\n when 'x_naturalista_id'\n if proveedor = taxon.proveedor\n self.taxon.x_naturalista_id = proveedor.naturalista_id\n end\n when 'x_foto_principal'\n if adicional = taxon.adicional\n self.taxon.x_foto_principal = adicional.foto_principal\n end\n when 'x_nombre_comun_principal'\n if adicional = taxon.adicional\n self.taxon.x_nombre_comun_principal = adicional.nombre_comun_principal\n end\n when 'x_categoria_taxonomica'\n self.taxon.x_categoria_taxonomica = taxon.try(:nombre_categoria_taxonomica) || taxon.categoria_taxonomica.nombre_categoria_taxonomica\n when 'x_estatus'\n self.taxon.x_estatus = Especie::ESTATUS_SIGNIFICADO[taxon.estatus]\n when 'x_nombres_comunes'\n nombres_comunes = taxon.nombres_comunes.map{ |nom| nom.nombre_comun.capitalize }.uniq.sort\n next unless nombres_comunes.any?\n self.taxon.x_nombres_comunes = nombres_comunes.join(', ')\n when 'x_tipo_distribucion'\n tipos_distribuciones = taxon.tipos_distribuciones.map(&:descripcion).uniq\n next unless tipos_distribuciones.any?\n self.taxon.x_tipo_distribucion = tipos_distribuciones.join(',')\n when 'x_nom' # TODO: homologar las demas descargas\n nom = taxon.catalogos.nom.distinct\n next unless nom.any?\n self.taxon.x_nom = nom.map(&:descripcion).join(', ')\n \n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [14,15,16,17].include?(cat.catalogo_id)\n end\n \n self.taxon.x_nom_obs = obs.join(', ')\n when 'x_iucn' # TODO: homologar las demas descargas\n iucn = taxon.catalogos.iucn.distinct\n next unless iucn.any?\n self.taxon.x_iucn = iucn.map(&:descripcion).join(', ')\n \n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [25,26,27,28,29,30,31,32,1022,1023].include?(cat.catalogo_id)\n end\n \n self.taxon.x_iucn_obs = obs.join(', ')\n when 'x_cites' # TODO: homologar las demas descargas\n cites = taxon.catalogos.cites.distinct\n next unless cites.any?\n self.taxon.x_cites = cites.map(&:descripcion).join(', ') \n\n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [22,23,24].include?(cat.catalogo_id)\n end\n \n self.taxon.x_cites_obs = obs.join(', ') \n when 'x_ambiente' # TODO: homologar las demas descargas\n if hash_especies.present? # Quiere decir que viene de las descargas pr region\n ambiente = []\n taxon.catalogos.each do |catalogo|\n if catalogo.nivel1 == 2\n ambiente << catalogo\n end\n end\n else\n ambiente = taxon.catalogos.ambientes\n end\n\n next unless ambiente.any?\n self.taxon.x_ambiente = ambiente.map(&:descripcion).join(', ') \n when 'x_naturalista_fotos'\n next unless adicional = taxon.adicional\n if proveedor = taxon.proveedor\n self.taxon.x_naturalista_fotos = \"#{CONFIG.site_url}especies/#{taxon.id}/fotos-naturalista\" if proveedor.naturalista_id.present? && adicional.foto_principal.present?\n end\n when 'x_bdi_fotos'\n next unless adicional = taxon.adicional\n self.taxon.x_bdi_fotos = \"#{CONFIG.site_url}especies/#{taxon.id}/bdi-photos\" if adicional.foto_principal.present?\n when 'x_bibliografia'\n biblio = taxon.bibliografias\n self.taxon.x_bibliografia = biblio.map(&:cita_completa).join(\"\\n\")\n when 'x_url_ev'\n self.taxon.x_url_ev = \"#{CONFIG.site_url}especies/#{taxon.id}-#{taxon.nombre_cientifico.estandariza}\"\n when 'x_num_reg'\n self.taxon.x_num_reg = hash_especies[taxon.scat.catalogo_id]\n else\n next\n end # End switch\n end # End each cols\n\n # Para agregar todas las categorias taxonomicas que pidio, primero se intersectan\n cats = COLUMNAS_CATEGORIAS & cols\n\n if cats.any?\n return if taxon.is_root? # No hay categorias que completar\n ids = taxon.path_ids\n\n Especie.select(:nombre, \"#{CategoriaTaxonomica.attribute_alias(:nombre_categoria_taxonomica)} AS nombre_categoria_taxonomica\").left_joins(:categoria_taxonomica).where(id: ids).each do |ancestro|\n categoria = 'x_' << ancestro.nombre_categoria_taxonomica.estandariza\n next unless COLUMNAS_CATEGORIAS.include?(categoria)\n eval(\"self.taxon.#{categoria} = ancestro.nombre\") # Asigna el nombre del ancestro si es que coincidio con la categoria\n end\n end\n end", "def devolver_azucar \n\t\treturn @azucares\n\tend", "def terrenos\r\n terreno = 0\r\n @lista_alimentos.each do |i|\r\n terreno += i.terreno\r\n end\r\n return terreno\r\n end", "def especies_filtros\n return unless tiene_filtros?\n self.taxones = Especie.select(:id).select(\"#{Scat.attribute_alias(:catalogo_id)} AS catalogo_id\").joins(:scat).distinct\n por_especie_id\n por_nombre\n #estatus\n #solo_publicos\n estado_conservacion\n tipo_distribucion\n uso\n formas_crecimiento\n ambiente\n\n #return unless por_id_o_nombre\n #categoria_por_nivel\n end", "def solicitudes_atrasadas\n end", "def proteinas\n\t\treturn @proteinas*@cantidad\n\tend", "def get_vagas_eleicao(ano, cargo, localizacao)\n return $vagas[ano.to_s][localizacao.nome][cargo.to_s].to_i\nend", "def save_atributos\n\n unless @pre.nil?\n @pre[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@pre[:valor][key],campo:'precio')\n end\n end\n\n unless @compraAtributo.nil?\n @compraAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@compraAtributo[:valor][key],campo:'compra')\n end\n end\n\n unless @polizaAtributo.nil?\n @polizaAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@polizaAtributo[:valor][key],campo:'poliza')\n end\n end\n\n unless @tipovehiculoAtributo.nil?\n @tipovehiculoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@tipovehiculoAtributo[:valor][key],campo:'tipovehiculo')\n end\n end\n\n unless @tipoproductoAtributo.nil?\n @tipoproductoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@tipoproductoAtributo[:valor][key],campo:'tipoproducto')\n end \n end\n \n unless @aseguradoraAtributo.nil?\n @aseguradoraAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@aseguradoraAtributo[:valor][key],campo:'aseguradora')\n end\n end\n \n unless @destacadoAtributo.nil?\n @destacadoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@destacadoAtributo[:valor][key],campo:'destacado')\n end\n end\n\n unless @vigenciaAtributo.nil?\n @vigenciaAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@vigenciaAtributo[:valor][key],campo:'vigencia')\n end\n end\n\n end", "def gastriloquism_quinnipiac_apodictical()\n end", "def ahorrodinero(año)\n\n i = 0\n final = Array.new \n final1 = Array.new \n final2 = Array.new \n \n\n datos = Valore.where(:año => año)\n \n datos.each do |datos|\n \n \n final[i] = datos.read_attribute(\"es\")\n final1[i] = datos.read_attribute(\"tarifa\")\n final2[i] = final1[i]*final[i]\n \n i = i +1\n \n \n end\n \n return final2\n\n\n\n end", "def estatistica_legendas(ano)\n @estatisticas[\"legendas\"] = \"numero_partidos\"\n @legendas_anos[ano].each do | partido, legenda |\n partidos_str = legenda.composicao_coligacao\n legenda.numero_partidos = partidos_str.split(\"/\").size\n end\n end", "def aon; end", "def datos(opc={})\n return [] unless cadena_especies.present?\n\n # Por default muestra todos\n Especie.caso_rango_valores('especies.id',cadena_especies).order('nombre_cientifico ASC').limit(opc[:limit] ||= 300000).each do |taxon|\n self.taxon = taxon\n asigna_datos\n self.taxones << taxon\n end\n end", "def vegetaria\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18.0,2.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\n\t\t[cerdo,cordero,vaca,camarones,pollo].each do |i|\n\t\t\tif (@alimentos.find { |x| x == i }) != nil\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn ((prot >= 14.0 || prot <= 26.0) && (car >= 34.0 || car <= 46.0) && (lip >= 34.0 || lip <= 46.0))\n\tend", "def resultados_basica\n paginado_y_offset\n estatus\n solo_publicos\n solo_categoria\n\n return unless por_id_o_nombre\n\n conteo_por_categoria_taxonomica\n dame_totales\n resultados\n\n resultados_fuzzy_match if totales == 0 && pagina == 1 && params[:solo_categoria].blank?\n end", "def get_usoterreno\n aux = 0.0\n @contenido.each do |alimento|\n aux += alimento.ground\n end\n @usoterreno = aux\n end", "def anthologies\n\t\t@anthologies = Anthology.alphabetic.decorate\n\tend", "def get_alco\n @_100=((@alco*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@alco*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @alco , @_100 , 0 , @porcion , 0 ]\n end", "def setup_aftinfo\n @afrate = @acts[1] || 3\n @afopac = @acts[2] || 20\n end", "def setup_aftinfo\n @afrate = @acts[1] || 3\n @afopac = @acts[2] || 20\n end", "def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end", "def vegetaliana\n\t\thuevo = Alimento.new(\"Huevo\", 13.0, 1.1, 11.0, 4.2, 5.7)\n\t\tqueso = Alimento.new(\"Queso\",25.0,1.3,33.0,11.0,41.0)\n\t\tleche = Alimento.new(\"Leche de vaca\", 3.3, 4.8, 3.2, 3.2, 8.9)\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tcamarones = Alimento.new(\"Camarones\",17.6,1.5,0.6,18.0,2.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\n\t\t[huevo,queso,leche,cerdo,cordero,vaca,camarones,pollo].each do |i|\n\t\t\tif (@alimentos.find { |x| x == i }) != nil\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn true\n\tend", "def valor_energetico\n (@proteinas * 4) + (@glucidos * 4) + (@grasas * 9)\n end", "def show\n listaMatriculas = MatDisc.select(\"*\")\n .joins(\"LEFT JOIN mat_turmas on mat_turmas.id = mat_discs.mat_turma_id\")\n .joins(\"LEFT JOIN alunos on alunos.id = mat_turmas.aluno_id\")\n .where(\"mat_discs.disciplina_id=\"+@avaliacao.disciplina_id.to_s)\n listaMatriculas.each do |matricula| #lista todos os alunos matriculados na disciplina e turma\n @avaliacao.provas.each do |prova| #todo que fizeram a prova\n if prova.mat_disc_id == matricula.id\n prova.aluno_nome = matricula.nome\n end\n end\n end\n end", "def asignaturas_peda_por(profe)\n # per = Horario.where('professor_id = ?', profe.id).joins(:asignatura).where('lectiva=true')\n per = Horario.where('professor_id = ?', profe.id).joins(:asignatura)\n .where('asignaturas.lectiva=TRUE').order('asignaturas.orden')\n a = per.map do |h|\n [\"#{h.asignatura.name} #{h.curso.name} \", \"#{h.horas}\"]\n end\n\n end", "def terreno\n\t\treturn @terreno*@cantidad\n\tend", "def index\n @anios = Ordenanza.select(:anio).uniq.map do | ord | ord.anio end\n\n @temas = Ordenanza.select(:tema).uniq.map do | ord | ord.tema end\n\n #TODO: Borrar\n @ordenanzas = Ordenanza.limit(10)\n end", "def calculo_metros_terreno\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n\n while (recorrido != nil && cantidad != nil)\n @metros_terreno = @emisiones_diarias + ((recorrido.value.terreno * cantidad.value)/1000)\n\n recorrido = recorrido.next\n cantidad = cantidad.next\n end\n\n @metros_terreno\n end", "def emotional_adjective; end", "def carta_mayor\n \"#{@carta_mayor[1][:numero]} #{@carta_mayor[1][:pinta]}\"\n end", "def initialize(nombre,lista_alimentos,acc_cantidad_alimentos)\n\t\tsuper(nombre,lista_alimentos,acc_cantidad_alimentos)\n\t\t@emisiones_gei = 0\n\t\t@area_terreno_m2 = 0\n\tend", "def carbohidratos\n\t\treturn @carbohidratos*@cantidad\n\tend", "def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend", "def hidratos_carbono\r\n hc = 0\r\n @lista_alimentos.each do |i|\r\n hc += i.carbohidratos\r\n end\r\n return hc\r\n end", "def get_energia\n\t\t\t\t@lipidos * 9 + @proteins * 4 + @carbs * 4\n\t\t\tend", "def adeudos\n sumas = suma_valores\n resp = {cuentas_con_deuda: 0} # cuenta si alguna cuenta cuenta con deuda\n EmpCuentab.monedas.each do |moneda, id_moneda|\n total_compra = sumas[moneda][:total]\n total_deuda = total_compra - com_pagos.joins(:emp_cuentab).where('emp_cuentabs.moneda = ?', id_moneda).sum(:monto)\n resp[moneda] = {\n total: total_compra,\n deuda: total_deuda}\n if total_deuda > 0\n resp[:cuentas_con_deuda] += 1\n end\n end\n\n resp\n end", "def initialize\n\t\t@vida = 1\n\t\t@forca = 1\n\t\t@carisma = 1\n\t\t@arma = 1\n\tend", "def aniade_taxones_query\n end", "def get_metodos_de(clase,metodo) #metodo puede ser :== o :<\n lista = get_clase(clase,metodo) #puede devolver una clase o una lista de subclases\n lista.map{|klass| klass.instance_methods(false)}.inject{|a,b| a+b }\n end", "def disponibles\n total = []\n heros.each do |h|\n next unless h.tesoro\n next unless h.tesoro[item + 's']\n h.tesoro[item + 's'].each do |e|\n (total << h.id) if e == id\n end\n end\n total\n end", "def promedios\n promedio = (@nota1.to_f + @nota2.to_f + @nota3.to_f) / 3\n promedio\n end", "def base_eva\n armor1 = $data_armors[@armor1_id]\n armor2 = $data_armors[@armor2_id]\n armor3 = $data_armors[@armor3_id]\n armor4 = $data_armors[@armor4_id]\n eva1 = armor1 != nil ? armor1.eva : 0\n eva2 = armor2 != nil ? armor2.eva : 0\n eva3 = armor3 != nil ? armor3.eva : 0\n eva4 = armor4 != nil ? armor4.eva : 0\n return eva1 + eva2 + eva3 + eva4\n end", "def values() end", "def calculadora(uno,dos,tres=0, opciones= {})\n if(opciones['suma']==1)\n return uno +dos+tres\n end\n if(opciones['multiplica']==1)\n return uno * dos *tres\n end\nend", "def hidratos \n\t\t@hidratos = @azucares + @polialcoles + @almidon\n\t\treturn @hidratos\n\tend", "def totals\n t=['Totaux']\n # bottoms est un arrau de totaux des différents mois de l'exercice\n bottoms = 1.upto(@period.list_months.size).collect do |i| # i va de 1 à 12 par ex\n lines.sum {|l| l[i]} # l[i] car l[0] est nature.name\n end\n t + bottoms + [bottoms.sum {|i| i}]\n end", "def totals\n t=['Totaux']\n # bottoms est un arrau de totaux des différents mois de l'exercice\n bottoms = 1.upto(@period.list_months.size).collect do |i| # i va de 1 à 12 par ex\n lines.sum {|l| l[i]} # l[i] car l[0] est nature.name\n end\n t + bottoms + [bottoms.sum {|i| i}]\n end", "def suma_gramos\n\t\t\t@proteinas + @carbohidratos + @lipidos\n\t\tend", "def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end", "def atributos_presenta\n return [ \n :id, \n :fecha, \n :oficina, \n :responsable,\n :nombre, \n :actividadtipos, \n :proyectos,\n :actividadareas, \n :proyectosfinancieros, \n :objetivo\n ]\n end", "def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \n end", "def victoire\n \n [[@a1, @a2, @a3],\n [@a1, @b2, @c3],\n [@a1, @b1, @c1],\n [@b1, @b2, @b3],\n [@c1, @c2, @c3],\n [@c1, @b2, @a3],\n [@a2, @b2, @c2],\n [@a3, @b3, @c3]]\n end", "def acosh\n math :acosh\n end", "def incluir_inicial\n ['casoid', 'fecha', 'ubicaciones', 'presponsables',\n 'tipificacion', 'victimas', 'memo']\n end", "def causas_conocidas\n %w{ cheque-propio cheque-de-terceros efectivo transferencia retenciones }\n end", "def suivre; end", "def marcoReal\n\t\t@marcoReal\n\tend", "def initialize(nombre,ingredientes)\r\n super(nombre,ingredientes)\r\n @geiTotal=0\r\n @terrenoTotal=0\r\n\r\n @ingredientes.each{|a|\r\n @geiTotal = @geiTotal + a.gei\r\n @terrenoTotal = @terrenoTotal + a.terreno\r\n }\r\n end", "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "def adyacentes(nodo, analisados)\n adyacentes = []\n @graph[nodo].each do |n|\n adyacentes << n[0] if analisados[n[0]] == false\n end\n adyacentes\n end", "def carne\n\t\tcerdo = Alimento.new(\"Cerdo\", 21.5, 0.0, 6.3, 7.6, 11.0)\n\t\tcordero = Alimento.new(\"Cordero\",18.0,0.0,3.1,50.0,164.0)\n\t\tvaca = Alimento.new(\"Carne de vaca\", 21.1,0.0,3.1,50.0,164.0)\n\t\tpollo = Alimento.new(\"Pollo\",20.6,0.0,5.6,5.7,7.1)\n\t\tsuma = 0\n\n\t\t[cerdo,cordero,vaca,pollo].each do |i|\n\t\t\tif (@alimentos.find_index { |x| x == i } != nil)\n\t\t\t\tsuma += @gramos[@alimentos.find_index { |x| x == i }].valor\n\t\t\tend\t\t\n\t\tend\n\n\t\treturn suma >= (gramos_total * 0.45)\n\tend", "def total_nutrientes\n\t\ti = 0\n\t\tproteinas = carbohidratos = lipidos = 0.0\n\t\twhile i < @lista_alimentos.size do\n\t\t\tproteinas += (@lista_alimentos[i].proteinas)*(@lista_cantidades[i])\n\t\t\tcarbohidratos += (@lista_alimentos[i].carbohidratos)*(@lista_cantidades[i])\n\t\t\tlipidos += (@lista_alimentos[i].lipidos)*(@lista_cantidades[i])\n\t\t i+= 1\n\t\tend\n\t\treturn proteinas + lipidos + carbohidratos\n\tend", "def metaadd m\n\t\treturn m\n\tend", "def initialize(mapa)\n mapatemp = []\n mapa.each_value {|value| mapatemp.push(value) }\n # Verificando que hay exactamente dos jugadores \n if mapa.length == 2\n # Verificando que en efecto son estrategias, si alguna no lo es se lanza excepcion\n if (!mapatemp[0].is_a?(Manual) && !mapatemp[0].is_a?(Uniforme) && !mapatemp[0].is_a?(Sesgada) && !mapatemp[0].is_a?(Copiar) && !mapatemp[0].is_a?(Pensar)) ||\n (!mapatemp[1].is_a?(Manual) && !mapatemp[1].is_a?(Uniforme) && !mapatemp[1].is_a?(Sesgada) && !mapatemp[1].is_a?(Copiar) && !mapatemp[1].is_a?(Pensar))\n raise \"Ambos elementos deben ser estrategias (Manual, Uniforme, Sesgada, Copiar o Pensar) \"\n else\n ml={}\n # Construyendo los mapas que permiten el control de la clase\n for i in mapa.keys\n ml=ml.merge({i =>0})\n end\n rond = {:Rounds => 0}\n @map=mapa\n @mapainicio=ml.merge(rond)\n @mapaactual=ml.merge(rond)\n\n estrategia1=@map[@map.keys[0]]\n estrategia2=@map[@map.keys[1]]\n \n #Se asignan los oponentes\n estrategia1.asignarOponente(estrategia2)\n estrategia2.asignarOponente(estrategia1)\n end\n else\n raise \"Deben haber dos estrategias (Manual, Uniforme, Sesgada, Copiar o Pensar)\"\n end\n end", "def relatorios\n end", "def datos_marca(reporte_marca = nil)\n datos_array = []\n datos_array[0] = \"#{ reporte_marca.marca_propia.nombre }\"\n datos_array[1] = \"#{ reporte_marca.marca_propia.tipo_signo.sigla if reporte_marca.marca_propia.tipo_signo }\"\n datos_array[2] = \"#{ reporte_marca.marca_propia.clase_id }\"\n datos_array[3] = \"#{ reporte_marca.marca_propia.numero_marca if reporte_marca.marca_propia.numero_marca }\"\n datos_array[4] = \"#{ I18n.l(reporte_marca.marca_propia.fecha_marca.to_date, :format => :short) if reporte_marca.marca_propia.fecha_marca}\"\n datos_array[5] = \"#{ reporte_marca.marca_propia.titulares.collect{|persona| persona.nombre}.join(\", \") }\"\n datos_array[6] = \"#{ reporte_marca.comentario }\"\n datos_array\n end", "def test_llama_atts\n @karl = Karl.new\n assert_equal(@karl.llama_atts[:llama_a], 6)\n @gus = Guspatcho.new\n assert_equal(@gus.llama_atts[:llama_d], 3)\n @lem = LemonyWinks.new\n assert_equal(@lem.llama_atts[:llama_h], 13)\n end", "def agencia\n self.agency\n end", "def initialize(nombre,alimentos,cantidad)\n super(nombre,alimentos,cantidad) # Llamada al contructor de la clase padre\n @emisiones_diarias = 0 # Variable para almacenar valor de efceto invernadero\n @metros_terreno = 0 # variable para almacenar valor del terreno\n end", "def index\n @mouzas = @block.mouzas\n @mouzas = @mouzas.map{|d| {id: d.id, name: d.name[@language]}}\n end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def attributes; end", "def cat_years\n #en este metodo calculamos la edad del gato.\n @age * CAT_YEARS\n end", "def datos_descarga(taxa)\n return unless taxa.any?\n self.taxones = []\n\n taxa.each do |taxon|\n self.taxon = taxon\n asigna_datos\n self.taxones << taxon\n end\n end", "def show_mano\n @mi_mano.sort_by{|k, v| v[:valor]}.to_h.map {|k, v| {k => {v[:numero] => v[:pinta]}} }\n end", "def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end", "def anular\n self.estado = Cancelacion::ESTADOS[:anulada]\n end", "def mc_cop_aae_alt_aae(row)\n #se copertura:arboreo,arbustivo ed erbaceo == 0, le altezze rispettive devono essere null [Presi singolarmente]\n #a meno che i parametri su cui fare il check siano nulli\n unless row.copertura_arboreo.nil? || row.copertura_arbustivo.nil? || row.copertura_erbaceo.nil?\n if row.copertura_arboreo == 0\n unless row.altezza_arboreo.nil?\n multiple_parameter_error(row,\"Copertura Arboreo = 0, Altezza Arboreo not null\")\n end\n end\n if row.copertura_arbustivo == 0\n unless row.altezza_arbustivo.nil?\n multiple_parameter_error(row,\"Copertura Arbustivo = 0, Altezza Arbustivo not null\")\n end\n end\n if row.copertura_erbaceo == 0\n unless row.altezza_erbaceo.nil?\n multiple_parameter_error(row,\"Copertura Erbaceo = 0, Altezza Erbaceo not null\")\n end\n end\n end\n end", "def formation; end", "def get_cout_ha_passages\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tsum += putoparcelle.pulve.get_cout_ha_passage_col(self)\n end\n sum\n end", "def artax\r\n a = [:punch, 0]\r\n b = [:kick, 72]\r\n c = [:stops_bullets_with_hands, false]\r\n key_value_pairs = # you can do this. you are a champion.\r\n # unlike Artax, who gave up in a swamp.\r\n [a,b,c]\r\n Hash[key_value_pairs]\r\n end" ]
[ "0.65920645", "0.61804634", "0.60283506", "0.59670466", "0.59558773", "0.5917663", "0.5875348", "0.584869", "0.58067334", "0.5750085", "0.5726463", "0.57190263", "0.5707834", "0.56836814", "0.56429607", "0.56264055", "0.5625946", "0.55977833", "0.55887204", "0.5569029", "0.55639917", "0.5563525", "0.5552492", "0.5532633", "0.5526211", "0.5513092", "0.54980665", "0.54864687", "0.5477056", "0.5455868", "0.5455868", "0.54527116", "0.54369986", "0.5426872", "0.54260135", "0.5409171", "0.54054284", "0.5392451", "0.5384484", "0.5382409", "0.53732175", "0.53701925", "0.5360341", "0.53555095", "0.5350154", "0.5337782", "0.5329594", "0.53290117", "0.53263414", "0.5316936", "0.53163785", "0.5315884", "0.5313007", "0.53092", "0.5306831", "0.5306653", "0.5299743", "0.5299743", "0.5293995", "0.52906775", "0.52872866", "0.52858204", "0.52700984", "0.52645236", "0.5249023", "0.5248228", "0.5242875", "0.5237544", "0.5230844", "0.52298695", "0.5221395", "0.52195257", "0.52157426", "0.521383", "0.5207887", "0.5202739", "0.5202173", "0.51981145", "0.51723796", "0.5170686", "0.51631963", "0.51618", "0.51618", "0.51618", "0.51618", "0.51618", "0.51618", "0.51618", "0.51618", "0.51618", "0.51618", "0.51618", "0.5153945", "0.5150013", "0.51486444", "0.5148319", "0.5143085", "0.5142903", "0.51413894", "0.5137717", "0.5136895" ]
0.0
-1
Get Balance Returns the satoshi balance, usd balance and user viewable balance for an address. For ERC20 tokens you need to pass in the contract ID and the number of decimal places.
def get_balance(coin_type, address, opts = {}) data, _status_code, _headers = get_balance_with_http_info(coin_type, address, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_balance(address)\n #res = get(\"addr/\"+address+\"?noCache=1\")\n #(res['balance'] + res['unconfirmedBalance']).to_BTCFloat\n get(\"addr/\"+address+\"?noCache=1\")['balance'].to_BTCFloat\n end", "def getBalance\n result = @driver.GetBalance(:ApiKey => @apikey)\n if result.getBalanceResult.errorCode == \"0\" then\n output = result.getBalanceResult.balance\n else\n output = result.getBalanceResult.errorMessage\n end\n return output\n end", "def balance(address)\n best_of('balance') do |api|\n api.balance(address)\n end\n end", "def get_balance(address, tag: 'latest')\n validate_address(address)\n validate_block_tag(tag)\n\n resp = conn.post do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = json_rpc(method: 'eth_getBalance', params: [address, tag]).to_json\n end\n resp_body = JSON.parse(resp.body)\n\n if resp_body['error']\n raise InfuraCallError.new(\n \"Error (#{resp_body['error']['code']}): Infura API call \"\\\n \"eth_getBalance gave message: '#{resp_body['error']['message']}'\"\n )\n else\n wei_amount_hex_string = resp_body['result']\n wei_amount_hex_string.to_i(16)\n end\n end", "def balance\n rest.get(:getbalance)['data']\n end", "def balance(account_name=nil)\n request('getbalance', account_name)\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://api.blockchair.com/bitcoin/dashboards/address').append(address).fragment(the_key)\n )['data'][address]\n if json.nil?\n @log.info(\"Address #{address} not found\")\n return 0\n end\n a = json['address']\n b = a['balance']\n @log.info(\"The balance of #{address} is #{b} satoshi\")\n b\n end", "def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end", "def get_balance(campaigns=[])\n api_call(\"GetBalance\",campaigns)\n end", "def balance(address)\n json = get_json(\"/rawaddr/#{address}\")\n info(\"Total transactions: #{json['n_tx']}\")\n info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def get_balance\n return balance\n end", "def balance\n wallet = Fyb.private.getaccinfo.perform.parse\n btc_label = 'btcBal'\n money_label = Fyb::Configuration.currency.to_s + 'Bal'\n\n btc = BigDecimal.new wallet[btc_label]\n real_money = BigDecimal.new wallet[money_label]\n\n { :btc => btc, Fyb::Configuration.currency => real_money }\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def balance(address)\n uri = Iri.new('https://chain.api.btc.com/v3/address').append(address).append('unspent')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n if json['err_no'] == 1\n @log.info(\"The balance of #{address} is zero (not found)\")\n return 0\n end\n data = json['data']\n if data.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n txns = data['list']\n if txns.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0\n @log.info(\"The balance of #{address} is #{balance}, total txns: #{txns.count}\")\n balance\n end", "def get_balance\n builder = Builder::XmlMarkup.new(indent: 2)\n builder.instruct! :xml, version: \"1.0\"\n builder.getUserBalance(company: @company)\n\n result = send_xml(builder.target!)\n\n source = XML::Parser.string(result)\n content = source.parse\n log(\"Content: #{content}\")\n\n if error = content.find_first('message')\n @errors = error.content.strip\n 0\n else\n # TODO: Check for other possible results in here\n return content.find_first('/userBalance').content.strip.to_f\n end\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/rawaddr/#{address}\")\n )\n @log.info(\"Total transactions: #{json['n_tx']}\")\n @log.info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance\n params = {'username' => ENV['ROCK_USERNAME'],\n\t\t 'password' => ENV['ROCK_PASSWORD'],\n 'api_key' => ENV['ROCK_KEY']}\n\n btc_balance = 0.0\n\tusd_balance = 0.0\n\n\tresponse = RestClient.post(\"https://www.therocktrading.com/api/get_balance\", params, {})\n\tr_json = JSON.parse(response)\n\tif (r_json.keys.include?(\"result\"))\n\t r_json[\"result\"].each do |currency|\n if currency[\"currency\"]==\"BTC\"\n \t btc_balance = currency[\"balance\"].to_f\n\t elsif currency[\"currency\"]==\"USD\"\n\t usd_balance = currency[\"balance\"].to_f\n end\n\t end\n \telse\n\t btc_balance = 0.0\n\t usd_balance = 0.0\n\tend\n return [btc_balance, usd_balance]\n end", "def balance\n # If in development, return a mocked amount\n return 1234 if Rails.env.development?\n\n # If in production, fetch the user's balance from Tab.\n @balance || begin\n headers = {\n \"Authorization\" => \"Token token=#{Rails.application.secrets.tab_api_key}\",\n \"Content-type\" => \"application/json\"\n }\n result = HTTParty.get(File.join(Rails.application.config.api_url, \"users\", \"#{name}.json\"), headers: headers)\n\n JSON.parse(result.body)[\"balance\"] if result.code == 200\n rescue StandardError # rubocop:disable Lint/SuppressedException\n end\n end", "def get_account_balance(account_id)\n query_api_object AccountBalance, \"/rest/accounts/#{account_id}/balance\"\n end", "def balance() @address.balance; end", "def getbalance(account = nil, minconf = 1)\n @api.request 'getbalance', account, minconf\n end", "def balance\n return @balance if @balance.present?\n\n result = api_customers_command\n\n @balance = [ result[:account_balance_in_btc_normalized], result[:account_balance_in_usd] ]\n end", "def balance(query = nil)\n Ledger::Balance.get(query)\n end", "def balance\n JSON.parse(response.body).fetch('balance')\n end", "def getbalance(account = nil, minconf = 1)\n coind.getbalance account, minconf\n end", "def balance(address)\n first_one do |api|\n api.balance(address)\n end\n end", "def get_balance(address = nil)\n outputs = get_unspent_outputs(address.nil? ? [] : [oa_address_to_address(address)])\n colored_outputs = outputs.map{|o|o.output}\n sorted_outputs = colored_outputs.sort_by { |o|o.script.to_string}\n groups = sorted_outputs.group_by{|o| o.script.to_string}\n result = groups.map{|k, v|\n btc_address = script_to_address(v[0].script)\n sorted_script_outputs = v.sort_by{|o|o.asset_id unless o.asset_id}\n group_assets = sorted_script_outputs.group_by{|o|o.asset_id}.select{|k,v| !k.nil?}\n assets = group_assets.map{|asset_id, outputs|\n {\n 'asset_id' => asset_id,\n 'quantity' => outputs.inject(0) { |sum, o| sum + o.asset_quantity }.to_s,\n 'amount' => outputs.inject(0) { |sum, o| sum + o.asset_amount }.to_s,\n 'asset_definition_url' => outputs[0].asset_definition_url,\n 'proof_of_authenticity' => outputs[0].proof_of_authenticity\n }\n }\n {\n 'address' => btc_address,\n 'oa_address' => (btc_address.nil? || btc_address.is_a?(Array)) ? nil : address_to_oa_address(btc_address),\n 'value' => satoshi_to_coin(v.inject(0) { |sum, o|sum + o.value}),\n 'assets' => assets,\n 'account' => v[0].account\n }\n }\n address.nil? ? result : result.select{|r|r['oa_address'] == address}\n end", "def getbalance(account = nil, minconf = 1)\n request :getbalance, account, minconf\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end", "def balance(_address)\n raise Sibit::NotSupportedError, 'balance() doesn\\'t work here'\n end", "def balance\n if @options[:verbose]\n warning = \"Coinbase doesn't provide a USD balance because\"\n warning << \" it connects to your bank account. Be careful, \"\n warning << \"because this will withdraw directly from your accounts\"\n warning << \"when you trade live.\"\n logger.warn warning\n end\n @balance ||= [max_float, max_float]\n end", "def get_balance\n\t\treturn @balance.balance\n\tend", "def account_balance\n balance = 0\n deposits.each {|deposit| balance += deposit.amount}\n\n transactions.each do |transaction|\n amount = transaction.price * transaction.num_shares\n transaction.order_type == 'BUY' ? balance -= amount : balance += amount\n end\n return balance.round(2)\n end", "def get_balance(hash160_or_addr, unconfirmed = false)\n if Bitcoin.valid_address?(hash160_or_addr)\n txouts = get_txouts_for_address(hash160_or_addr)\n else\n txouts = get_txouts_for_hash160(hash160_or_addr, :hash160, unconfirmed)\n end\n unspent = txouts.select {|o| o.get_next_in.nil?}\n unspent.map(&:value).inject {|a,b| a+=b; a} || 0\n rescue\n nil\n end", "def balances()\n request(\"#{@base_url}/account/getbalances\")\n end", "def get_ethereum_balance(eth_address)\n uri = URI.parse(\"https://etherchain.org/api/account/#{eth_address}\")\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n #FIX: only for this sample case, in production we would need to use proper PEM certificates here\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n\n json_response = JSON.parse(response.body)\n if(json_response[\"status\"] == 1 && !json_response[\"data\"][0].nil?) then\n return json_response[\"data\"][0][\"balance\"]\n else\n raise(\"error in ethereum balance request\")\n end\n\n\n end", "def get_account_balance\n submit GetAccountBalance.new\n end", "def balance_get(addrs, opts = {})\n data, _status_code, _headers = balance_get_with_http_info(addrs, opts)\n data\n end", "def balance(account)\n return balances[account] || infer_balance(account) # need to infer the balance if the account is not in ledger's output\n end", "def balance(currency)\n\t\treturn @balance[currency]\n\tend", "def balance\n if self.normal_balance.debit?\n self.amounts.balance\n elsif self.normal_balance.credit?\n - self.amounts.balance\n else\n nil\n end\n end", "def balance\n b = read_attribute(:balance)\n if User.current and User.current.currency\n b.to_d * User.current.currency.exchange_rate.to_d\n else\n b.to_d\n end\n end", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def return_balance(name)\n return find_account(name)[:balance]\n end", "def balance_of(address)\n payload = Base58.decode(address).to_s(16)\n public_key_hash = payload.slice(0, payload.length - 4)\n unspent_txs = unspent_transaction_outputs_of(public_key_hash)\n unspent_txs.reduce(0) { |sum, tx_out| sum + tx_out.value }\n end", "def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end", "def balance\n @client.balance(name)\n end", "def balance(known_balances = {})\n known_balances.has_key?(name) && known_balances[name] ||\n rpc.getbalance(name)\n end", "def balance(account)\n net_deposits(account) - net_withdraws(account)\n end", "def show_balance(user)\n puts \"Name: #{user.name}, balance: #{user.balance}, points: #{user.card_points}\"\n end", "def fetch_balance(address)\n address = address.address if address.is_a? PaymentAddress\n blockchain.native_currency.to_money_from_units(\n AbstractCommand.new(client).load_basic_balance(address)\n )\n end", "def balances\n accounts.with_balance\n end", "def address_balance address\n balance = call_blockchain_api(\"addressbalance/#{address}\")\n\n raise DogeCoin::InvalidAddress unless is_a_float?(balance)\n\n balance.to_f\n end", "def balance\n Money.new(\n Revenue.to_account(self).joins(:virtual_revenues).sum('\"virtual_revenues\".\"cents\"').to_i +\n Transfer.to_account(self).sum(:cents) - Transfer.from_account(self).sum(:cents) - \n Purchase.from_account(self).joins(:virtual_purchases).sum('\"virtual_purchases\".\"cents\"').to_i +\n self.initial_balance_in_cents\n )\n end", "def show_balance\n\t\t\treturn @balance\n\t\tend", "def get_marketplace_bank_account\n Balanced::BankAccount.find(\"/v1/bank_accounts/BAj6sNNBdMp5WmY6PJ7sAu3\")\n end", "def address_balance(address)\n total = $db.connection.execute(\n \"SELECT amount FROM wallet_transfers WHERE destination_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n spent_including_fees = $db.connection.execute(\n \"SELECT fee, amount FROM wallet_transfers WHERE from_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n total.to_i - spent_including_fees.to_i\n end", "def account\n AccountInfoParser.parse(post(\"balance\"))\n end", "def get_balance_with_http_info(coin_type, address, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AddressApi.get_balance ...'\n end\n # verify the required parameter 'coin_type' is set\n if @api_client.config.client_side_validation && coin_type.nil?\n fail ArgumentError, \"Missing the required parameter 'coin_type' when calling AddressApi.get_balance\"\n end\n # verify enum value\n allowable_values = [\"BITCOIN\", \"ETHEREUM\", \"TESTNET3\", \"BITCOIN_CASH\", \"BITCOIN_GOLD\", \"LITECOIN\", \"DASH\", \"DOGE\", \"BITCOIN_PRIVATE\", \"ZCASH\", \"ZCASH_TESTNET\", \"ZCLASSIC\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(coin_type)\n fail ArgumentError, \"invalid value for \\\"coin_type\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'address' is set\n if @api_client.config.client_side_validation && address.nil?\n fail ArgumentError, \"Missing the required parameter 'address' when calling AddressApi.get_balance\"\n end\n # resource path\n local_var_path = '/api/address/balance/{coin_type}/{address}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'address' + '}', CGI.escape(address.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'BalanceReply' \n\n # auth_names\n auth_names = opts[:auth_names] || ['ApiKeyAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AddressApi#get_balance\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def balance\n body = { action: \"balance\", key: @@access_key }\n post_request(body).to_i\n end", "def request_saas_to_get_balance\n params_for_get_balance_api = {\n address: @address,\n currencies: @currencies\n }\n\n saas_response = SaasApi::Token::GetBalance.new.perform(params_for_get_balance_api)\n return saas_response unless saas_response.success?\n\n @api_response_data[:balance] = saas_response.data\n\n success\n end", "def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end", "def balance\n res = dollars\n\n fund_transactions.each do |tran|\n res += tran.dollars\n end\n\n return res\n end", "def get_available_balance\n response = post 'GetAvailableBalance'\n balance = response[:body][:availableBalance]\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def balance(ending_at=nil)\n return @balance if !!@balance && !ending_at\n if ending_at\n balance_cents = self.transactions.sum(:cents,\n :conditions => [\"created_at < ? AND action NOT IN (?)\", ending_at, ['authorize', 'void']]\n )\n @balance = nil\n Money.new(balance_cents || 0, self.currency)\n else\n @balance = Money.new(self.cents, self.currency)\n end\n end", "def get_coin_balances(options = {})\n body = {\n cmd: \"balances\"\n }\n body[:all] = 1 if options[:all]\n post body\n end", "def invoice_balance\n BigDecimal.new(self.freshbooks_invoice['amount_outstanding']) rescue nil\n end", "def balance_for(account)\n @accounts[account]\n end", "def balance\n balance = 0.00\n @transactions.each do | transaction|\n balance += transaction[:amount]\n end\n return balance\n end", "def get_unconfirmed_balance(address, network = :bitcoin)\n return call_api_method(:get_unconfirmed_balance, network, address)\n end", "def account_balance\n @account_balance\n end", "def balance\n @accounts.values.first\n end", "def get_balance\n puts \"Current Balance: #{@balance}\"\n puts \"Current Interest: #{@interest}\"\n puts \"Current Payoff: #{@balance + @interest}\"\n puts\n end", "def combined_balance\n return @@response[\"combinedBalances\"][0][\"totalEquity\"]\n end", "def balance\n request_params = params.permit(:account_id)\n\n balance ||= Actions.new.balance(request_params['account_id'])\n\n return render status: balance[0], json: balance[1]\n end", "def balance\n\t\tbalance = 0.00\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\t\n\n\t\treturn balance\n\tend", "def balance\n @balance ||= starting_balance + transactions.inject(0) do |result, element|\n result + element.amount\n end\n end", "def getBalance(corpNum)\n if corpNum.length != 10\n raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')\n end\n\n begin\n @linkhub.getBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP, @useGAIP)\n rescue LinkhubException => le\n raise PopbillException.new(le.code, le.message)\n end\n end", "def balance\n self.all_benefits - self.all_pays\n end", "def balance\n return @balance\n end", "def balance\n return false unless Account.exists?(@account_id)\n\n Trade.where(account_id: @account_id).pluck(:amount).reduce(:+) || 0.0\n end", "def acc_balance\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.to_f\n end", "def balance\n credit = FineBalance.sum('AMOUNT', :conditions=>{:INCURRED_ID=>self.CHARGE_INCURRED_ID})\n return self.AMOUNT-credit\n end", "def add_bank_account\n\n get_balanced_key\n\n account_uri = params[:account_uri]\n company_name = \"Mindfire Solutions\"\n\n ##You can set your customer business / company name here \n customer = Balanced::Customer.new({name: company_name}).save\n customer_uri = customer.href\n get_customer = Balanced::Customer.fetch(customer_uri)\n \n bank_account = Balanced::BankAccount.fetch(account_uri)\n bank_account.associate_to_customer(customer_uri)\n \n ##befor debiting your customer you need to verify their bank account as per balanced payment\n bank_account = Balanced::BankAccount.fetch(account_uri)\n verify_bank_account = bank_account.verify\n verification = Balanced::BankAccountVerification.fetch(verify_bank_account.href)\n verification.confirm(\n amount_1 = 1,\n amount_2 = 1\n )\n \n amount_in_dollars = params[:amount].to_i\n #amount_in_dollars * 100 convert into cents\n debit = bank_account.debit(:amount => amount_in_dollars * 100, appears_on_statement_as: \"Debit Amount\")\n \n ##You can save the response in your db for future use\n #debit.transaction_number\n #debit.amount\n #debit.statusdebit.created_at\n \n #get your balanced marketplace\n marketplace = Balanced::Marketplace.my_marketplace\n \n credit = get_marketplace_bank_account.credit(:amount => debit.amount, appears_on_statement_as: \"Credit Amount\")\n\n \n return render json: {success: [\"Debit Transaction:: #{debit.attributes}\", \"Credit Transaction:: #{credit.attributes}\"] }\n\n end", "def getaccount(bitcoinaddress)\n @api.request 'getaccount', bitcoinaddress\n end", "def balance\n @balance\n end", "def balance(account_id)\n balances.by_pk(account_id).one!\n end", "def get_balances_with_http_info(coin_type, addresses, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AddressApi.get_balances ...'\n end\n # verify the required parameter 'coin_type' is set\n if @api_client.config.client_side_validation && coin_type.nil?\n fail ArgumentError, \"Missing the required parameter 'coin_type' when calling AddressApi.get_balances\"\n end\n # verify enum value\n allowable_values = [\"BITCOIN\", \"ETHEREUM\", \"TESTNET3\", \"BITCOIN_CASH\", \"BITCOIN_GOLD\", \"LITECOIN\", \"DASH\", \"DOGE\", \"BITCOIN_PRIVATE\", \"ZCASH\", \"ZCASH_TESTNET\", \"ZCLASSIC\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(coin_type)\n fail ArgumentError, \"invalid value for \\\"coin_type\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'addresses' is set\n if @api_client.config.client_side_validation && addresses.nil?\n fail ArgumentError, \"Missing the required parameter 'addresses' when calling AddressApi.get_balances\"\n end\n if @api_client.config.client_side_validation && addresses.length < 1\n fail ArgumentError, 'invalid value for \"addresses\" when calling AddressApi.get_balances, number of items must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/api/address/balances/{coin_type}/{addresses}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'addresses' + '}', CGI.escape(addresses.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'BalancesReply' \n\n # auth_names\n auth_names = opts[:auth_names] || ['ApiKeyAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AddressApi#get_balances\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_balance (opts={})\n query_param_keys = []\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n \n }.merge(opts)\n\n #resource path\n path = \"/get-balance.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end", "def get_card_balance_using_get(id, opts = {})\n data, _status_code, _headers = get_card_balance_using_get_with_http_info(id, opts)\n data\n end", "def get_currency_balance_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CurrencyBalanceApi.get_currency_balance_all_using_get ...'\n end\n # resource path\n local_var_path = '/currency_balance'\n\n # query parameters\n query_params = {}\n query_params[:'wallet_id'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'currency_id'] = opts[:'currency_id'] if !opts[:'currency_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCurrencyBalanceResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CurrencyBalanceApi#get_currency_balance_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def balance #same as attr_reader :balance\n @balance\n end", "def balance\n\t\tbalance = 0\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\n\t\treturn balance\n\tend", "def get_points_balance opts={}\n make_get_points_balance_call opts\n end", "def balance_btc_ui\n balance_btc.to_f * 10 ** -8\n end", "def deposit_address(currency = 'XBt')\n get 'depositAddress', currency: currency do |response|\n raise response.body unless response.success?\n\n response.to_s\n end\n end", "def balances\n return @balances_hash if @balances_hash\n ledger_balances = cmd 'bal --balance-format \"%A | %(display_total)\\n\"'\n @balances_hash = Hash[*(ledger_balances.split(\"\\n\")).map{|line| parse_account_line(line)}.flatten]\n end", "def actual_balance\n if previous.present?\n previous.balance_amount_with_sign\n else\n 0\n end\n end" ]
[ "0.7314825", "0.7064698", "0.7058756", "0.7047591", "0.70419425", "0.6912272", "0.6876645", "0.6855768", "0.6848979", "0.6766944", "0.6706207", "0.6704455", "0.6694413", "0.6686138", "0.66808015", "0.6654461", "0.6653663", "0.66328526", "0.66308385", "0.66022456", "0.65820444", "0.65621036", "0.6539962", "0.6477837", "0.6476664", "0.6456645", "0.6440519", "0.64378726", "0.64056957", "0.6403398", "0.6355098", "0.63482845", "0.6345755", "0.63343287", "0.6301828", "0.6277561", "0.62492555", "0.6244505", "0.6236371", "0.62316394", "0.622302", "0.6217745", "0.62101996", "0.62075675", "0.62069964", "0.61725336", "0.6166313", "0.6129686", "0.612864", "0.6117661", "0.6099715", "0.6073449", "0.6051757", "0.6042924", "0.6042714", "0.6041218", "0.6035549", "0.6020499", "0.6009009", "0.59800816", "0.59717965", "0.59505874", "0.5933324", "0.593135", "0.5890422", "0.5890422", "0.58836496", "0.58781606", "0.58760715", "0.5871868", "0.5857858", "0.583166", "0.58264256", "0.5819584", "0.581113", "0.5810974", "0.5805559", "0.57955873", "0.57876605", "0.577459", "0.5771681", "0.5736625", "0.5731811", "0.5721848", "0.5713527", "0.57112736", "0.5683848", "0.5680882", "0.5670402", "0.5646752", "0.5637737", "0.56336665", "0.56294113", "0.5616385", "0.5614607", "0.56032264", "0.5596593", "0.55911547", "0.5591125", "0.55840313" ]
0.6409655
28
Get Balance Returns the satoshi balance, usd balance and user viewable balance for an address. For ERC20 tokens you need to pass in the contract ID and the number of decimal places.
def get_balance_with_http_info(coin_type, address, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddressApi.get_balance ...' end # verify the required parameter 'coin_type' is set if @api_client.config.client_side_validation && coin_type.nil? fail ArgumentError, "Missing the required parameter 'coin_type' when calling AddressApi.get_balance" end # verify enum value allowable_values = ["BITCOIN", "ETHEREUM", "TESTNET3", "BITCOIN_CASH", "BITCOIN_GOLD", "LITECOIN", "DASH", "DOGE", "BITCOIN_PRIVATE", "ZCASH", "ZCASH_TESTNET", "ZCLASSIC"] if @api_client.config.client_side_validation && !allowable_values.include?(coin_type) fail ArgumentError, "invalid value for \"coin_type\", must be one of #{allowable_values}" end # verify the required parameter 'address' is set if @api_client.config.client_side_validation && address.nil? fail ArgumentError, "Missing the required parameter 'address' when calling AddressApi.get_balance" end # resource path local_var_path = '/api/address/balance/{coin_type}/{address}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'address' + '}', CGI.escape(address.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'BalanceReply' # auth_names auth_names = opts[:auth_names] || ['ApiKeyAuth'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AddressApi#get_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_balance(address)\n #res = get(\"addr/\"+address+\"?noCache=1\")\n #(res['balance'] + res['unconfirmedBalance']).to_BTCFloat\n get(\"addr/\"+address+\"?noCache=1\")['balance'].to_BTCFloat\n end", "def getBalance\n result = @driver.GetBalance(:ApiKey => @apikey)\n if result.getBalanceResult.errorCode == \"0\" then\n output = result.getBalanceResult.balance\n else\n output = result.getBalanceResult.errorMessage\n end\n return output\n end", "def balance(address)\n best_of('balance') do |api|\n api.balance(address)\n end\n end", "def get_balance(address, tag: 'latest')\n validate_address(address)\n validate_block_tag(tag)\n\n resp = conn.post do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = json_rpc(method: 'eth_getBalance', params: [address, tag]).to_json\n end\n resp_body = JSON.parse(resp.body)\n\n if resp_body['error']\n raise InfuraCallError.new(\n \"Error (#{resp_body['error']['code']}): Infura API call \"\\\n \"eth_getBalance gave message: '#{resp_body['error']['message']}'\"\n )\n else\n wei_amount_hex_string = resp_body['result']\n wei_amount_hex_string.to_i(16)\n end\n end", "def balance\n rest.get(:getbalance)['data']\n end", "def balance(account_name=nil)\n request('getbalance', account_name)\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://api.blockchair.com/bitcoin/dashboards/address').append(address).fragment(the_key)\n )['data'][address]\n if json.nil?\n @log.info(\"Address #{address} not found\")\n return 0\n end\n a = json['address']\n b = a['balance']\n @log.info(\"The balance of #{address} is #{b} satoshi\")\n b\n end", "def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end", "def get_balance(campaigns=[])\n api_call(\"GetBalance\",campaigns)\n end", "def balance(address)\n json = get_json(\"/rawaddr/#{address}\")\n info(\"Total transactions: #{json['n_tx']}\")\n info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def get_balance\n return balance\n end", "def balance\n wallet = Fyb.private.getaccinfo.perform.parse\n btc_label = 'btcBal'\n money_label = Fyb::Configuration.currency.to_s + 'Bal'\n\n btc = BigDecimal.new wallet[btc_label]\n real_money = BigDecimal.new wallet[money_label]\n\n { :btc => btc, Fyb::Configuration.currency => real_money }\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def balance(address)\n uri = Iri.new('https://chain.api.btc.com/v3/address').append(address).append('unspent')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n if json['err_no'] == 1\n @log.info(\"The balance of #{address} is zero (not found)\")\n return 0\n end\n data = json['data']\n if data.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n txns = data['list']\n if txns.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0\n @log.info(\"The balance of #{address} is #{balance}, total txns: #{txns.count}\")\n balance\n end", "def get_balance\n builder = Builder::XmlMarkup.new(indent: 2)\n builder.instruct! :xml, version: \"1.0\"\n builder.getUserBalance(company: @company)\n\n result = send_xml(builder.target!)\n\n source = XML::Parser.string(result)\n content = source.parse\n log(\"Content: #{content}\")\n\n if error = content.find_first('message')\n @errors = error.content.strip\n 0\n else\n # TODO: Check for other possible results in here\n return content.find_first('/userBalance').content.strip.to_f\n end\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/rawaddr/#{address}\")\n )\n @log.info(\"Total transactions: #{json['n_tx']}\")\n @log.info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance\n params = {'username' => ENV['ROCK_USERNAME'],\n\t\t 'password' => ENV['ROCK_PASSWORD'],\n 'api_key' => ENV['ROCK_KEY']}\n\n btc_balance = 0.0\n\tusd_balance = 0.0\n\n\tresponse = RestClient.post(\"https://www.therocktrading.com/api/get_balance\", params, {})\n\tr_json = JSON.parse(response)\n\tif (r_json.keys.include?(\"result\"))\n\t r_json[\"result\"].each do |currency|\n if currency[\"currency\"]==\"BTC\"\n \t btc_balance = currency[\"balance\"].to_f\n\t elsif currency[\"currency\"]==\"USD\"\n\t usd_balance = currency[\"balance\"].to_f\n end\n\t end\n \telse\n\t btc_balance = 0.0\n\t usd_balance = 0.0\n\tend\n return [btc_balance, usd_balance]\n end", "def balance\n # If in development, return a mocked amount\n return 1234 if Rails.env.development?\n\n # If in production, fetch the user's balance from Tab.\n @balance || begin\n headers = {\n \"Authorization\" => \"Token token=#{Rails.application.secrets.tab_api_key}\",\n \"Content-type\" => \"application/json\"\n }\n result = HTTParty.get(File.join(Rails.application.config.api_url, \"users\", \"#{name}.json\"), headers: headers)\n\n JSON.parse(result.body)[\"balance\"] if result.code == 200\n rescue StandardError # rubocop:disable Lint/SuppressedException\n end\n end", "def get_account_balance(account_id)\n query_api_object AccountBalance, \"/rest/accounts/#{account_id}/balance\"\n end", "def balance() @address.balance; end", "def getbalance(account = nil, minconf = 1)\n @api.request 'getbalance', account, minconf\n end", "def balance\n return @balance if @balance.present?\n\n result = api_customers_command\n\n @balance = [ result[:account_balance_in_btc_normalized], result[:account_balance_in_usd] ]\n end", "def balance(query = nil)\n Ledger::Balance.get(query)\n end", "def balance\n JSON.parse(response.body).fetch('balance')\n end", "def getbalance(account = nil, minconf = 1)\n coind.getbalance account, minconf\n end", "def balance(address)\n first_one do |api|\n api.balance(address)\n end\n end", "def get_balance(address = nil)\n outputs = get_unspent_outputs(address.nil? ? [] : [oa_address_to_address(address)])\n colored_outputs = outputs.map{|o|o.output}\n sorted_outputs = colored_outputs.sort_by { |o|o.script.to_string}\n groups = sorted_outputs.group_by{|o| o.script.to_string}\n result = groups.map{|k, v|\n btc_address = script_to_address(v[0].script)\n sorted_script_outputs = v.sort_by{|o|o.asset_id unless o.asset_id}\n group_assets = sorted_script_outputs.group_by{|o|o.asset_id}.select{|k,v| !k.nil?}\n assets = group_assets.map{|asset_id, outputs|\n {\n 'asset_id' => asset_id,\n 'quantity' => outputs.inject(0) { |sum, o| sum + o.asset_quantity }.to_s,\n 'amount' => outputs.inject(0) { |sum, o| sum + o.asset_amount }.to_s,\n 'asset_definition_url' => outputs[0].asset_definition_url,\n 'proof_of_authenticity' => outputs[0].proof_of_authenticity\n }\n }\n {\n 'address' => btc_address,\n 'oa_address' => (btc_address.nil? || btc_address.is_a?(Array)) ? nil : address_to_oa_address(btc_address),\n 'value' => satoshi_to_coin(v.inject(0) { |sum, o|sum + o.value}),\n 'assets' => assets,\n 'account' => v[0].account\n }\n }\n address.nil? ? result : result.select{|r|r['oa_address'] == address}\n end", "def getbalance(account = nil, minconf = 1)\n request :getbalance, account, minconf\n end", "def get_balance(coin_type, address, opts = {})\n data, _status_code, _headers = get_balance_with_http_info(coin_type, address, opts)\n data\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end", "def balance(_address)\n raise Sibit::NotSupportedError, 'balance() doesn\\'t work here'\n end", "def balance\n if @options[:verbose]\n warning = \"Coinbase doesn't provide a USD balance because\"\n warning << \" it connects to your bank account. Be careful, \"\n warning << \"because this will withdraw directly from your accounts\"\n warning << \"when you trade live.\"\n logger.warn warning\n end\n @balance ||= [max_float, max_float]\n end", "def get_balance\n\t\treturn @balance.balance\n\tend", "def account_balance\n balance = 0\n deposits.each {|deposit| balance += deposit.amount}\n\n transactions.each do |transaction|\n amount = transaction.price * transaction.num_shares\n transaction.order_type == 'BUY' ? balance -= amount : balance += amount\n end\n return balance.round(2)\n end", "def get_balance(hash160_or_addr, unconfirmed = false)\n if Bitcoin.valid_address?(hash160_or_addr)\n txouts = get_txouts_for_address(hash160_or_addr)\n else\n txouts = get_txouts_for_hash160(hash160_or_addr, :hash160, unconfirmed)\n end\n unspent = txouts.select {|o| o.get_next_in.nil?}\n unspent.map(&:value).inject {|a,b| a+=b; a} || 0\n rescue\n nil\n end", "def balances()\n request(\"#{@base_url}/account/getbalances\")\n end", "def get_ethereum_balance(eth_address)\n uri = URI.parse(\"https://etherchain.org/api/account/#{eth_address}\")\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n #FIX: only for this sample case, in production we would need to use proper PEM certificates here\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n\n json_response = JSON.parse(response.body)\n if(json_response[\"status\"] == 1 && !json_response[\"data\"][0].nil?) then\n return json_response[\"data\"][0][\"balance\"]\n else\n raise(\"error in ethereum balance request\")\n end\n\n\n end", "def get_account_balance\n submit GetAccountBalance.new\n end", "def balance_get(addrs, opts = {})\n data, _status_code, _headers = balance_get_with_http_info(addrs, opts)\n data\n end", "def balance(account)\n return balances[account] || infer_balance(account) # need to infer the balance if the account is not in ledger's output\n end", "def balance(currency)\n\t\treturn @balance[currency]\n\tend", "def balance\n if self.normal_balance.debit?\n self.amounts.balance\n elsif self.normal_balance.credit?\n - self.amounts.balance\n else\n nil\n end\n end", "def balance\n b = read_attribute(:balance)\n if User.current and User.current.currency\n b.to_d * User.current.currency.exchange_rate.to_d\n else\n b.to_d\n end\n end", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def return_balance(name)\n return find_account(name)[:balance]\n end", "def balance_of(address)\n payload = Base58.decode(address).to_s(16)\n public_key_hash = payload.slice(0, payload.length - 4)\n unspent_txs = unspent_transaction_outputs_of(public_key_hash)\n unspent_txs.reduce(0) { |sum, tx_out| sum + tx_out.value }\n end", "def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end", "def balance\n @client.balance(name)\n end", "def balance(known_balances = {})\n known_balances.has_key?(name) && known_balances[name] ||\n rpc.getbalance(name)\n end", "def balance(account)\n net_deposits(account) - net_withdraws(account)\n end", "def show_balance(user)\n puts \"Name: #{user.name}, balance: #{user.balance}, points: #{user.card_points}\"\n end", "def fetch_balance(address)\n address = address.address if address.is_a? PaymentAddress\n blockchain.native_currency.to_money_from_units(\n AbstractCommand.new(client).load_basic_balance(address)\n )\n end", "def balances\n accounts.with_balance\n end", "def address_balance address\n balance = call_blockchain_api(\"addressbalance/#{address}\")\n\n raise DogeCoin::InvalidAddress unless is_a_float?(balance)\n\n balance.to_f\n end", "def balance\n Money.new(\n Revenue.to_account(self).joins(:virtual_revenues).sum('\"virtual_revenues\".\"cents\"').to_i +\n Transfer.to_account(self).sum(:cents) - Transfer.from_account(self).sum(:cents) - \n Purchase.from_account(self).joins(:virtual_purchases).sum('\"virtual_purchases\".\"cents\"').to_i +\n self.initial_balance_in_cents\n )\n end", "def show_balance\n\t\t\treturn @balance\n\t\tend", "def get_marketplace_bank_account\n Balanced::BankAccount.find(\"/v1/bank_accounts/BAj6sNNBdMp5WmY6PJ7sAu3\")\n end", "def address_balance(address)\n total = $db.connection.execute(\n \"SELECT amount FROM wallet_transfers WHERE destination_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n spent_including_fees = $db.connection.execute(\n \"SELECT fee, amount FROM wallet_transfers WHERE from_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n total.to_i - spent_including_fees.to_i\n end", "def account\n AccountInfoParser.parse(post(\"balance\"))\n end", "def balance\n body = { action: \"balance\", key: @@access_key }\n post_request(body).to_i\n end", "def request_saas_to_get_balance\n params_for_get_balance_api = {\n address: @address,\n currencies: @currencies\n }\n\n saas_response = SaasApi::Token::GetBalance.new.perform(params_for_get_balance_api)\n return saas_response unless saas_response.success?\n\n @api_response_data[:balance] = saas_response.data\n\n success\n end", "def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end", "def balance\n res = dollars\n\n fund_transactions.each do |tran|\n res += tran.dollars\n end\n\n return res\n end", "def get_available_balance\n response = post 'GetAvailableBalance'\n balance = response[:body][:availableBalance]\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def balance(ending_at=nil)\n return @balance if !!@balance && !ending_at\n if ending_at\n balance_cents = self.transactions.sum(:cents,\n :conditions => [\"created_at < ? AND action NOT IN (?)\", ending_at, ['authorize', 'void']]\n )\n @balance = nil\n Money.new(balance_cents || 0, self.currency)\n else\n @balance = Money.new(self.cents, self.currency)\n end\n end", "def get_coin_balances(options = {})\n body = {\n cmd: \"balances\"\n }\n body[:all] = 1 if options[:all]\n post body\n end", "def invoice_balance\n BigDecimal.new(self.freshbooks_invoice['amount_outstanding']) rescue nil\n end", "def balance_for(account)\n @accounts[account]\n end", "def balance\n balance = 0.00\n @transactions.each do | transaction|\n balance += transaction[:amount]\n end\n return balance\n end", "def get_unconfirmed_balance(address, network = :bitcoin)\n return call_api_method(:get_unconfirmed_balance, network, address)\n end", "def account_balance\n @account_balance\n end", "def balance\n @accounts.values.first\n end", "def get_balance\n puts \"Current Balance: #{@balance}\"\n puts \"Current Interest: #{@interest}\"\n puts \"Current Payoff: #{@balance + @interest}\"\n puts\n end", "def combined_balance\n return @@response[\"combinedBalances\"][0][\"totalEquity\"]\n end", "def balance\n request_params = params.permit(:account_id)\n\n balance ||= Actions.new.balance(request_params['account_id'])\n\n return render status: balance[0], json: balance[1]\n end", "def balance\n\t\tbalance = 0.00\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\t\n\n\t\treturn balance\n\tend", "def balance\n @balance ||= starting_balance + transactions.inject(0) do |result, element|\n result + element.amount\n end\n end", "def getBalance(corpNum)\n if corpNum.length != 10\n raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')\n end\n\n begin\n @linkhub.getBalance(getSession_Token(corpNum), getServiceID(), @useStaticIP, @useGAIP)\n rescue LinkhubException => le\n raise PopbillException.new(le.code, le.message)\n end\n end", "def balance\n self.all_benefits - self.all_pays\n end", "def balance\n return @balance\n end", "def balance\n return false unless Account.exists?(@account_id)\n\n Trade.where(account_id: @account_id).pluck(:amount).reduce(:+) || 0.0\n end", "def acc_balance\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.to_f\n end", "def balance\n credit = FineBalance.sum('AMOUNT', :conditions=>{:INCURRED_ID=>self.CHARGE_INCURRED_ID})\n return self.AMOUNT-credit\n end", "def add_bank_account\n\n get_balanced_key\n\n account_uri = params[:account_uri]\n company_name = \"Mindfire Solutions\"\n\n ##You can set your customer business / company name here \n customer = Balanced::Customer.new({name: company_name}).save\n customer_uri = customer.href\n get_customer = Balanced::Customer.fetch(customer_uri)\n \n bank_account = Balanced::BankAccount.fetch(account_uri)\n bank_account.associate_to_customer(customer_uri)\n \n ##befor debiting your customer you need to verify their bank account as per balanced payment\n bank_account = Balanced::BankAccount.fetch(account_uri)\n verify_bank_account = bank_account.verify\n verification = Balanced::BankAccountVerification.fetch(verify_bank_account.href)\n verification.confirm(\n amount_1 = 1,\n amount_2 = 1\n )\n \n amount_in_dollars = params[:amount].to_i\n #amount_in_dollars * 100 convert into cents\n debit = bank_account.debit(:amount => amount_in_dollars * 100, appears_on_statement_as: \"Debit Amount\")\n \n ##You can save the response in your db for future use\n #debit.transaction_number\n #debit.amount\n #debit.statusdebit.created_at\n \n #get your balanced marketplace\n marketplace = Balanced::Marketplace.my_marketplace\n \n credit = get_marketplace_bank_account.credit(:amount => debit.amount, appears_on_statement_as: \"Credit Amount\")\n\n \n return render json: {success: [\"Debit Transaction:: #{debit.attributes}\", \"Credit Transaction:: #{credit.attributes}\"] }\n\n end", "def getaccount(bitcoinaddress)\n @api.request 'getaccount', bitcoinaddress\n end", "def balance\n @balance\n end", "def balance(account_id)\n balances.by_pk(account_id).one!\n end", "def get_balances_with_http_info(coin_type, addresses, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AddressApi.get_balances ...'\n end\n # verify the required parameter 'coin_type' is set\n if @api_client.config.client_side_validation && coin_type.nil?\n fail ArgumentError, \"Missing the required parameter 'coin_type' when calling AddressApi.get_balances\"\n end\n # verify enum value\n allowable_values = [\"BITCOIN\", \"ETHEREUM\", \"TESTNET3\", \"BITCOIN_CASH\", \"BITCOIN_GOLD\", \"LITECOIN\", \"DASH\", \"DOGE\", \"BITCOIN_PRIVATE\", \"ZCASH\", \"ZCASH_TESTNET\", \"ZCLASSIC\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(coin_type)\n fail ArgumentError, \"invalid value for \\\"coin_type\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'addresses' is set\n if @api_client.config.client_side_validation && addresses.nil?\n fail ArgumentError, \"Missing the required parameter 'addresses' when calling AddressApi.get_balances\"\n end\n if @api_client.config.client_side_validation && addresses.length < 1\n fail ArgumentError, 'invalid value for \"addresses\" when calling AddressApi.get_balances, number of items must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/api/address/balances/{coin_type}/{addresses}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'addresses' + '}', CGI.escape(addresses.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'BalancesReply' \n\n # auth_names\n auth_names = opts[:auth_names] || ['ApiKeyAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AddressApi#get_balances\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_balance (opts={})\n query_param_keys = []\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n \n }.merge(opts)\n\n #resource path\n path = \"/get-balance.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end", "def get_card_balance_using_get(id, opts = {})\n data, _status_code, _headers = get_card_balance_using_get_with_http_info(id, opts)\n data\n end", "def get_currency_balance_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CurrencyBalanceApi.get_currency_balance_all_using_get ...'\n end\n # resource path\n local_var_path = '/currency_balance'\n\n # query parameters\n query_params = {}\n query_params[:'wallet_id'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'currency_id'] = opts[:'currency_id'] if !opts[:'currency_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCurrencyBalanceResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CurrencyBalanceApi#get_currency_balance_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def balance #same as attr_reader :balance\n @balance\n end", "def balance\n\t\tbalance = 0\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\n\t\treturn balance\n\tend", "def get_points_balance opts={}\n make_get_points_balance_call opts\n end", "def balance_btc_ui\n balance_btc.to_f * 10 ** -8\n end", "def deposit_address(currency = 'XBt')\n get 'depositAddress', currency: currency do |response|\n raise response.body unless response.success?\n\n response.to_s\n end\n end", "def balances\n return @balances_hash if @balances_hash\n ledger_balances = cmd 'bal --balance-format \"%A | %(display_total)\\n\"'\n @balances_hash = Hash[*(ledger_balances.split(\"\\n\")).map{|line| parse_account_line(line)}.flatten]\n end", "def actual_balance\n if previous.present?\n previous.balance_amount_with_sign\n else\n 0\n end\n end" ]
[ "0.7314825", "0.7064698", "0.7058756", "0.7047591", "0.70419425", "0.6912272", "0.6876645", "0.6855768", "0.6848979", "0.6766944", "0.6706207", "0.6704455", "0.6694413", "0.6686138", "0.66808015", "0.6654461", "0.6653663", "0.66328526", "0.66308385", "0.66022456", "0.65820444", "0.65621036", "0.6539962", "0.6477837", "0.6476664", "0.6456645", "0.6440519", "0.64378726", "0.6409655", "0.64056957", "0.6403398", "0.6355098", "0.63482845", "0.6345755", "0.63343287", "0.6301828", "0.6277561", "0.62492555", "0.6244505", "0.6236371", "0.62316394", "0.622302", "0.6217745", "0.62101996", "0.62075675", "0.62069964", "0.61725336", "0.6166313", "0.6129686", "0.612864", "0.6117661", "0.6099715", "0.6073449", "0.6051757", "0.6042924", "0.6042714", "0.6041218", "0.6035549", "0.6020499", "0.59800816", "0.59717965", "0.59505874", "0.5933324", "0.593135", "0.5890422", "0.5890422", "0.58836496", "0.58781606", "0.58760715", "0.5871868", "0.5857858", "0.583166", "0.58264256", "0.5819584", "0.581113", "0.5810974", "0.5805559", "0.57955873", "0.57876605", "0.577459", "0.5771681", "0.5736625", "0.5731811", "0.5721848", "0.5713527", "0.57112736", "0.5683848", "0.5680882", "0.5670402", "0.5646752", "0.5637737", "0.56336665", "0.56294113", "0.5616385", "0.5614607", "0.56032264", "0.5596593", "0.55911547", "0.5591125", "0.55840313" ]
0.6009009
59
Get Balances Returns the satoshi balance, usd balance and user viewable balance for a set of addresses.
def get_balances(coin_type, addresses, opts = {}) data, _status_code, _headers = get_balances_with_http_info(coin_type, addresses, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def balances()\n request(\"#{@base_url}/account/getbalances\")\n end", "def balances\n accounts.with_balance\n end", "def get_balance(campaigns=[])\n api_call(\"GetBalance\",campaigns)\n end", "def balance_get(addrs, opts = {})\n data, _status_code, _headers = balance_get_with_http_info(addrs, opts)\n data\n end", "def balances\n # Very inefficient at this point for a large network...\n self.network_as_users.map { |user|\n {:balance => self.balance_with(user), :user => user}\n }.select {|balance| balance[:balance].to_f != 0.0}\n end", "def get_coin_balances(options = {})\n body = {\n cmd: \"balances\"\n }\n body[:all] = 1 if options[:all]\n post body\n end", "def all_wallet_balances\n\t\ttotals = Hash.new {|h,uuid| h[uuid] = 0 }\n\t\ttotals[ GENESIS_WALLET ] = INITIAL_AMOUNT\n\n\t\tself.each_block do |block|\n\t\t\tblock.transactions.each do |tr|\n\t\t\t\ttotals[ tr[:to] ] += tr[:amount]\n\t\t\t\ttotals[ tr[:from] ] -= tr[:amount]\n\t\t\tend\n\t\tend\n\n\t\treturn totals.transform_values {|val| Money.new(val, :zmz) }\n\tend", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def get_balance(address = nil)\n outputs = get_unspent_outputs(address.nil? ? [] : [oa_address_to_address(address)])\n colored_outputs = outputs.map{|o|o.output}\n sorted_outputs = colored_outputs.sort_by { |o|o.script.to_string}\n groups = sorted_outputs.group_by{|o| o.script.to_string}\n result = groups.map{|k, v|\n btc_address = script_to_address(v[0].script)\n sorted_script_outputs = v.sort_by{|o|o.asset_id unless o.asset_id}\n group_assets = sorted_script_outputs.group_by{|o|o.asset_id}.select{|k,v| !k.nil?}\n assets = group_assets.map{|asset_id, outputs|\n {\n 'asset_id' => asset_id,\n 'quantity' => outputs.inject(0) { |sum, o| sum + o.asset_quantity }.to_s,\n 'amount' => outputs.inject(0) { |sum, o| sum + o.asset_amount }.to_s,\n 'asset_definition_url' => outputs[0].asset_definition_url,\n 'proof_of_authenticity' => outputs[0].proof_of_authenticity\n }\n }\n {\n 'address' => btc_address,\n 'oa_address' => (btc_address.nil? || btc_address.is_a?(Array)) ? nil : address_to_oa_address(btc_address),\n 'value' => satoshi_to_coin(v.inject(0) { |sum, o|sum + o.value}),\n 'assets' => assets,\n 'account' => v[0].account\n }\n }\n address.nil? ? result : result.select{|r|r['oa_address'] == address}\n end", "def balances\n return @balances_hash if @balances_hash\n ledger_balances = cmd 'bal --balance-format \"%A | %(display_total)\\n\"'\n @balances_hash = Hash[*(ledger_balances.split(\"\\n\")).map{|line| parse_account_line(line)}.flatten]\n end", "def balance(address)\n best_of('balance') do |api|\n api.balance(address)\n end\n end", "def balance\n return @balance if @balance.present?\n\n result = api_customers_command\n\n @balance = [ result[:account_balance_in_btc_normalized], result[:account_balance_in_usd] ]\n end", "def get_balance(address)\n #res = get(\"addr/\"+address+\"?noCache=1\")\n #(res['balance'] + res['unconfirmedBalance']).to_BTCFloat\n get(\"addr/\"+address+\"?noCache=1\")['balance'].to_BTCFloat\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def balance(address)\n json = get_json(\"/rawaddr/#{address}\")\n info(\"Total transactions: #{json['n_tx']}\")\n info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance(address)\n uri = Iri.new('https://chain.api.btc.com/v3/address').append(address).append('unspent')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n if json['err_no'] == 1\n @log.info(\"The balance of #{address} is zero (not found)\")\n return 0\n end\n data = json['data']\n if data.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n txns = data['list']\n if txns.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0\n @log.info(\"The balance of #{address} is #{balance}, total txns: #{txns.count}\")\n balance\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def balance\n rest.get(:getbalance)['data']\n end", "def get_balances_with_http_info(coin_type, addresses, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AddressApi.get_balances ...'\n end\n # verify the required parameter 'coin_type' is set\n if @api_client.config.client_side_validation && coin_type.nil?\n fail ArgumentError, \"Missing the required parameter 'coin_type' when calling AddressApi.get_balances\"\n end\n # verify enum value\n allowable_values = [\"BITCOIN\", \"ETHEREUM\", \"TESTNET3\", \"BITCOIN_CASH\", \"BITCOIN_GOLD\", \"LITECOIN\", \"DASH\", \"DOGE\", \"BITCOIN_PRIVATE\", \"ZCASH\", \"ZCASH_TESTNET\", \"ZCLASSIC\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(coin_type)\n fail ArgumentError, \"invalid value for \\\"coin_type\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'addresses' is set\n if @api_client.config.client_side_validation && addresses.nil?\n fail ArgumentError, \"Missing the required parameter 'addresses' when calling AddressApi.get_balances\"\n end\n if @api_client.config.client_side_validation && addresses.length < 1\n fail ArgumentError, 'invalid value for \"addresses\" when calling AddressApi.get_balances, number of items must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/api/address/balances/{coin_type}/{addresses}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'addresses' + '}', CGI.escape(addresses.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'BalancesReply' \n\n # auth_names\n auth_names = opts[:auth_names] || ['ApiKeyAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AddressApi#get_balances\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://api.blockchair.com/bitcoin/dashboards/address').append(address).fragment(the_key)\n )['data'][address]\n if json.nil?\n @log.info(\"Address #{address} not found\")\n return 0\n end\n a = json['address']\n b = a['balance']\n @log.info(\"The balance of #{address} is #{b} satoshi\")\n b\n end", "def balance\n params = {'username' => ENV['ROCK_USERNAME'],\n\t\t 'password' => ENV['ROCK_PASSWORD'],\n 'api_key' => ENV['ROCK_KEY']}\n\n btc_balance = 0.0\n\tusd_balance = 0.0\n\n\tresponse = RestClient.post(\"https://www.therocktrading.com/api/get_balance\", params, {})\n\tr_json = JSON.parse(response)\n\tif (r_json.keys.include?(\"result\"))\n\t r_json[\"result\"].each do |currency|\n if currency[\"currency\"]==\"BTC\"\n \t btc_balance = currency[\"balance\"].to_f\n\t elsif currency[\"currency\"]==\"USD\"\n\t usd_balance = currency[\"balance\"].to_f\n end\n\t end\n \telse\n\t btc_balance = 0.0\n\t usd_balance = 0.0\n\tend\n return [btc_balance, usd_balance]\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/rawaddr/#{address}\")\n )\n @log.info(\"Total transactions: #{json['n_tx']}\")\n @log.info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance(known_balances = {})\n known_balances.has_key?(name) && known_balances[name] ||\n rpc.getbalance(name)\n end", "def account_balance\n balance = 0\n deposits.each {|deposit| balance += deposit.amount}\n\n transactions.each do |transaction|\n amount = transaction.price * transaction.num_shares\n transaction.order_type == 'BUY' ? balance -= amount : balance += amount\n end\n return balance.round(2)\n end", "def balance(account_name=nil)\n request('getbalance', account_name)\n end", "def balance\n # accounts.reduce(0) {|sum, account| sum + account.balance}\n accounts.sum {|account| account.balance}\n\n # total = 0\n # accounts.each {|account| total += account.balance}\n # total\n end", "def balance(address)\n first_one do |api|\n api.balance(address)\n end\n end", "def balance() @address.balance; end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def balance\n balance = 0.00\n @transactions.each do | transaction|\n balance += transaction[:amount]\n end\n return balance\n end", "def outstanding_balances\n invoicable_reservations = reservations.invoicable.group_by(&:user_id)\n invoicable_game_passes = game_passes.invoicable.group_by(&:user_id)\n\n user_ids = invoicable_reservations.keys + invoicable_game_passes.keys\n\n user_ids.map do |user_id|\n [user_id,\n invoicable_reservations[user_id].try(:map, &:outstanding_balance).try(:sum).to_f +\n invoicable_game_passes[user_id].try(:map, &:price).try(:sum).to_f\n ]\n end.to_h\n end", "def balance(_address)\n raise Sibit::NotSupportedError, 'balance() doesn\\'t work here'\n end", "def accounts_balances_get(authorization, psu_ip_address, opts = {})\n data, _status_code, _headers = accounts_balances_get_with_http_info(authorization, psu_ip_address, opts)\n data\n end", "def balance\n if @options[:verbose]\n warning = \"Coinbase doesn't provide a USD balance because\"\n warning << \" it connects to your bank account. Be careful, \"\n warning << \"because this will withdraw directly from your accounts\"\n warning << \"when you trade live.\"\n logger.warn warning\n end\n @balance ||= [max_float, max_float]\n end", "def balance\n\t\tbalance = 0.00\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\t\n\n\t\treturn balance\n\tend", "def balances\n @user = User.all.sort_by{|u| u.balance }\n end", "def get_currency_balance_all_using_get(opts = {})\n data, _status_code, _headers = get_currency_balance_all_using_get_with_http_info(opts)\n data\n end", "def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end", "def balance\n\t\tbalance = 0\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\n\t\treturn balance\n\tend", "def balance(query = nil)\n Ledger::Balance.get(query)\n end", "def get_aggregation_account_balance_all_using_get(opts = {})\n data, _status_code, _headers = get_aggregation_account_balance_all_using_get_with_http_info(opts)\n data\n end", "def getBalance\n result = @driver.GetBalance(:ApiKey => @apikey)\n if result.getBalanceResult.errorCode == \"0\" then\n output = result.getBalanceResult.balance\n else\n output = result.getBalanceResult.errorMessage\n end\n return output\n end", "def balance\n self.all_benefits - self.all_pays\n end", "def fetch_balances\n\n SaasApi::OnBoarding::FetchBalances.new.perform(client_id: @client_id, balances_to_fetch: @balances_to_fetch)\n\n end", "def balance\n # If in development, return a mocked amount\n return 1234 if Rails.env.development?\n\n # If in production, fetch the user's balance from Tab.\n @balance || begin\n headers = {\n \"Authorization\" => \"Token token=#{Rails.application.secrets.tab_api_key}\",\n \"Content-type\" => \"application/json\"\n }\n result = HTTParty.get(File.join(Rails.application.config.api_url, \"users\", \"#{name}.json\"), headers: headers)\n\n JSON.parse(result.body)[\"balance\"] if result.code == 200\n rescue StandardError # rubocop:disable Lint/SuppressedException\n end\n end", "def lifetime_balances(user_ids = nil)\n reservations_relation = reservations.includes(:user)\n game_passes_relation = game_passes\n participations_relation = participations\n group_subscriptions_relation = group_subscriptions\n\n if user_ids.present?\n game_passes_relation.where!(user_id: user_ids)\n participations_relation.where!(user_id: user_ids)\n group_subscriptions_relation.where!(user_id: user_ids)\n # cannot do this on reservations because they may belong to a group, where we have to bill\n # the owner of that group (that's why we group on `fetch_owner_id`)\n # reservations_relation.where!(user_id: user_ids)\n end\n\n reservations_by_user = reservations_relation.group_by(&:fetch_owner_id)\n game_passes_balances = game_passes_relation.group(:user_id).sum(:price)\n participations_balances = participations_relation.group('participations.user_id').sum(:price)\n group_subscriptions_balances = group_subscriptions_relation.group(:user_id).sum(:price)\n\n users.map do |user|\n [user.id,\n (reservations_by_user[user.id].to_a.map(&:price).sum || 0).to_d +\n (game_passes_balances[user.id] || 0).to_d +\n (participations_balances[user.id] || 0).to_d +\n (group_subscriptions_balances[user.id] || 0).to_d\n ]\n end.to_h\n end", "def address_balance(address)\n total = $db.connection.execute(\n \"SELECT amount FROM wallet_transfers WHERE destination_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n spent_including_fees = $db.connection.execute(\n \"SELECT fee, amount FROM wallet_transfers WHERE from_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n total.to_i - spent_including_fees.to_i\n end", "def balance\n JSON.parse(response.body).fetch('balance')\n end", "def balance_of(address)\n payload = Base58.decode(address).to_s(16)\n public_key_hash = payload.slice(0, payload.length - 4)\n unspent_txs = unspent_transaction_outputs_of(public_key_hash)\n unspent_txs.reduce(0) { |sum, tx_out| sum + tx_out.value }\n end", "def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end", "def balance\n @balance ||= starting_balance + transactions.inject(0) do |result, element|\n result + element.amount\n end\n end", "def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end", "def outstanding_balances(group_custom_biller = nil)\n if group_custom_biller.present?\n # only participations and subscriptions for biller\n invoiceable_reservations = invoiceable_game_passes = []\n else\n invoiceable_reservations = reservations.invoiceable.\n users_with_groups(users).\n includes(:user).\n group_by(&:fetch_owner_id)\n invoiceable_game_passes = game_passes.invoiceable.group_by(&:user_id)\n end\n\n invoiceable_participations = participations_by_biller(group_custom_biller).\n invoiceable.group_by(&:user_id)\n invoiceable_group_subscriptions = group_subscriptions_by_biller(group_custom_biller).\n invoiceable.group_by(&:user_id)\n\n users.map do |user|\n [user.id,\n invoiceable_reservations[user.id].to_a.map { |r| r.outstanding_balance || 0.to_d }.sum.to_d +\n invoiceable_game_passes[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d +\n invoiceable_participations[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d +\n invoiceable_group_subscriptions[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d\n ]\n end.to_h\n end", "def balance\n transactions.inject(0) do |sum, transaction|\n sum + transaction.amount\n end\n end", "def get_balance(hash160_or_addr, unconfirmed = false)\n if Bitcoin.valid_address?(hash160_or_addr)\n txouts = get_txouts_for_address(hash160_or_addr)\n else\n txouts = get_txouts_for_hash160(hash160_or_addr, :hash160, unconfirmed)\n end\n unspent = txouts.select {|o| o.get_next_in.nil?}\n unspent.map(&:value).inject {|a,b| a+=b; a} || 0\n rescue\n nil\n end", "def balance_dollars\n transactions = Transaction.where('contact_id = ?', id)\n .includes(:settled_by)\n\n totalPaid = Money.new(0)\n totalSettled = Money.new(0)\n\n transactions.each do |loan|\n totalPaid = totalPaid + loan.amount_dollars\n\n loan.settled_by.each do |payback|\n totalSettled = totalSettled + payback.amount_dollars\n end\n end\n\n return totalPaid + totalSettled\n end", "def balance\n @accounts.values.first\n end", "def balance\n return false unless Account.exists?(@account_id)\n\n Trade.where(account_id: @account_id).pluck(:amount).reduce(:+) || 0.0\n end", "def balance\n res = dollars\n\n fund_transactions.each do |tran|\n res += tran.dollars\n end\n\n return res\n end", "def balance\n wallet = Fyb.private.getaccinfo.perform.parse\n btc_label = 'btcBal'\n money_label = Fyb::Configuration.currency.to_s + 'Bal'\n\n btc = BigDecimal.new wallet[btc_label]\n real_money = BigDecimal.new wallet[money_label]\n\n { :btc => btc, Fyb::Configuration.currency => real_money }\n end", "def request_saas_to_get_balance\n params_for_get_balance_api = {\n address: @address,\n currencies: @currencies\n }\n\n saas_response = SaasApi::Token::GetBalance.new.perform(params_for_get_balance_api)\n return saas_response unless saas_response.success?\n\n @api_response_data[:balance] = saas_response.data\n\n success\n end", "def balance(account)\n net_deposits(account) - net_withdraws(account)\n end", "def balance\n @balance ||= starting_balance + flights.inject(0) do |result, element|\n result + element.profit\n end\n end", "def get_balance(coin_type, address, opts = {})\n data, _status_code, _headers = get_balance_with_http_info(coin_type, address, opts)\n data\n end", "def get_balance\n return balance\n end", "def balance(ending_at=nil)\n return @balance if !!@balance && !ending_at\n if ending_at\n balance_cents = self.transactions.sum(:cents,\n :conditions => [\"created_at < ? AND action NOT IN (?)\", ending_at, ['authorize', 'void']]\n )\n @balance = nil\n Money.new(balance_cents || 0, self.currency)\n else\n @balance = Money.new(self.cents, self.currency)\n end\n end", "def balance\n @client.balance(name)\n end", "def balances\n Crypto.available.active.sort_by(&:name).map do |crypto|\n account = accounts.find { |a| a.crypto_id == crypto.id }\n filtered_nodes = nodes.select{ |n| n.crypto_id == crypto.id && ['online', 'new'].include?(n.status) }\n if account.nil?\n {\n btc: 0.0,\n fee: crypto.percentage_conversion_fee,\n has_nodes: false,\n name: crypto.name,\n slug: crypto.slug,\n symbol: crypto.symbol,\n usd: 0.0,\n value: 0.0,\n wallet: nil,\n withdrawable: crypto.withdrawable?\n }\n else\n crypto_pricer = CryptoPricer.new(account.crypto)\n btc = crypto_pricer.to_btc(account.balance, 'sell')\n usd = crypto_pricer.to_usdt(account.balance, 'sell')\n {\n btc: btc,\n fee: crypto.percentage_conversion_fee,\n has_nodes: filtered_nodes.present?,\n name: account.name,\n slug: crypto.slug,\n symbol: account.symbol,\n usd: usd,\n value: account.balance,\n wallet: account.wallet,\n withdrawable: crypto.withdrawable?\n }\n end\n end\n end", "def balance_to(user)\n shared_projects = user.projects.where('projects.id' => self.project_ids)\n money_from_projects = shared_projects.reduce(0.0) do |sum, project|\n case project.bank\n when user\n sum - self.balance_for(project)\n when self\n sum + user.balance_for(project)\n when nil\n sum + (self.amount_spent_on(project) - user.amount_spent_on(project)) / project.users.count\n else\n sum\n end\n end\n money_from_projects + self.amount_payed_to(user) - self.amount_received_from(user)\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end", "def index\n @account_balances = AccountBalance.all\n end", "def balance\n Money.new(\n Revenue.to_account(self).joins(:virtual_revenues).sum('\"virtual_revenues\".\"cents\"').to_i +\n Transfer.to_account(self).sum(:cents) - Transfer.from_account(self).sum(:cents) - \n Purchase.from_account(self).joins(:virtual_purchases).sum('\"virtual_purchases\".\"cents\"').to_i +\n self.initial_balance_in_cents\n )\n end", "def get_account_balance(account_id)\n query_api_object AccountBalance, \"/rest/accounts/#{account_id}/balance\"\n end", "def get_balance(address, tag: 'latest')\n validate_address(address)\n validate_block_tag(tag)\n\n resp = conn.post do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = json_rpc(method: 'eth_getBalance', params: [address, tag]).to_json\n end\n resp_body = JSON.parse(resp.body)\n\n if resp_body['error']\n raise InfuraCallError.new(\n \"Error (#{resp_body['error']['code']}): Infura API call \"\\\n \"eth_getBalance gave message: '#{resp_body['error']['message']}'\"\n )\n else\n wei_amount_hex_string = resp_body['result']\n wei_amount_hex_string.to_i(16)\n end\n end", "def balance\n if self.normal_balance.debit?\n self.amounts.balance\n elsif self.normal_balance.credit?\n - self.amounts.balance\n else\n nil\n end\n end", "def index\n @account_balances = current_user.account_balances.order(\"balance_date DESC\").page(params[:page]).per_page(20)\n end", "def daily_balances(start_date, end_date)\n LedgerAccountHelper.daily_balances(main_ledger_account, start_date, end_date)\n end", "def combined_balance\n return @@response[\"combinedBalances\"][0][\"totalEquity\"]\n end", "def build_balances(balance_hashes, updated_at, config, user)\n balances = []\n balance_hashes.each do |balance|\n balance = balance.to_h.compact.symbolize_keys\n config = config.to_h.compact.symbolize_keys\n next unless user == balance[:user]\n balances << Balance.new(\n user: balance.fetch(:user).to_s,\n project: balance.fetch(:project, nil).to_s,\n value: balance.fetch(:value).to_i,\n project_type: config.fetch(:project_type, nil).to_s,\n unit: config[:unit].to_s,\n updated_at: Time.at(updated_at.to_i),\n )\n end\n balances\n end", "def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end", "def balance\n sum = 0\n @money.each do |k, v|\n sum += k * v\n end\n sum\n end", "def balance(account)\n return balances[account] || infer_balance(account) # need to infer the balance if the account is not in ledger's output\n end", "def get_balance\n builder = Builder::XmlMarkup.new(indent: 2)\n builder.instruct! :xml, version: \"1.0\"\n builder.getUserBalance(company: @company)\n\n result = send_xml(builder.target!)\n\n source = XML::Parser.string(result)\n content = source.parse\n log(\"Content: #{content}\")\n\n if error = content.find_first('message')\n @errors = error.content.strip\n 0\n else\n # TODO: Check for other possible results in here\n return content.find_first('/userBalance').content.strip.to_f\n end\n end", "def user_outstanding_balance(user)\n invoicable_reservations = reservations.where(user: user).invoicable\n invoicable_game_passes = game_passes.where(user: user).invoicable\n\n invoicable_reservations.map(&:outstanding_balance).sum.to_f +\n invoicable_game_passes.map(&:price).sum.to_f\n end", "def balance\n self.ledger_entries.sum(:value)\n end", "def getTotals\n totals = calculateTotals(@bankAccountBalances)\n @totalAvailable = totals[:totalAvailable]\n @totalCreditUsed = totals[:totalCreditUsed]\n @totalCredit = totals[:totalCredit]\n @totalCash = totals[:totalCash]\n end", "def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => api@xero.com\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end", "def balance(date=Date.tomorrow)\n ledger_entries.before_date(date).sum(:debit) - ledger_entries.before_date(date).sum(:credit)\n end", "def balance(confirmed = true)\n contributions.confirmed(confirmed).sum(:amount)\n end", "def index\n @account_balance_distributions = current_user.get_all('account_balance_distributions')\n end", "def balance_for(account)\n @accounts[account]\n end", "def balance\n request_params = params.permit(:account_id)\n\n balance ||= Actions.new.balance(request_params['account_id'])\n\n return render status: balance[0], json: balance[1]\n end", "def getbalance(account = nil, minconf = 1)\n request :getbalance, account, minconf\n end", "def gateway_balance opts={}\n params = {\n account: opts.delete(:account) || client_account,\n strict: true, \n hotwallet: [],\n ledger_index: 'validated'\n }.merge!(opts)\n post(:gateway_balance, params)\n end", "def show_balance(user)\n puts \"Name: #{user.name}, balance: #{user.balance}, points: #{user.card_points}\"\n end", "def getbalance(account = nil, minconf = 1)\n @api.request 'getbalance', account, minconf\n end", "def balance(date = nil)\n return @starting_balance if @transactions.empty?\n\n update_balances\n date = end_date if date.nil?\n\n raise \"Transaction set begins later than this date\" if date < start_date\n raise \"Transaction set ends before this date\" if date > end_date\n\n @balances[date.to_date]\n end", "def balance(currency)\n\t\treturn @balance[currency]\n\tend", "def get_balance\n\t\treturn @balance.balance\n\tend" ]
[ "0.74727434", "0.7321444", "0.70134366", "0.6885689", "0.6794347", "0.66981107", "0.6664422", "0.66523874", "0.6526944", "0.6502147", "0.6439209", "0.6362929", "0.6355836", "0.6242885", "0.61715746", "0.6142293", "0.61202776", "0.61202776", "0.6096186", "0.6052373", "0.6010101", "0.6008983", "0.60065293", "0.59885323", "0.5984946", "0.59840274", "0.5981339", "0.59599876", "0.59329045", "0.59205824", "0.5902445", "0.58935946", "0.5879698", "0.5862628", "0.58385235", "0.5835836", "0.58354574", "0.5812918", "0.5805873", "0.58028156", "0.5777193", "0.57738245", "0.57738", "0.57722336", "0.5771884", "0.57670623", "0.57412237", "0.573898", "0.5717024", "0.56946445", "0.5686045", "0.5685847", "0.5652243", "0.5650352", "0.56461626", "0.56412077", "0.56334263", "0.5622862", "0.5609931", "0.5606208", "0.55908775", "0.55773234", "0.5548394", "0.5541858", "0.5539552", "0.5533953", "0.5526961", "0.5501387", "0.54993254", "0.5499196", "0.5481711", "0.54790014", "0.546624", "0.5446074", "0.5432278", "0.5416036", "0.541232", "0.53991795", "0.53962445", "0.53957653", "0.53828496", "0.53749347", "0.5373308", "0.5372224", "0.5350276", "0.53439516", "0.5324739", "0.5310746", "0.53049487", "0.5280473", "0.5280025", "0.5272739", "0.5263585", "0.5242014", "0.52389836", "0.5226441", "0.521455", "0.52065045", "0.52010685", "0.51978236" ]
0.6930441
3
Get Balances Returns the satoshi balance, usd balance and user viewable balance for a set of addresses.
def get_balances_with_http_info(coin_type, addresses, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddressApi.get_balances ...' end # verify the required parameter 'coin_type' is set if @api_client.config.client_side_validation && coin_type.nil? fail ArgumentError, "Missing the required parameter 'coin_type' when calling AddressApi.get_balances" end # verify enum value allowable_values = ["BITCOIN", "ETHEREUM", "TESTNET3", "BITCOIN_CASH", "BITCOIN_GOLD", "LITECOIN", "DASH", "DOGE", "BITCOIN_PRIVATE", "ZCASH", "ZCASH_TESTNET", "ZCLASSIC"] if @api_client.config.client_side_validation && !allowable_values.include?(coin_type) fail ArgumentError, "invalid value for \"coin_type\", must be one of #{allowable_values}" end # verify the required parameter 'addresses' is set if @api_client.config.client_side_validation && addresses.nil? fail ArgumentError, "Missing the required parameter 'addresses' when calling AddressApi.get_balances" end if @api_client.config.client_side_validation && addresses.length < 1 fail ArgumentError, 'invalid value for "addresses" when calling AddressApi.get_balances, number of items must be greater than or equal to 1.' end # resource path local_var_path = '/api/address/balances/{coin_type}/{addresses}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'addresses' + '}', CGI.escape(addresses.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'BalancesReply' # auth_names auth_names = opts[:auth_names] || ['ApiKeyAuth'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AddressApi#get_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def balances()\n request(\"#{@base_url}/account/getbalances\")\n end", "def balances\n accounts.with_balance\n end", "def get_balance(campaigns=[])\n api_call(\"GetBalance\",campaigns)\n end", "def get_balances(coin_type, addresses, opts = {})\n data, _status_code, _headers = get_balances_with_http_info(coin_type, addresses, opts)\n data\n end", "def balance_get(addrs, opts = {})\n data, _status_code, _headers = balance_get_with_http_info(addrs, opts)\n data\n end", "def balances\n # Very inefficient at this point for a large network...\n self.network_as_users.map { |user|\n {:balance => self.balance_with(user), :user => user}\n }.select {|balance| balance[:balance].to_f != 0.0}\n end", "def get_coin_balances(options = {})\n body = {\n cmd: \"balances\"\n }\n body[:all] = 1 if options[:all]\n post body\n end", "def all_wallet_balances\n\t\ttotals = Hash.new {|h,uuid| h[uuid] = 0 }\n\t\ttotals[ GENESIS_WALLET ] = INITIAL_AMOUNT\n\n\t\tself.each_block do |block|\n\t\t\tblock.transactions.each do |tr|\n\t\t\t\ttotals[ tr[:to] ] += tr[:amount]\n\t\t\t\ttotals[ tr[:from] ] -= tr[:amount]\n\t\t\tend\n\t\tend\n\n\t\treturn totals.transform_values {|val| Money.new(val, :zmz) }\n\tend", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def get_balance(address = nil)\n outputs = get_unspent_outputs(address.nil? ? [] : [oa_address_to_address(address)])\n colored_outputs = outputs.map{|o|o.output}\n sorted_outputs = colored_outputs.sort_by { |o|o.script.to_string}\n groups = sorted_outputs.group_by{|o| o.script.to_string}\n result = groups.map{|k, v|\n btc_address = script_to_address(v[0].script)\n sorted_script_outputs = v.sort_by{|o|o.asset_id unless o.asset_id}\n group_assets = sorted_script_outputs.group_by{|o|o.asset_id}.select{|k,v| !k.nil?}\n assets = group_assets.map{|asset_id, outputs|\n {\n 'asset_id' => asset_id,\n 'quantity' => outputs.inject(0) { |sum, o| sum + o.asset_quantity }.to_s,\n 'amount' => outputs.inject(0) { |sum, o| sum + o.asset_amount }.to_s,\n 'asset_definition_url' => outputs[0].asset_definition_url,\n 'proof_of_authenticity' => outputs[0].proof_of_authenticity\n }\n }\n {\n 'address' => btc_address,\n 'oa_address' => (btc_address.nil? || btc_address.is_a?(Array)) ? nil : address_to_oa_address(btc_address),\n 'value' => satoshi_to_coin(v.inject(0) { |sum, o|sum + o.value}),\n 'assets' => assets,\n 'account' => v[0].account\n }\n }\n address.nil? ? result : result.select{|r|r['oa_address'] == address}\n end", "def balances\n return @balances_hash if @balances_hash\n ledger_balances = cmd 'bal --balance-format \"%A | %(display_total)\\n\"'\n @balances_hash = Hash[*(ledger_balances.split(\"\\n\")).map{|line| parse_account_line(line)}.flatten]\n end", "def balance(address)\n best_of('balance') do |api|\n api.balance(address)\n end\n end", "def balance\n return @balance if @balance.present?\n\n result = api_customers_command\n\n @balance = [ result[:account_balance_in_btc_normalized], result[:account_balance_in_usd] ]\n end", "def get_balance(address)\n #res = get(\"addr/\"+address+\"?noCache=1\")\n #(res['balance'] + res['unconfirmedBalance']).to_BTCFloat\n get(\"addr/\"+address+\"?noCache=1\")['balance'].to_BTCFloat\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def balance(address)\n json = get_json(\"/rawaddr/#{address}\")\n info(\"Total transactions: #{json['n_tx']}\")\n info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance(address)\n uri = Iri.new('https://chain.api.btc.com/v3/address').append(address).append('unspent')\n json = Sibit::Json.new(http: @http, log: @log).get(uri)\n if json['err_no'] == 1\n @log.info(\"The balance of #{address} is zero (not found)\")\n return 0\n end\n data = json['data']\n if data.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n txns = data['list']\n if txns.nil?\n @log.info(\"The balance of #{address} is probably zero (not found)\")\n return 0\n end\n balance = txns.map { |tx| tx['value'] }.inject(&:+) || 0\n @log.info(\"The balance of #{address} is #{balance}, total txns: #{txns.count}\")\n balance\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def fetch_balance_for(address)\n unspent = 0\n api_request('queryUnspentOutputs', { addresses: [address]})['unspent'].each do |out|\n unspent += out['value']\n end\n unspent\n end", "def balance\n rest.get(:getbalance)['data']\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://api.blockchair.com/bitcoin/dashboards/address').append(address).fragment(the_key)\n )['data'][address]\n if json.nil?\n @log.info(\"Address #{address} not found\")\n return 0\n end\n a = json['address']\n b = a['balance']\n @log.info(\"The balance of #{address} is #{b} satoshi\")\n b\n end", "def balance\n params = {'username' => ENV['ROCK_USERNAME'],\n\t\t 'password' => ENV['ROCK_PASSWORD'],\n 'api_key' => ENV['ROCK_KEY']}\n\n btc_balance = 0.0\n\tusd_balance = 0.0\n\n\tresponse = RestClient.post(\"https://www.therocktrading.com/api/get_balance\", params, {})\n\tr_json = JSON.parse(response)\n\tif (r_json.keys.include?(\"result\"))\n\t r_json[\"result\"].each do |currency|\n if currency[\"currency\"]==\"BTC\"\n \t btc_balance = currency[\"balance\"].to_f\n\t elsif currency[\"currency\"]==\"USD\"\n\t usd_balance = currency[\"balance\"].to_f\n end\n\t end\n \telse\n\t btc_balance = 0.0\n\t usd_balance = 0.0\n\tend\n return [btc_balance, usd_balance]\n end", "def balance(address)\n json = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/rawaddr/#{address}\")\n )\n @log.info(\"Total transactions: #{json['n_tx']}\")\n @log.info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end", "def balance(known_balances = {})\n known_balances.has_key?(name) && known_balances[name] ||\n rpc.getbalance(name)\n end", "def account_balance\n balance = 0\n deposits.each {|deposit| balance += deposit.amount}\n\n transactions.each do |transaction|\n amount = transaction.price * transaction.num_shares\n transaction.order_type == 'BUY' ? balance -= amount : balance += amount\n end\n return balance.round(2)\n end", "def balance(account_name=nil)\n request('getbalance', account_name)\n end", "def balance\n # accounts.reduce(0) {|sum, account| sum + account.balance}\n accounts.sum {|account| account.balance}\n\n # total = 0\n # accounts.each {|account| total += account.balance}\n # total\n end", "def balance(address)\n first_one do |api|\n api.balance(address)\n end\n end", "def balance() @address.balance; end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def balance\n balance = 0.00\n @transactions.each do | transaction|\n balance += transaction[:amount]\n end\n return balance\n end", "def outstanding_balances\n invoicable_reservations = reservations.invoicable.group_by(&:user_id)\n invoicable_game_passes = game_passes.invoicable.group_by(&:user_id)\n\n user_ids = invoicable_reservations.keys + invoicable_game_passes.keys\n\n user_ids.map do |user_id|\n [user_id,\n invoicable_reservations[user_id].try(:map, &:outstanding_balance).try(:sum).to_f +\n invoicable_game_passes[user_id].try(:map, &:price).try(:sum).to_f\n ]\n end.to_h\n end", "def balance(_address)\n raise Sibit::NotSupportedError, 'balance() doesn\\'t work here'\n end", "def accounts_balances_get(authorization, psu_ip_address, opts = {})\n data, _status_code, _headers = accounts_balances_get_with_http_info(authorization, psu_ip_address, opts)\n data\n end", "def balance\n if @options[:verbose]\n warning = \"Coinbase doesn't provide a USD balance because\"\n warning << \" it connects to your bank account. Be careful, \"\n warning << \"because this will withdraw directly from your accounts\"\n warning << \"when you trade live.\"\n logger.warn warning\n end\n @balance ||= [max_float, max_float]\n end", "def balances\n @user = User.all.sort_by{|u| u.balance }\n end", "def balance\n\t\tbalance = 0.00\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\t\n\n\t\treturn balance\n\tend", "def get_currency_balance_all_using_get(opts = {})\n data, _status_code, _headers = get_currency_balance_all_using_get_with_http_info(opts)\n data\n end", "def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end", "def balance\n\t\tbalance = 0\n\t\t@transactions.each do |transaction|\n\t\t\tbalance += transaction[:amount]\n\t\tend\n\t\treturn balance\n\tend", "def balance(query = nil)\n Ledger::Balance.get(query)\n end", "def get_aggregation_account_balance_all_using_get(opts = {})\n data, _status_code, _headers = get_aggregation_account_balance_all_using_get_with_http_info(opts)\n data\n end", "def getBalance\n result = @driver.GetBalance(:ApiKey => @apikey)\n if result.getBalanceResult.errorCode == \"0\" then\n output = result.getBalanceResult.balance\n else\n output = result.getBalanceResult.errorMessage\n end\n return output\n end", "def balance\n self.all_benefits - self.all_pays\n end", "def fetch_balances\n\n SaasApi::OnBoarding::FetchBalances.new.perform(client_id: @client_id, balances_to_fetch: @balances_to_fetch)\n\n end", "def balance\n # If in development, return a mocked amount\n return 1234 if Rails.env.development?\n\n # If in production, fetch the user's balance from Tab.\n @balance || begin\n headers = {\n \"Authorization\" => \"Token token=#{Rails.application.secrets.tab_api_key}\",\n \"Content-type\" => \"application/json\"\n }\n result = HTTParty.get(File.join(Rails.application.config.api_url, \"users\", \"#{name}.json\"), headers: headers)\n\n JSON.parse(result.body)[\"balance\"] if result.code == 200\n rescue StandardError # rubocop:disable Lint/SuppressedException\n end\n end", "def lifetime_balances(user_ids = nil)\n reservations_relation = reservations.includes(:user)\n game_passes_relation = game_passes\n participations_relation = participations\n group_subscriptions_relation = group_subscriptions\n\n if user_ids.present?\n game_passes_relation.where!(user_id: user_ids)\n participations_relation.where!(user_id: user_ids)\n group_subscriptions_relation.where!(user_id: user_ids)\n # cannot do this on reservations because they may belong to a group, where we have to bill\n # the owner of that group (that's why we group on `fetch_owner_id`)\n # reservations_relation.where!(user_id: user_ids)\n end\n\n reservations_by_user = reservations_relation.group_by(&:fetch_owner_id)\n game_passes_balances = game_passes_relation.group(:user_id).sum(:price)\n participations_balances = participations_relation.group('participations.user_id').sum(:price)\n group_subscriptions_balances = group_subscriptions_relation.group(:user_id).sum(:price)\n\n users.map do |user|\n [user.id,\n (reservations_by_user[user.id].to_a.map(&:price).sum || 0).to_d +\n (game_passes_balances[user.id] || 0).to_d +\n (participations_balances[user.id] || 0).to_d +\n (group_subscriptions_balances[user.id] || 0).to_d\n ]\n end.to_h\n end", "def address_balance(address)\n total = $db.connection.execute(\n \"SELECT amount FROM wallet_transfers WHERE destination_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n spent_including_fees = $db.connection.execute(\n \"SELECT fee, amount FROM wallet_transfers WHERE from_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n total.to_i - spent_including_fees.to_i\n end", "def balance\n JSON.parse(response.body).fetch('balance')\n end", "def balance_of(address)\n payload = Base58.decode(address).to_s(16)\n public_key_hash = payload.slice(0, payload.length - 4)\n unspent_txs = unspent_transaction_outputs_of(public_key_hash)\n unspent_txs.reduce(0) { |sum, tx_out| sum + tx_out.value }\n end", "def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end", "def balance\n @balance ||= starting_balance + transactions.inject(0) do |result, element|\n result + element.amount\n end\n end", "def account_balance\n response = execute_command('getbalance')\n parse_response(response)['Credit'].to_f\n end", "def outstanding_balances(group_custom_biller = nil)\n if group_custom_biller.present?\n # only participations and subscriptions for biller\n invoiceable_reservations = invoiceable_game_passes = []\n else\n invoiceable_reservations = reservations.invoiceable.\n users_with_groups(users).\n includes(:user).\n group_by(&:fetch_owner_id)\n invoiceable_game_passes = game_passes.invoiceable.group_by(&:user_id)\n end\n\n invoiceable_participations = participations_by_biller(group_custom_biller).\n invoiceable.group_by(&:user_id)\n invoiceable_group_subscriptions = group_subscriptions_by_biller(group_custom_biller).\n invoiceable.group_by(&:user_id)\n\n users.map do |user|\n [user.id,\n invoiceable_reservations[user.id].to_a.map { |r| r.outstanding_balance || 0.to_d }.sum.to_d +\n invoiceable_game_passes[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d +\n invoiceable_participations[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d +\n invoiceable_group_subscriptions[user.id].to_a.map { |r| r.price || 0.to_d }.sum.to_d\n ]\n end.to_h\n end", "def balance\n transactions.inject(0) do |sum, transaction|\n sum + transaction.amount\n end\n end", "def get_balance(hash160_or_addr, unconfirmed = false)\n if Bitcoin.valid_address?(hash160_or_addr)\n txouts = get_txouts_for_address(hash160_or_addr)\n else\n txouts = get_txouts_for_hash160(hash160_or_addr, :hash160, unconfirmed)\n end\n unspent = txouts.select {|o| o.get_next_in.nil?}\n unspent.map(&:value).inject {|a,b| a+=b; a} || 0\n rescue\n nil\n end", "def balance_dollars\n transactions = Transaction.where('contact_id = ?', id)\n .includes(:settled_by)\n\n totalPaid = Money.new(0)\n totalSettled = Money.new(0)\n\n transactions.each do |loan|\n totalPaid = totalPaid + loan.amount_dollars\n\n loan.settled_by.each do |payback|\n totalSettled = totalSettled + payback.amount_dollars\n end\n end\n\n return totalPaid + totalSettled\n end", "def balance\n @accounts.values.first\n end", "def balance\n return false unless Account.exists?(@account_id)\n\n Trade.where(account_id: @account_id).pluck(:amount).reduce(:+) || 0.0\n end", "def balance\n res = dollars\n\n fund_transactions.each do |tran|\n res += tran.dollars\n end\n\n return res\n end", "def balance\n wallet = Fyb.private.getaccinfo.perform.parse\n btc_label = 'btcBal'\n money_label = Fyb::Configuration.currency.to_s + 'Bal'\n\n btc = BigDecimal.new wallet[btc_label]\n real_money = BigDecimal.new wallet[money_label]\n\n { :btc => btc, Fyb::Configuration.currency => real_money }\n end", "def request_saas_to_get_balance\n params_for_get_balance_api = {\n address: @address,\n currencies: @currencies\n }\n\n saas_response = SaasApi::Token::GetBalance.new.perform(params_for_get_balance_api)\n return saas_response unless saas_response.success?\n\n @api_response_data[:balance] = saas_response.data\n\n success\n end", "def balance(account)\n net_deposits(account) - net_withdraws(account)\n end", "def balance\n @balance ||= starting_balance + flights.inject(0) do |result, element|\n result + element.profit\n end\n end", "def get_balance(coin_type, address, opts = {})\n data, _status_code, _headers = get_balance_with_http_info(coin_type, address, opts)\n data\n end", "def get_balance\n return balance\n end", "def balance(ending_at=nil)\n return @balance if !!@balance && !ending_at\n if ending_at\n balance_cents = self.transactions.sum(:cents,\n :conditions => [\"created_at < ? AND action NOT IN (?)\", ending_at, ['authorize', 'void']]\n )\n @balance = nil\n Money.new(balance_cents || 0, self.currency)\n else\n @balance = Money.new(self.cents, self.currency)\n end\n end", "def balance\n @client.balance(name)\n end", "def balances\n Crypto.available.active.sort_by(&:name).map do |crypto|\n account = accounts.find { |a| a.crypto_id == crypto.id }\n filtered_nodes = nodes.select{ |n| n.crypto_id == crypto.id && ['online', 'new'].include?(n.status) }\n if account.nil?\n {\n btc: 0.0,\n fee: crypto.percentage_conversion_fee,\n has_nodes: false,\n name: crypto.name,\n slug: crypto.slug,\n symbol: crypto.symbol,\n usd: 0.0,\n value: 0.0,\n wallet: nil,\n withdrawable: crypto.withdrawable?\n }\n else\n crypto_pricer = CryptoPricer.new(account.crypto)\n btc = crypto_pricer.to_btc(account.balance, 'sell')\n usd = crypto_pricer.to_usdt(account.balance, 'sell')\n {\n btc: btc,\n fee: crypto.percentage_conversion_fee,\n has_nodes: filtered_nodes.present?,\n name: account.name,\n slug: crypto.slug,\n symbol: account.symbol,\n usd: usd,\n value: account.balance,\n wallet: account.wallet,\n withdrawable: crypto.withdrawable?\n }\n end\n end\n end", "def balance_to(user)\n shared_projects = user.projects.where('projects.id' => self.project_ids)\n money_from_projects = shared_projects.reduce(0.0) do |sum, project|\n case project.bank\n when user\n sum - self.balance_for(project)\n when self\n sum + user.balance_for(project)\n when nil\n sum + (self.amount_spent_on(project) - user.amount_spent_on(project)) / project.users.count\n else\n sum\n end\n end\n money_from_projects + self.amount_payed_to(user) - self.amount_received_from(user)\n end", "def balance\n parse_balance(post('/api/1/generic/info'))\n end", "def index\n @account_balances = AccountBalance.all\n end", "def balance\n Money.new(\n Revenue.to_account(self).joins(:virtual_revenues).sum('\"virtual_revenues\".\"cents\"').to_i +\n Transfer.to_account(self).sum(:cents) - Transfer.from_account(self).sum(:cents) - \n Purchase.from_account(self).joins(:virtual_purchases).sum('\"virtual_purchases\".\"cents\"').to_i +\n self.initial_balance_in_cents\n )\n end", "def get_account_balance(account_id)\n query_api_object AccountBalance, \"/rest/accounts/#{account_id}/balance\"\n end", "def get_balance(address, tag: 'latest')\n validate_address(address)\n validate_block_tag(tag)\n\n resp = conn.post do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = json_rpc(method: 'eth_getBalance', params: [address, tag]).to_json\n end\n resp_body = JSON.parse(resp.body)\n\n if resp_body['error']\n raise InfuraCallError.new(\n \"Error (#{resp_body['error']['code']}): Infura API call \"\\\n \"eth_getBalance gave message: '#{resp_body['error']['message']}'\"\n )\n else\n wei_amount_hex_string = resp_body['result']\n wei_amount_hex_string.to_i(16)\n end\n end", "def balance\n if self.normal_balance.debit?\n self.amounts.balance\n elsif self.normal_balance.credit?\n - self.amounts.balance\n else\n nil\n end\n end", "def index\n @account_balances = current_user.account_balances.order(\"balance_date DESC\").page(params[:page]).per_page(20)\n end", "def daily_balances(start_date, end_date)\n LedgerAccountHelper.daily_balances(main_ledger_account, start_date, end_date)\n end", "def build_balances(balance_hashes, updated_at, config, user)\n balances = []\n balance_hashes.each do |balance|\n balance = balance.to_h.compact.symbolize_keys\n config = config.to_h.compact.symbolize_keys\n next unless user == balance[:user]\n balances << Balance.new(\n user: balance.fetch(:user).to_s,\n project: balance.fetch(:project, nil).to_s,\n value: balance.fetch(:value).to_i,\n project_type: config.fetch(:project_type, nil).to_s,\n unit: config[:unit].to_s,\n updated_at: Time.at(updated_at.to_i),\n )\n end\n balances\n end", "def combined_balance\n return @@response[\"combinedBalances\"][0][\"totalEquity\"]\n end", "def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end", "def balance\n sum = 0\n @money.each do |k, v|\n sum += k * v\n end\n sum\n end", "def balance(account)\n return balances[account] || infer_balance(account) # need to infer the balance if the account is not in ledger's output\n end", "def get_balance\n builder = Builder::XmlMarkup.new(indent: 2)\n builder.instruct! :xml, version: \"1.0\"\n builder.getUserBalance(company: @company)\n\n result = send_xml(builder.target!)\n\n source = XML::Parser.string(result)\n content = source.parse\n log(\"Content: #{content}\")\n\n if error = content.find_first('message')\n @errors = error.content.strip\n 0\n else\n # TODO: Check for other possible results in here\n return content.find_first('/userBalance').content.strip.to_f\n end\n end", "def user_outstanding_balance(user)\n invoicable_reservations = reservations.where(user: user).invoicable\n invoicable_game_passes = game_passes.where(user: user).invoicable\n\n invoicable_reservations.map(&:outstanding_balance).sum.to_f +\n invoicable_game_passes.map(&:price).sum.to_f\n end", "def balance\n self.ledger_entries.sum(:value)\n end", "def getTotals\n totals = calculateTotals(@bankAccountBalances)\n @totalAvailable = totals[:totalAvailable]\n @totalCreditUsed = totals[:totalCreditUsed]\n @totalCredit = totals[:totalCredit]\n @totalCash = totals[:totalCash]\n end", "def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => api@xero.com\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.get_budget(current_user.active_tenant_id, @budgets.sample.budget_id).budgets\n end", "def balance(date=Date.tomorrow)\n ledger_entries.before_date(date).sum(:debit) - ledger_entries.before_date(date).sum(:credit)\n end", "def index\n @account_balance_distributions = current_user.get_all('account_balance_distributions')\n end", "def balance(confirmed = true)\n contributions.confirmed(confirmed).sum(:amount)\n end", "def balance_for(account)\n @accounts[account]\n end", "def balance\n request_params = params.permit(:account_id)\n\n balance ||= Actions.new.balance(request_params['account_id'])\n\n return render status: balance[0], json: balance[1]\n end", "def getbalance(account = nil, minconf = 1)\n request :getbalance, account, minconf\n end", "def gateway_balance opts={}\n params = {\n account: opts.delete(:account) || client_account,\n strict: true, \n hotwallet: [],\n ledger_index: 'validated'\n }.merge!(opts)\n post(:gateway_balance, params)\n end", "def show_balance(user)\n puts \"Name: #{user.name}, balance: #{user.balance}, points: #{user.card_points}\"\n end", "def getbalance(account = nil, minconf = 1)\n @api.request 'getbalance', account, minconf\n end", "def balance(date = nil)\n return @starting_balance if @transactions.empty?\n\n update_balances\n date = end_date if date.nil?\n\n raise \"Transaction set begins later than this date\" if date < start_date\n raise \"Transaction set ends before this date\" if date > end_date\n\n @balances[date.to_date]\n end", "def balance(currency)\n\t\treturn @balance[currency]\n\tend", "def get_balance\n\t\treturn @balance.balance\n\tend" ]
[ "0.7472963", "0.73218185", "0.70138323", "0.69302154", "0.68847734", "0.6795169", "0.66982496", "0.6664758", "0.66524965", "0.6526493", "0.6502047", "0.64378977", "0.6362507", "0.6355805", "0.6243328", "0.6170598", "0.61407363", "0.61192966", "0.61192966", "0.60962254", "0.6009104", "0.6008727", "0.60053855", "0.5988182", "0.5984184", "0.5983452", "0.59806085", "0.595834", "0.5932271", "0.59190106", "0.5901747", "0.5894646", "0.5878743", "0.5863811", "0.5837699", "0.58365935", "0.5835253", "0.5813458", "0.580478", "0.58023125", "0.5776091", "0.5774781", "0.5774156", "0.57718575", "0.5771571", "0.5767135", "0.5742445", "0.5737675", "0.5716267", "0.5693276", "0.5685484", "0.568544", "0.5651678", "0.5651261", "0.5645405", "0.5640869", "0.56317633", "0.56220704", "0.56090003", "0.56051135", "0.55901325", "0.557696", "0.55478275", "0.5541787", "0.553927", "0.5534226", "0.5526724", "0.5500967", "0.55003923", "0.5499511", "0.5481088", "0.5479398", "0.5465524", "0.54457635", "0.5431877", "0.5415387", "0.54134", "0.5398962", "0.53963226", "0.539551", "0.5382928", "0.53741264", "0.5373159", "0.5373111", "0.53507626", "0.5343259", "0.5324246", "0.5311972", "0.5303885", "0.52808785", "0.52804047", "0.5272242", "0.5263088", "0.52425164", "0.52382344", "0.5227036", "0.5214999", "0.520587", "0.5200455", "0.5198519" ]
0.60515785
20
Get History Returns the transaction history for an address or addresses.
def get_history(coin_type, addresses, opts = {}) data, _status_code, _headers = get_history_with_http_info(coin_type, addresses, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_history\n get('account/history')\n end", "def history(source = nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/history\", params) { |json| json }\n end", "def history\n return @history\n end", "def history\n return @history\n end", "def history\n History\n end", "def orderhistory(market = nil)\n if market.nil?\n res = sget(\"/getorderhistory\", {})\n else\n res = sget(\"/getorderhistory\", {market: market})\n end\n resp = ::BittrexRb::Response::Account.new(res)\n end", "def history(options={})\n @history ||= ActsAsIcontact::ContactHistory.scoped_find(self, options)\n end", "def wallet_history\n get 'walletHistory'\n end", "def get_history(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/history\")\n end", "def get_history\n @request_history = Request.history_request\n end", "def accounts_balances_history_get(account_id, authorization, psu_ip_address, opts = {})\n data, _status_code, _headers = accounts_balances_history_get_with_http_info(account_id, authorization, psu_ip_address, opts)\n data\n end", "def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end", "def history\n from = @from.to_i\n limit = @to.to_i - from\n # Excecute the find of comparations\n histories = @to ? History.offset(from).limit(limit) : History.all\n histories\n end", "def history\r\n []\r\n end", "def get_history_with_http_info(coin_type, addresses, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AddressApi.get_history ...'\n end\n # verify the required parameter 'coin_type' is set\n if @api_client.config.client_side_validation && coin_type.nil?\n fail ArgumentError, \"Missing the required parameter 'coin_type' when calling AddressApi.get_history\"\n end\n # verify enum value\n allowable_values = [\"BITCOIN\", \"ETHEREUM\", \"TESTNET3\", \"BITCOIN_CASH\", \"BITCOIN_GOLD\", \"LITECOIN\", \"DASH\", \"DOGE\", \"BITCOIN_PRIVATE\", \"ZCASH\", \"ZCASH_TESTNET\", \"ZCLASSIC\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(coin_type)\n fail ArgumentError, \"invalid value for \\\"coin_type\\\", must be one of #{allowable_values}\"\n end\n # verify the required parameter 'addresses' is set\n if @api_client.config.client_side_validation && addresses.nil?\n fail ArgumentError, \"Missing the required parameter 'addresses' when calling AddressApi.get_history\"\n end\n if @api_client.config.client_side_validation && addresses.length < 1\n fail ArgumentError, 'invalid value for \"addresses\" when calling AddressApi.get_history, number of items must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/api/address/history/{coin_type}/{addresses}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'addresses' + '}', CGI.escape(addresses.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'HistoryReply' \n\n # auth_names\n auth_names = opts[:auth_names] || ['ApiKeyAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AddressApi#get_history\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def history(session_name = nil)\n query_params = session_name ? build_params(session: get_session_id(session_name)) : ''\n response = get(\"#{admin_url}/history?#{query_params}\")\n body = parse_body(response)\n\n raise body[:message] unless body.is_a?(Array)\n\n body.map do |entry|\n HistoryResponse.new(entry)\n end\n end", "def get_history\n events = []\n # Get the first page of the workflow history\n page = get_history_page\n page[\"events\"].each { |x| events << x }\n\n # Get the remaining pages of the workflow history\n until page[\"nextPageToken\"].nil?\n page = get_history_page(page[\"nextPageToken\"])\n page[\"events\"].each { |x| events << x }\n end\n events\n end", "def history(options={})\n resp = (options.nil? || options.empty?) ? get(Googl::Utils::API_HISTORY_URL) : get(Googl::Utils::API_HISTORY_URL, :query => options)\n case resp.code\n when 200\n self.items = resp.parsed_response.to_openstruct\n else\n raise exception(\"#{resp.code} #{resp.parsed_response}\")\n end\n end", "def get_fax_history(date_from = nil,\r\n date_to = nil,\r\n q = nil,\r\n order = nil)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/fax/history'\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'date_from' => date_from,\r\n 'date_to' => date_to,\r\n 'q' => q,\r\n 'order' => order\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def history\n return nil if tracking_is_empty\n\n history_information_box ||= @tracking_page.css(\".indent table[summary='履歴情報']\")\n history_columns = history_information_box.css(\"tr\")\n history_columns = history_columns[2..history_columns.size] # remove header\n\n history = []\n\n history_columns.each_with_index do |tr, index|\n next if index.odd? # skip zip code row\n date = Chronic.parse(tr.css(\"td\").first.text) rescue nil\n\n action = tr.css(\"td\")[1].text.strip\n action = nil if action.empty?\n\n details = tr.css(\"td\")[2].text.strip\n details = nil if action.empty?\n\n office = tr.css(\"td\")[3].text.strip\n office = nil if action.empty?\n\n location = tr.css(\"td\")[4].text.strip\n location = nil if action.empty?\n\n history << { date: date, action: action, details: details, office: office, location: location }\n end\n\n return history\n end", "def history(tag, start_time, end_time, opts = {\n limit: 1000, outsiders: 0, history_format: 0, retrieval_type: 0\n })\n parse_rest(\n rest_request(\n 'History',\n history_query_body(tag, start_time, end_time, opts)\n )\n )\n end", "def get_backup_history(opts = {})\n data, _status_code, _headers = get_backup_history_with_http_info(opts)\n return data\n end", "def order_history(market = nil, count = 10)\n params = market ? \"market=#{market}\" : \"\"\n orders = request(\"#{@base_url}/account/getorderhistory\", params)\n\n if orders.size > count then\n return orders[0,count]\n end\n\n return orders\n end", "def history(params)\n Client.current.get(\"#{resource_url}/candles\", params)\n end", "def history(params = {})\n params.select! { |key, _value| @api.history_config[:allowed_params].include? key }\n\n response = self.class.get(@api.history_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n response.body\n end", "def fetch_history\n service_response = Economy::Transaction::FetchHistory.new(params).perform\n render_api_response(service_response)\n end", "def one_history\n history = History.find(@id)\n history\n end", "def history\n @history ||= @repository.log(30, nil, path)\n end", "def history(currency)\n\t\treturn @history[currency]\n\tend", "def history\n command = AccountHistory.call(@current_user)\n if command.success?\n @history = command.result\n render 'history.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end", "def history\n @history.dup\n end", "def history\n self.class.history.of(self)\n end", "def history\n self.class.history.of(self)\n end", "def get_withdrawal_history\n # body = {\n # cmd: \"get_withdrawal_history\"\n # }\n\n end", "def all_history\n history(history: {})\n end", "def history\n @history ||= PublicEarth::Db::History.many.descriptive_changes_by_user(self.id)\n end", "def history(id_or_state = 'master', &block)\n return to_enum(:history, id_or_state) unless block_given?\n\n revision = revisions[id_or_state]\n\n while(revision)\n yield revision\n\n revision = revision.previous\n end\n end", "def packages_history_get(opts = {})\n data, _status_code, _headers = packages_history_get_with_http_info(opts)\n data\n end", "def history\n @history ||= LEAP::Motion::Utils::History.new(options[:history_size])\n end", "def history\n @history ||= @repo.log.path(path).to_a\n end", "def history\n @agent.history\n end", "def user_get_wallet_history(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_wallet_history ...\"\n end\n\n # resource path\n path = \"/user/walletHistory\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Transaction>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_wallet_history. Result: #{result.inspect}\"\n end\n return result\n end", "def get_navigation_history\n {\n method: \"Page.getNavigationHistory\"\n }\n end", "def history_items\n return @history_items\n end", "def history(object, params={})\n history_url = \"#{API_URL}#{object}.json?m=history\"\n perform_get_request(history_url, params)\n end", "def getHistories\n account = current_user.account\n if account.nil?\n render status: 400, json: {error: \"Invalid User\"}\n else\n devices = Device.find_all_by_user_id(current_user.id)\n device_ids = []\n devices.each do |d|\n device_ids << d.id\n end\n rewards = RewardHistory.where(:account_id => account.id)\n achievements = AchievementHistory.where(:device_id => device_ids)\n offers = OfferHistory.where(:device_id => device_ids)\n promos = PromoCodeHistory.where(:account_id => account.id)\n referrals = ReferralCodeHistory.where(:account_id => account.id)\n referrees = ReferralCodeHistory.where(:referrer_id => account.id)\n\n returnUserHistories = []\n\n rewards.each do |r|\n history = UserHistory.new\n description_string = \"\"\n if r.processed == false\n description_string = \"Pending reward\"\n else\n description_string = \"Reward redeemed!\"\n end\n history.populate(r.reward.name, description_string, \"#{r.reward.image.url}\", r.amount, r.created_at)\n returnUserHistories << history\n end\n\n achievements.each do |a|\n history = UserHistory.new\n history.populate(a.achievement.name, \"Achievement Complete!\", \"#{a.achievement.app.image.url}\", a.achievement.cost,\n a.created_at)\n returnUserHistories << history\n end\n\n offers.each do |o|\n history = UserHistory.new\n history.name = o.company\n history.description = \"Offer completed from: \" + o.company + \"!\"\n history.amount = o.amount\n history.date = o.created_at\n returnUserHistories << history\n end\n\n promos.each do |p|\n history = UserHistory.new\n history.name = \"Promotional Code\"\n history.description = \"Promotional Code #{p.promo_code.name} redeemed!\"\n history.amount = p.value\n history.date = p.created_at\n returnUserHistories << history\n end\n\n referrals.each do |r|\n history = UserHistory.new\n history.name = \"Referrer Install Bonus\"\n history.description = \"Referral code entered!\"\n history.amount = r.referree_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n referrees.each do |r|\n history = UserHistory.new\n history.name = \"Referral Bonus\"\n history.description = \"#{r.account.user.username} entered your referral code!\"\n history.amount = r.referrer_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n returnUserHistories = returnUserHistories.sort_by(&:date).reverse\n\n render status: 200, json: returnUserHistories\n end\n end", "def history\n return @history unless @history.nil?\n @history = (\n if History.exist?(root)\n History.at(root)\n else\n false\n end\n )\n end", "def audit_history\n return [] if id.blank?\n return Audit.where( work_id: id ).order( created_at: :desc )\n end", "def history\n session[:back_link_history]\n end", "def request_history(timestamp=1.day.ago)\n @ws.send({request: \"history\", timestamp: timestamp}.to_json)\n end", "def get_all_history(title_number)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?versions=list')\n\n if (response.code != '200') then\n raise \"Failed to retrieve list of historical data: \" + response.body\n end\n\n return JSON.parse(response.body)\nend", "def get_history_from_api(api=Rosemary::API.new)\n api.get_history(type, self.id.to_i)\n end", "def get_service_history\n with_monitoring do\n edipi_present!\n response = perform(:post, identity_path, VAProfile::Models::ServiceHistory.in_json)\n\n ServiceHistoryResponse.from(@current_user, response)\n end\n rescue Common::Client::Errors::ClientError => e\n if e.status == 404\n log_exception_to_sentry(\n e,\n { edipi: @user.edipi },\n { va_profile: :service_history_not_found },\n :warning\n )\n\n return ServiceHistoryResponse.new(404, episodes: nil)\n elsif e.status >= 400 && e.status < 500\n return ServiceHistoryResponse.new(e.status, episodes: nil)\n end\n\n handle_error(e)\n rescue => e\n handle_error(e)\n end", "def bid_history(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/BidHistory\", Yahoo::Api.merge(opts))\r\n end", "def history_definitions\n return @history_definitions\n end", "def history\n self.class.history.chronological.of(self)\n end", "def retrieve_historical_tr(src, dst)\n src = src.downcase\n if FailureIsolation.Node2Target2Trace.include? src and FailureIsolation.Node2Target2Trace[src].include? dst\n historical_tr_ttlhoptuples = FailureIsolation.Node2Target2Trace[src][dst]\n historical_trace_timestamp = FailureIsolation.HistoricalTraceTimestamp\n else\n @logger.warn { \"No historical trace found for #{src},#{dst} ...\" }\n historical_tr_ttlhoptuples = []\n historical_trace_timestamp = nil\n end\n\n @logger.debug { \"isolate_outage(#{src}, #{dst}), historical_traceroute_results: #{historical_tr_ttlhoptuples.inspect}\" }\n\n # encapsulate the ttlhoptuple lists into historicalforwardhop objects\n # todoc: why is this a nested array?\n [ForwardPath.new(src, dst, historical_tr_ttlhoptuples.map { |ttlhop| HistoricalForwardHop.new(ttlhop[0], ttlhop[1], @ipInfo) }),\n historical_trace_timestamp]\n end", "def history(limit: 1000)\n response = rpc(action: :history, param_name: :hash, params: {count: limit})\n response[:history].collect {|entry| Banano::Util.symbolize_keys(entry) }\n end", "def execution_history(symbol = 'XBTUSD', timestamp = Date.today)\n get 'executionHistory', symbol: symbol, timestamp: timestamp\n end", "def to_history\n history = History.new\n values.each do |value|\n value[:time].each do |t|\n history << Command.new(value[:cmd], t.to_i)\n end\n end\n return history\n end", "def history(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/Server/history', param do |i|\n notification = Notification.new\n notification.from_hash i\n notification\n end\n end", "def location_history(params = {})\n @client.get(\"#{path}/location/waypoints\", params)\n end", "def where_history()\r\n @history_offset\r\n end", "def get_history(page_token = nil); end", "def get_history\n data = { :ConfigItemID => self.id, 'XMLDataGet' => 1 }\n params = { :object => 'ConfigItemObjectCustom', :method => 'VersionList', :data => data }\n a = OTRS.connect(params).flatten\n b = self.class.superclass::Relation.new\n a.each do |c|\n b << self.class.object_preprocessor(c)\n end\n return b\n end", "def orders_history(options = {}, &blk)\n if block_given?\n websocket.subscribe :orderhistory, params: options.merge(auth: true), &blk\n else\n http.get :orderhistory, auth: true, params: options\n end\n end", "def fax_history_get(api_key, opts = {})\n fax_history_get_with_http_info(api_key, opts)\n return nil\n end", "def pipeline_history(pipeline_name, offset = 0, options = {})\n get \"pipelines/#{pipeline_name}/history/#{offset}\", options\n end", "def history\n @vcs.history\n end", "def history\n transition_data = lambda do |state_transition|\n data = {}\n [ :record_id, :record_type, :to_state, :from_state, :created_at ].each do |attr|\n data[attr] = state_transition[attr]\n end\n if state_transition.user_id\n user = User.find_by(id: state_transition.user_id)\n if user\n data[:user] = {}\n [ :id, :email, :last_name, :first_name, :display_name ].each { |a| data[:user][a] = user[a] }\n end\n end\n if state_transition.record_type == 'Item'\n item = Item.find_by(id: state_transition.record_id)\n if item\n data[:item] = {}\n [ :id, :resource_title, :resource_identifier, :container ].each { |a| data[:item][a] = item[a] }\n end\n end\n return data\n end\n\n h = state_transitions.map { |st| transition_data.call(st) }\n item_transitions = StateTransition.where(record_type: 'Item', order_id: self.id)\n h += item_transitions.map { |st| transition_data.call(st) }\n h.sort! { |x,y| x[:created_at] <=> y[:created_at] }\n h\n end", "def get_safebox_event_history(safebox)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid == nil\n @json_client.get_safebox_event_history(safebox.guid)[\"event_history\"].map {|p| EventHistory.new(p) }\n end", "def history(client)\n @redis.hgetall(key(client))\n end", "def voice_history_get(opts = {})\n data, _status_code, _headers = voice_history_get_with_http_info(opts)\n data\n end", "def history(*fragments)\n @wiki = repos.find_by_fragments(*fragments)\n @wikis = @wiki.history\n end", "def read_history\n if ENV['HOME'] && File.exist?(history_file)\n File.readlines(history_file).reverse.each do |line|\n Readline::HISTORY << line\n end\n end\n end", "def order_history(limit = 10)\n plain_orders = Fyb.private.getorderhistory(limit: limit).perform.parse\n error = plain_orders['error']\n\n fail Exception, error unless error == 0\n\n plain_orders['orders'].map do |data|\n Order.new data['qty'], data['price'], data['type'] == 'B' ? :buy : :sell, data['ticket']\n end\n end", "def history\n credit_lines = credits.map do |transfer|\n { date: transfer.created_at, counterparty: transfer.sender&.email, amount: transfer.amount, note: transfer.note }\n end\n debit_lines = debits.map do |transfer|\n { date: transfer.created_at, counterparty: transfer.receiver&.email, amount: -transfer.amount, note: transfer.note }\n end\n credit_lines.concat(debit_lines).sort_by { |line| line[:date] }.reverse\n end", "def identity_history(identity_uuid, historical_version=nil)\n scope 'default'\n get(\"identity/#{identity_uuid}/history\" + (historical_version ? \"/#{historical_version}\" : ''))\n end", "def history\n @parent ? @parent.history + [@name] : []\n end", "def history\r\n\r\n end", "def history=(value)\n @history = value\n end", "def history=(value)\n @history = value\n end", "def get_voice_history(date_from = nil,\r\n date_to = nil)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/history'\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'date_from' => date_from,\r\n 'date_to' => date_to\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def history\n RailsCommits::Request.new('repos/rails/rails/commits', @token, @count, @author).run\n end", "def billing_history_hashes\n expand(billing_information_icon)\n show_billing_history_link.click\n wait_until { !billing_history_table.hashes.first.values.first.nil? }\n billing_history_table.hashes\n end", "def history\n return nil unless tracked?\n @history ||= $repo.log.path(@name)\n end", "def show\n @history = ExchangeRecord.get_historical_data(@exchange_combination.base,\n @exchange_combination.target)\n end", "def history\n # Should be paginatable.\n # Oh, it's belongs as a separate resource, paginateable.\n self.edits.where(state: 'applied').order(:date)\n end", "def balance_history(opts={})\n return nil unless have_key?\n url = \"/v1/history\"\n ho = {currency:'usd', limit: 500}.merge(opts)\n options = {\n 'currency' => ho[:currency],\n 'limit' => ho[:limit]\n }\n begin\n\n resp = self.class.post(url, :headers => headers_for(url, options)).parsed_response\n rescue => e\n raise \"Error getting balance_history: #{e.message}: #{e.inspect}\"\n end\n\n resp\n end", "def sms_history_export_get(filename, opts = {})\n data, _status_code, _headers = sms_history_export_get_with_http_info(filename, opts)\n data\n end", "def history; end", "def history; end", "def history; end", "def bid_history_detail(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/BidHistoryDetail\", Yahoo::Api.merge(opts))\r\n end", "def history\n @memory.rewind\n @memory.read\n end", "def order_history\r\n @orders = @customer.close_orders\r\n end", "def history(circuit)\n raise NotImplementedError\n end", "def remote_call_for_history(entity, options = {})\n remote_call_for_action(:history, entity, options)\n end", "def get_postcard_history\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/post/postcards/history'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def all_history_as_of(last_update)\n history(history: { since: last_update })\n end" ]
[ "0.6927592", "0.6697385", "0.66865224", "0.66865224", "0.66652024", "0.6635105", "0.662819", "0.6581782", "0.65809345", "0.65712684", "0.6365599", "0.6362947", "0.6352777", "0.634292", "0.633991", "0.62977517", "0.62903494", "0.62755895", "0.62742704", "0.6235512", "0.6234274", "0.61833304", "0.6143474", "0.6137695", "0.6123325", "0.61165106", "0.6110922", "0.6090258", "0.6087623", "0.6040424", "0.6039206", "0.6035957", "0.6035957", "0.6029714", "0.6012128", "0.5975003", "0.59661525", "0.59506875", "0.59473073", "0.59245265", "0.59109426", "0.59094304", "0.59074336", "0.58880824", "0.5828934", "0.5820398", "0.5820193", "0.58196336", "0.5817468", "0.58141124", "0.57972765", "0.5786936", "0.5779123", "0.57790273", "0.57600945", "0.57525295", "0.57509816", "0.57476074", "0.57458174", "0.57423526", "0.5724454", "0.57220805", "0.56579626", "0.56561136", "0.5652799", "0.5650364", "0.56493825", "0.56462824", "0.5641252", "0.56383985", "0.5637585", "0.5616586", "0.5614984", "0.5614331", "0.5603842", "0.5602832", "0.5601606", "0.5592745", "0.55738807", "0.5566013", "0.5564719", "0.5564719", "0.55643886", "0.55610996", "0.55329186", "0.55286914", "0.55235803", "0.5517311", "0.5512347", "0.55062884", "0.5505958", "0.5505958", "0.5505958", "0.5503946", "0.54998255", "0.5498152", "0.54955834", "0.5463683", "0.5459212", "0.54542583" ]
0.746888
0
Get History Returns the transaction history for an address or addresses.
def get_history_with_http_info(coin_type, addresses, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AddressApi.get_history ...' end # verify the required parameter 'coin_type' is set if @api_client.config.client_side_validation && coin_type.nil? fail ArgumentError, "Missing the required parameter 'coin_type' when calling AddressApi.get_history" end # verify enum value allowable_values = ["BITCOIN", "ETHEREUM", "TESTNET3", "BITCOIN_CASH", "BITCOIN_GOLD", "LITECOIN", "DASH", "DOGE", "BITCOIN_PRIVATE", "ZCASH", "ZCASH_TESTNET", "ZCLASSIC"] if @api_client.config.client_side_validation && !allowable_values.include?(coin_type) fail ArgumentError, "invalid value for \"coin_type\", must be one of #{allowable_values}" end # verify the required parameter 'addresses' is set if @api_client.config.client_side_validation && addresses.nil? fail ArgumentError, "Missing the required parameter 'addresses' when calling AddressApi.get_history" end if @api_client.config.client_side_validation && addresses.length < 1 fail ArgumentError, 'invalid value for "addresses" when calling AddressApi.get_history, number of items must be greater than or equal to 1.' end # resource path local_var_path = '/api/address/history/{coin_type}/{addresses}'.sub('{' + 'coin_type' + '}', CGI.escape(coin_type.to_s)).sub('{' + 'addresses' + '}', CGI.escape(addresses.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'HistoryReply' # auth_names auth_names = opts[:auth_names] || ['ApiKeyAuth'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AddressApi#get_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_history(coin_type, addresses, opts = {})\n data, _status_code, _headers = get_history_with_http_info(coin_type, addresses, opts)\n data\n end", "def account_history\n get('account/history')\n end", "def history(source = nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/history\", params) { |json| json }\n end", "def history\n return @history\n end", "def history\n return @history\n end", "def history\n History\n end", "def orderhistory(market = nil)\n if market.nil?\n res = sget(\"/getorderhistory\", {})\n else\n res = sget(\"/getorderhistory\", {market: market})\n end\n resp = ::BittrexRb::Response::Account.new(res)\n end", "def history(options={})\n @history ||= ActsAsIcontact::ContactHistory.scoped_find(self, options)\n end", "def wallet_history\n get 'walletHistory'\n end", "def get_history(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/history\")\n end", "def get_history\n @request_history = Request.history_request\n end", "def accounts_balances_history_get(account_id, authorization, psu_ip_address, opts = {})\n data, _status_code, _headers = accounts_balances_history_get_with_http_info(account_id, authorization, psu_ip_address, opts)\n data\n end", "def history\n rest.get stats_path(:history) do |response|\n response_handler response\n end\n end", "def history\n from = @from.to_i\n limit = @to.to_i - from\n # Excecute the find of comparations\n histories = @to ? History.offset(from).limit(limit) : History.all\n histories\n end", "def history\r\n []\r\n end", "def history(session_name = nil)\n query_params = session_name ? build_params(session: get_session_id(session_name)) : ''\n response = get(\"#{admin_url}/history?#{query_params}\")\n body = parse_body(response)\n\n raise body[:message] unless body.is_a?(Array)\n\n body.map do |entry|\n HistoryResponse.new(entry)\n end\n end", "def get_history\n events = []\n # Get the first page of the workflow history\n page = get_history_page\n page[\"events\"].each { |x| events << x }\n\n # Get the remaining pages of the workflow history\n until page[\"nextPageToken\"].nil?\n page = get_history_page(page[\"nextPageToken\"])\n page[\"events\"].each { |x| events << x }\n end\n events\n end", "def history(options={})\n resp = (options.nil? || options.empty?) ? get(Googl::Utils::API_HISTORY_URL) : get(Googl::Utils::API_HISTORY_URL, :query => options)\n case resp.code\n when 200\n self.items = resp.parsed_response.to_openstruct\n else\n raise exception(\"#{resp.code} #{resp.parsed_response}\")\n end\n end", "def get_fax_history(date_from = nil,\r\n date_to = nil,\r\n q = nil,\r\n order = nil)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/fax/history'\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'date_from' => date_from,\r\n 'date_to' => date_to,\r\n 'q' => q,\r\n 'order' => order\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def history\n return nil if tracking_is_empty\n\n history_information_box ||= @tracking_page.css(\".indent table[summary='履歴情報']\")\n history_columns = history_information_box.css(\"tr\")\n history_columns = history_columns[2..history_columns.size] # remove header\n\n history = []\n\n history_columns.each_with_index do |tr, index|\n next if index.odd? # skip zip code row\n date = Chronic.parse(tr.css(\"td\").first.text) rescue nil\n\n action = tr.css(\"td\")[1].text.strip\n action = nil if action.empty?\n\n details = tr.css(\"td\")[2].text.strip\n details = nil if action.empty?\n\n office = tr.css(\"td\")[3].text.strip\n office = nil if action.empty?\n\n location = tr.css(\"td\")[4].text.strip\n location = nil if action.empty?\n\n history << { date: date, action: action, details: details, office: office, location: location }\n end\n\n return history\n end", "def history(tag, start_time, end_time, opts = {\n limit: 1000, outsiders: 0, history_format: 0, retrieval_type: 0\n })\n parse_rest(\n rest_request(\n 'History',\n history_query_body(tag, start_time, end_time, opts)\n )\n )\n end", "def get_backup_history(opts = {})\n data, _status_code, _headers = get_backup_history_with_http_info(opts)\n return data\n end", "def order_history(market = nil, count = 10)\n params = market ? \"market=#{market}\" : \"\"\n orders = request(\"#{@base_url}/account/getorderhistory\", params)\n\n if orders.size > count then\n return orders[0,count]\n end\n\n return orders\n end", "def history(params)\n Client.current.get(\"#{resource_url}/candles\", params)\n end", "def history(params = {})\n params.select! { |key, _value| @api.history_config[:allowed_params].include? key }\n\n response = self.class.get(@api.history_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n response.body\n end", "def fetch_history\n service_response = Economy::Transaction::FetchHistory.new(params).perform\n render_api_response(service_response)\n end", "def one_history\n history = History.find(@id)\n history\n end", "def history\n @history ||= @repository.log(30, nil, path)\n end", "def history(currency)\n\t\treturn @history[currency]\n\tend", "def history\n command = AccountHistory.call(@current_user)\n if command.success?\n @history = command.result\n render 'history.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end", "def history\n @history.dup\n end", "def history\n self.class.history.of(self)\n end", "def history\n self.class.history.of(self)\n end", "def get_withdrawal_history\n # body = {\n # cmd: \"get_withdrawal_history\"\n # }\n\n end", "def all_history\n history(history: {})\n end", "def history\n @history ||= PublicEarth::Db::History.many.descriptive_changes_by_user(self.id)\n end", "def history(id_or_state = 'master', &block)\n return to_enum(:history, id_or_state) unless block_given?\n\n revision = revisions[id_or_state]\n\n while(revision)\n yield revision\n\n revision = revision.previous\n end\n end", "def packages_history_get(opts = {})\n data, _status_code, _headers = packages_history_get_with_http_info(opts)\n data\n end", "def history\n @history ||= LEAP::Motion::Utils::History.new(options[:history_size])\n end", "def history\n @history ||= @repo.log.path(path).to_a\n end", "def history\n @agent.history\n end", "def user_get_wallet_history(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_wallet_history ...\"\n end\n\n # resource path\n path = \"/user/walletHistory\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Transaction>')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_wallet_history. Result: #{result.inspect}\"\n end\n return result\n end", "def get_navigation_history\n {\n method: \"Page.getNavigationHistory\"\n }\n end", "def history_items\n return @history_items\n end", "def history(object, params={})\n history_url = \"#{API_URL}#{object}.json?m=history\"\n perform_get_request(history_url, params)\n end", "def getHistories\n account = current_user.account\n if account.nil?\n render status: 400, json: {error: \"Invalid User\"}\n else\n devices = Device.find_all_by_user_id(current_user.id)\n device_ids = []\n devices.each do |d|\n device_ids << d.id\n end\n rewards = RewardHistory.where(:account_id => account.id)\n achievements = AchievementHistory.where(:device_id => device_ids)\n offers = OfferHistory.where(:device_id => device_ids)\n promos = PromoCodeHistory.where(:account_id => account.id)\n referrals = ReferralCodeHistory.where(:account_id => account.id)\n referrees = ReferralCodeHistory.where(:referrer_id => account.id)\n\n returnUserHistories = []\n\n rewards.each do |r|\n history = UserHistory.new\n description_string = \"\"\n if r.processed == false\n description_string = \"Pending reward\"\n else\n description_string = \"Reward redeemed!\"\n end\n history.populate(r.reward.name, description_string, \"#{r.reward.image.url}\", r.amount, r.created_at)\n returnUserHistories << history\n end\n\n achievements.each do |a|\n history = UserHistory.new\n history.populate(a.achievement.name, \"Achievement Complete!\", \"#{a.achievement.app.image.url}\", a.achievement.cost,\n a.created_at)\n returnUserHistories << history\n end\n\n offers.each do |o|\n history = UserHistory.new\n history.name = o.company\n history.description = \"Offer completed from: \" + o.company + \"!\"\n history.amount = o.amount\n history.date = o.created_at\n returnUserHistories << history\n end\n\n promos.each do |p|\n history = UserHistory.new\n history.name = \"Promotional Code\"\n history.description = \"Promotional Code #{p.promo_code.name} redeemed!\"\n history.amount = p.value\n history.date = p.created_at\n returnUserHistories << history\n end\n\n referrals.each do |r|\n history = UserHistory.new\n history.name = \"Referrer Install Bonus\"\n history.description = \"Referral code entered!\"\n history.amount = r.referree_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n referrees.each do |r|\n history = UserHistory.new\n history.name = \"Referral Bonus\"\n history.description = \"#{r.account.user.username} entered your referral code!\"\n history.amount = r.referrer_value\n history.date = r.created_at\n returnUserHistories << history\n end\n\n returnUserHistories = returnUserHistories.sort_by(&:date).reverse\n\n render status: 200, json: returnUserHistories\n end\n end", "def history\n return @history unless @history.nil?\n @history = (\n if History.exist?(root)\n History.at(root)\n else\n false\n end\n )\n end", "def audit_history\n return [] if id.blank?\n return Audit.where( work_id: id ).order( created_at: :desc )\n end", "def history\n session[:back_link_history]\n end", "def request_history(timestamp=1.day.ago)\n @ws.send({request: \"history\", timestamp: timestamp}.to_json)\n end", "def get_all_history(title_number)\n\n response = rest_get_call($HISTORIAN_URL + '/' + title_number +'?versions=list')\n\n if (response.code != '200') then\n raise \"Failed to retrieve list of historical data: \" + response.body\n end\n\n return JSON.parse(response.body)\nend", "def get_history_from_api(api=Rosemary::API.new)\n api.get_history(type, self.id.to_i)\n end", "def get_service_history\n with_monitoring do\n edipi_present!\n response = perform(:post, identity_path, VAProfile::Models::ServiceHistory.in_json)\n\n ServiceHistoryResponse.from(@current_user, response)\n end\n rescue Common::Client::Errors::ClientError => e\n if e.status == 404\n log_exception_to_sentry(\n e,\n { edipi: @user.edipi },\n { va_profile: :service_history_not_found },\n :warning\n )\n\n return ServiceHistoryResponse.new(404, episodes: nil)\n elsif e.status >= 400 && e.status < 500\n return ServiceHistoryResponse.new(e.status, episodes: nil)\n end\n\n handle_error(e)\n rescue => e\n handle_error(e)\n end", "def bid_history(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/BidHistory\", Yahoo::Api.merge(opts))\r\n end", "def history_definitions\n return @history_definitions\n end", "def history\n self.class.history.chronological.of(self)\n end", "def retrieve_historical_tr(src, dst)\n src = src.downcase\n if FailureIsolation.Node2Target2Trace.include? src and FailureIsolation.Node2Target2Trace[src].include? dst\n historical_tr_ttlhoptuples = FailureIsolation.Node2Target2Trace[src][dst]\n historical_trace_timestamp = FailureIsolation.HistoricalTraceTimestamp\n else\n @logger.warn { \"No historical trace found for #{src},#{dst} ...\" }\n historical_tr_ttlhoptuples = []\n historical_trace_timestamp = nil\n end\n\n @logger.debug { \"isolate_outage(#{src}, #{dst}), historical_traceroute_results: #{historical_tr_ttlhoptuples.inspect}\" }\n\n # encapsulate the ttlhoptuple lists into historicalforwardhop objects\n # todoc: why is this a nested array?\n [ForwardPath.new(src, dst, historical_tr_ttlhoptuples.map { |ttlhop| HistoricalForwardHop.new(ttlhop[0], ttlhop[1], @ipInfo) }),\n historical_trace_timestamp]\n end", "def history(limit: 1000)\n response = rpc(action: :history, param_name: :hash, params: {count: limit})\n response[:history].collect {|entry| Banano::Util.symbolize_keys(entry) }\n end", "def execution_history(symbol = 'XBTUSD', timestamp = Date.today)\n get 'executionHistory', symbol: symbol, timestamp: timestamp\n end", "def to_history\n history = History.new\n values.each do |value|\n value[:time].each do |t|\n history << Command.new(value[:cmd], t.to_i)\n end\n end\n return history\n end", "def history(options={})\n param = { :uniq_id => @uniq_id }.merge options\n Storm::Base::SODServer.remote_list '/Server/history', param do |i|\n notification = Notification.new\n notification.from_hash i\n notification\n end\n end", "def location_history(params = {})\n @client.get(\"#{path}/location/waypoints\", params)\n end", "def where_history()\r\n @history_offset\r\n end", "def get_history(page_token = nil); end", "def get_history\n data = { :ConfigItemID => self.id, 'XMLDataGet' => 1 }\n params = { :object => 'ConfigItemObjectCustom', :method => 'VersionList', :data => data }\n a = OTRS.connect(params).flatten\n b = self.class.superclass::Relation.new\n a.each do |c|\n b << self.class.object_preprocessor(c)\n end\n return b\n end", "def orders_history(options = {}, &blk)\n if block_given?\n websocket.subscribe :orderhistory, params: options.merge(auth: true), &blk\n else\n http.get :orderhistory, auth: true, params: options\n end\n end", "def fax_history_get(api_key, opts = {})\n fax_history_get_with_http_info(api_key, opts)\n return nil\n end", "def pipeline_history(pipeline_name, offset = 0, options = {})\n get \"pipelines/#{pipeline_name}/history/#{offset}\", options\n end", "def history\n @vcs.history\n end", "def history\n transition_data = lambda do |state_transition|\n data = {}\n [ :record_id, :record_type, :to_state, :from_state, :created_at ].each do |attr|\n data[attr] = state_transition[attr]\n end\n if state_transition.user_id\n user = User.find_by(id: state_transition.user_id)\n if user\n data[:user] = {}\n [ :id, :email, :last_name, :first_name, :display_name ].each { |a| data[:user][a] = user[a] }\n end\n end\n if state_transition.record_type == 'Item'\n item = Item.find_by(id: state_transition.record_id)\n if item\n data[:item] = {}\n [ :id, :resource_title, :resource_identifier, :container ].each { |a| data[:item][a] = item[a] }\n end\n end\n return data\n end\n\n h = state_transitions.map { |st| transition_data.call(st) }\n item_transitions = StateTransition.where(record_type: 'Item', order_id: self.id)\n h += item_transitions.map { |st| transition_data.call(st) }\n h.sort! { |x,y| x[:created_at] <=> y[:created_at] }\n h\n end", "def get_safebox_event_history(safebox)\n raise SendSecureException.new(\"SafeBox GUID cannot be null\") if safebox.guid == nil\n @json_client.get_safebox_event_history(safebox.guid)[\"event_history\"].map {|p| EventHistory.new(p) }\n end", "def history(client)\n @redis.hgetall(key(client))\n end", "def voice_history_get(opts = {})\n data, _status_code, _headers = voice_history_get_with_http_info(opts)\n data\n end", "def history(*fragments)\n @wiki = repos.find_by_fragments(*fragments)\n @wikis = @wiki.history\n end", "def read_history\n if ENV['HOME'] && File.exist?(history_file)\n File.readlines(history_file).reverse.each do |line|\n Readline::HISTORY << line\n end\n end\n end", "def order_history(limit = 10)\n plain_orders = Fyb.private.getorderhistory(limit: limit).perform.parse\n error = plain_orders['error']\n\n fail Exception, error unless error == 0\n\n plain_orders['orders'].map do |data|\n Order.new data['qty'], data['price'], data['type'] == 'B' ? :buy : :sell, data['ticket']\n end\n end", "def history\n credit_lines = credits.map do |transfer|\n { date: transfer.created_at, counterparty: transfer.sender&.email, amount: transfer.amount, note: transfer.note }\n end\n debit_lines = debits.map do |transfer|\n { date: transfer.created_at, counterparty: transfer.receiver&.email, amount: -transfer.amount, note: transfer.note }\n end\n credit_lines.concat(debit_lines).sort_by { |line| line[:date] }.reverse\n end", "def identity_history(identity_uuid, historical_version=nil)\n scope 'default'\n get(\"identity/#{identity_uuid}/history\" + (historical_version ? \"/#{historical_version}\" : ''))\n end", "def history\n @parent ? @parent.history + [@name] : []\n end", "def history\r\n\r\n end", "def history=(value)\n @history = value\n end", "def history=(value)\n @history = value\n end", "def get_voice_history(date_from = nil,\r\n date_to = nil)\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/voice/history'\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'date_from' => date_from,\r\n 'date_to' => date_to\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def history\n RailsCommits::Request.new('repos/rails/rails/commits', @token, @count, @author).run\n end", "def billing_history_hashes\n expand(billing_information_icon)\n show_billing_history_link.click\n wait_until { !billing_history_table.hashes.first.values.first.nil? }\n billing_history_table.hashes\n end", "def history\n return nil unless tracked?\n @history ||= $repo.log.path(@name)\n end", "def show\n @history = ExchangeRecord.get_historical_data(@exchange_combination.base,\n @exchange_combination.target)\n end", "def history\n # Should be paginatable.\n # Oh, it's belongs as a separate resource, paginateable.\n self.edits.where(state: 'applied').order(:date)\n end", "def balance_history(opts={})\n return nil unless have_key?\n url = \"/v1/history\"\n ho = {currency:'usd', limit: 500}.merge(opts)\n options = {\n 'currency' => ho[:currency],\n 'limit' => ho[:limit]\n }\n begin\n\n resp = self.class.post(url, :headers => headers_for(url, options)).parsed_response\n rescue => e\n raise \"Error getting balance_history: #{e.message}: #{e.inspect}\"\n end\n\n resp\n end", "def sms_history_export_get(filename, opts = {})\n data, _status_code, _headers = sms_history_export_get_with_http_info(filename, opts)\n data\n end", "def history; end", "def history; end", "def history; end", "def bid_history_detail(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/BidHistoryDetail\", Yahoo::Api.merge(opts))\r\n end", "def history\n @memory.rewind\n @memory.read\n end", "def order_history\r\n @orders = @customer.close_orders\r\n end", "def history(circuit)\n raise NotImplementedError\n end", "def remote_call_for_history(entity, options = {})\n remote_call_for_action(:history, entity, options)\n end", "def get_postcard_history\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/post/postcards/history'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def all_history_as_of(last_update)\n history(history: { since: last_update })\n end" ]
[ "0.746888", "0.6927592", "0.6697385", "0.66865224", "0.66865224", "0.66652024", "0.6635105", "0.662819", "0.6581782", "0.65809345", "0.65712684", "0.6365599", "0.6362947", "0.6352777", "0.634292", "0.62977517", "0.62903494", "0.62755895", "0.62742704", "0.6235512", "0.6234274", "0.61833304", "0.6143474", "0.6137695", "0.6123325", "0.61165106", "0.6110922", "0.6090258", "0.6087623", "0.6040424", "0.6039206", "0.6035957", "0.6035957", "0.6029714", "0.6012128", "0.5975003", "0.59661525", "0.59506875", "0.59473073", "0.59245265", "0.59109426", "0.59094304", "0.59074336", "0.58880824", "0.5828934", "0.5820398", "0.5820193", "0.58196336", "0.5817468", "0.58141124", "0.57972765", "0.5786936", "0.5779123", "0.57790273", "0.57600945", "0.57525295", "0.57509816", "0.57476074", "0.57458174", "0.57423526", "0.5724454", "0.57220805", "0.56579626", "0.56561136", "0.5652799", "0.5650364", "0.56493825", "0.56462824", "0.5641252", "0.56383985", "0.5637585", "0.5616586", "0.5614984", "0.5614331", "0.5603842", "0.5602832", "0.5601606", "0.5592745", "0.55738807", "0.5566013", "0.5564719", "0.5564719", "0.55643886", "0.55610996", "0.55329186", "0.55286914", "0.55235803", "0.5517311", "0.5512347", "0.55062884", "0.5505958", "0.5505958", "0.5505958", "0.5503946", "0.54998255", "0.5498152", "0.54955834", "0.5463683", "0.5459212", "0.54542583" ]
0.633991
15
Returns USVolume object with a size equal to the number in tablespoons.
def tbsp Measurements::USVolume.new(self, :tbsp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_size=(size)\n @cc.table_size = size\n end", "def table_size=(size)\n @cc.table_size = size\n end", "def canonic_size( size )\n if canonic_type == :decimal && size.is_a?( Integer )\n [ size, 0 ]\n else\n size\n end\n end", "def size(value)\n new(dataset.size(value))\n end", "def petabytes\n self * PETABYTE\n end", "def make_large_typhoon\n\t\tsz = 3\n\t\tsX = rand(46-10) + 10\n\t\tsY = rand(14-1) + 1\n\t\tdX = rand(11-2) + 2\n\t\tdY = rand(4-1) + 1\n\t\ttyphoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n\t\taddObject(typhoon1)\n\tend", "def initialize(size)\n @size = get_good_size(size)\n @table = Array.new @size\n @population = 0\n @used_spaces = 0\n end", "def autosizedHydronicTubingLength\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n\n model = self.model\n\n sql = model.sqlFile\n\n if sql.is_initialized\n sql = sql.get\n\n query = \"SELECT Value\n FROM tabulardatawithstrings\n WHERE ReportName='ComponentSizingSummary'\n AND ReportForString='Entire Facility'\n AND TableName='ZoneHVAC:LowTemperatureRadiant:VariableFlow'\n AND RowName='#{name}'\n AND ColumnName='Design Size Hydronic Tubing Length'\n AND Units='m'\"\n\n val = sql.execAndReturnFirstDouble(query)\n\n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n\n end\n\n return result\n\n end", "def make_large_typhoon\n sz = 3\n sX = rand(66-10) + 10\n sY = rand(24-1) + 1\n dX = rand(11-2) + 2\n dY = rand(4-1) + 1\n typhoon1 = Typhoon.new(sz, sX, sY, dX, dY, @currentTime)\n addObject(typhoon1)\n end", "def size\n sku.size * amount\n end", "def size\n @table.size\n end", "def cells(n)\n n * @vm.databytes\n end", "def size\n\t\t7500\n\tend", "def size\n table.size\n end", "def initialize(size = DEFAULT_HASHTABLE_SIZE)\n @table = Array.new(size)\n @count = EMPTY_COUNT\n end", "def size\n @table.size\n end", "def allocate_stream(table, stream, size)\n stream.sector = table.size if stream.respond_to?(:sector)\n ((stream.size / size.to_f).ceil).times { table << table.size }\n table[table.size-1] = -2 # this is the CBF chain terminator\n end", "def find_round_sizes(number, no_qual)\n rounds = how_many_rounds(number)\n rounds[0] = heat_sizes(no_qual)\n\n return rounds\n end", "def table\n super || Sulten::Table.new(number: -1, capacity: 0, available: false)\n end", "def get_shirt_size\n return @size\n end", "def table_size\n @table.size\n end", "def table_size\n @table.size\n end", "def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end", "def piece_size=(v)\n return unless v\n @piece_count = nil\n @piece_size = [v, 1024].max\n end", "def initialize(size)\n @size = size\n end", "def nice_size size\n number_to_human_size size, :precision => 0\n end", "def get_song_by_number(number)\n songs.find_by_song_number(number)\n end", "def variant_with_size(size)\n self.variants.select{|v| v.size == size}.first || self.variants.where('size = ?', size).first\n end", "def table_size=(size)\n @limit = size\n size_check(nil)\n end", "def pints\n Measurements::USVolume.new(self, :pint)\n end", "def size\n @sizes ||= strip(:size)\n end", "def size\n return 3\n end", "def initialize(size=DEFAULT_TABLE_SIZE)\n @table = HashTable.new(size)\n end", "def table_size_for(entry_count); end", "def get_shoe_size\n return prompt_positive_integer(\"Number of decks at table? [#{Decks::MIN_DECKS}]\", Decks::MIN_DECKS)\n end", "def size(num)\n params(size: num)\n end", "def size\n 4\n end", "def size\r\n\t\t@size\r\n\t\t#el tamaño\r\n\tend", "def get_prizes\n @prizes = Prize.all.shuffle.first(6)\n end", "def terabytes\n self * TERABYTE\n end", "def index\n @standard_sizes = StandardSize.all\n end", "def set_standard_size\n @standard_size = StandardSize.find(params[:id])\n end", "def number_of_voices(n)\n # Check the number of voices is valid.\n if [1, 2, 3, 4].include?(n)\n @metadata[:number_of_voices] = n\n else\n raise \"There must be 1, 2, 3 or 4 voices, not #{ n }.\"\n end\n return self\n end", "def human_size\n number_to_human_size size\n end", "def pizza_size \n\tsize = [\"small\", \"medium\", \"large\", \"super\", \"giganto\"].sample # .sample randomizing all the sizes\nend", "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def zettabytes\n self * ZETTABYTE\n end", "def initialize phenotype_count, orthogroup_count, storage_count\n # Make sure to provide storage_count + phenotype_count as the initial capacity, since otherwise a resize will be needed.\n super([phenotype_count, orthogroup_count], 0, capacity: storage_count+phenotype_count+1, stype: :yale, dtype: :byte)\n @skip_table = {}\n end", "def create_spots\n number = 1\n remaining = self.length\n\n if remaining >= 20\n 5.times do |_|\n self.spots.create(number: number, width: 4)\n number += 1\n remaining -= 4\n end\n end\n \n if (remaining-2) % 3 == 0\n self.spots.create(number: number, width: 2)\n number += 1\n remaining -= 2\n end\n\n if (remaining-4) % 3 == 0\n 2.times do |_|\n self.spots.create(number: number, width: 2)\n number += 1\n remaining -= 2\n end\n end\n\n while remaining > 2\n self.spots.create(number: number, width: 3)\n number += 1\n remaining -= 3\n end\n end", "def variation(size)\n ActiveStorage::Variation.new(combine_options(size))\n end", "def init_table\n\t$table = Array.new($height) { Array.new($width, '.')}\nend", "def initialize(table = Table.new([4, 4]))\n @table = table\n end", "def all_sizes\n [0.1, 0.5, 1, 5, 10]\n end", "def specific_max_size(number); end", "def size\n @parts.size\n end", "def size=(size)\n end", "def get_size\n\t\t[\"small\", \"medium\", \"large\"].sample\n\tend", "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end", "def slot_size (size)\r\n @slot_size = size\r\n end", "def three_sizes\n \"#{object.bust}-#{object.waist}-#{object.hip}\"\n end", "def create_parcel_slot_lot(number)\n @max_key = number\n @slot_numbers = Slot.generate_slot_numbers(number)\n @parcel = Parcel.new\n puts \"Created a parcel slot with #{number} slots\"\nend", "def larger_than(size)\n list = @file_table.to_hash.select do |file, data|\n c = SizeConversion.new(size.to_s)\n data[:size].to_f > c.to_size(:b).to_f\n end\n return list\n end", "def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end", "def generate_ebay_items_with_size(num, size=\"LP\", price=10.00)\n ebay_items = []\n num.times { ebay_items << Factory.create(:ebay_item, :size => size, :price => price) }\n ebay_items\n end", "def print_table(n)\n printer = Printer.new(first n)\n printer.print\n end", "def create_version\n v_stream= [60, \"Microsoft.Container.DataSpaces\".bytes.to_a, 1, 1, 1].flatten!.pack VERSION_PACKING\n Storage.new('Version', :data=>v_stream, :size=>v_stream.size)\n end", "def h(n)\n font_sizes.percentile ((HEADING_DEPTH-1)-n) * HEADING_STEP\n end", "def stocks_path(size)\n \"#{Rails.root}/db/stocks/#{size}.txt\"\n end", "def set_size\n @size = Size.find(params[:id])\n end", "def set_size\n @size = Size.find(params[:id])\n end", "def initialize(table_size_x, table_size_y)\n self.table_size_x = table_size_x.to_i - 1 || 4\n self.table_size_y = table_size_y.to_i - 1 || 4\n end", "def vsize\n (weight.to_f / 4).ceil\n end", "def compute_bucket(value, size = table.length)\n value.hash % size\n end", "def set_shirt_size\n @shirt_size = ShirtSize.find(params[:id])\n end", "def initialize( description, price )\n\n @id = rand(100..999)\n @description = description\n @price = price\n @size = []\n\n end", "def size\n return TUTOR_BOX_COUNT if type == \"tutor_table\"\n @boxes.nil? ? 0 : @boxes.count\n end", "def size=(value)\n @size = value\n end", "def size=(value)\n @size = value\n end", "def size\n @n\n end", "def size\n @n\n end", "def size\n @players.size\n end", "def piece_count=(v)\n return if v.nil?\n @piece_count = v\n @piece_size = ((@local_path.size / v) / 1024.0).ceil * 1024 \n end", "def set_variation_volume_size(size)\n @volume_size = size\n end", "def initialize size\n raise \"Size must be odd\" unless size%2 == 1\n @size = size\n @square = build_square size\n self\n end", "def sizes\n Vultr::Resource::Plan.new(@faraday)\n end", "def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend", "def specific_max_size(number)\n [self.size, number].min\n end", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def size\n return @songs.length\n end", "def human_size\n count = 0\n n = size\n while n >= 1024 and count < 4\n n /= 1024.0\n count += 1\n end\n format(\"%.1f\",n) + %w(B kB MB GB TB)[count]\n end", "def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end", "def number_of_players(number)\n return @players if @players\n\n if number > 3 || number == 0\n @players = 3\n else\n @players = number\n end\n end", "def number_of_cells(size)\n size * size\n end", "def tenth\n at(9)\n end", "def size(size)\n @value[:size] = size\n self\n end", "def set_table_size\n @table_x = @table_reversed[0].size\n @table_y = @table_reversed.size\n end", "def primer_probe_table(compositions:, sample_number:)\n table = [[\n compositions.first.primer_probe_mix.display_name,\n 'Item',\n \"Volume (#{MICROLITERS})\"\n ]]\n compositions.each do |composition|\n pp_mix = composition.primer_probe_mix\n row = [\n pp_mix.sample.name,\n pp_mix.item.to_s,\n pp_mix.add_in_table(sample_number)\n ]\n table.append(row)\n end\n table\n end", "def list_nix_partitions_with_size_and_type # nelsongs\n\t`fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && ($6==\"83\" || $6==\"82\")) print $1\":\"$5\":\"$6;else {if ($5==\"83\" || $5==\"82\") print $1\":\"$4\":\"$5}}' | sed s/+//g`.split\nend", "def default_tire_size\n '2.1'\n end" ]
[ "0.5175514", "0.5175514", "0.5155415", "0.5120031", "0.51182884", "0.5102779", "0.50798607", "0.5065726", "0.5028498", "0.50036186", "0.50030273", "0.49416253", "0.4940065", "0.49171522", "0.4906548", "0.49032065", "0.4852276", "0.48051637", "0.48004478", "0.47943437", "0.47878212", "0.47878212", "0.47747645", "0.477429", "0.47739664", "0.47729558", "0.4752811", "0.47424236", "0.47374928", "0.47287625", "0.47265953", "0.47178215", "0.4714329", "0.47085398", "0.46848765", "0.4680986", "0.46783954", "0.4676765", "0.46719998", "0.466558", "0.4655611", "0.4635723", "0.46328387", "0.46217462", "0.4609674", "0.46087977", "0.46039855", "0.45846775", "0.4583975", "0.45759195", "0.4574919", "0.45727855", "0.4550146", "0.45448244", "0.45344043", "0.45320413", "0.45301157", "0.45273295", "0.45182896", "0.45050722", "0.4504076", "0.44999513", "0.4495394", "0.44943044", "0.44926414", "0.4491932", "0.4491148", "0.44884297", "0.44865784", "0.4486138", "0.4486138", "0.44853327", "0.448252", "0.44792157", "0.4474539", "0.4471841", "0.44709483", "0.4467372", "0.4467372", "0.44672453", "0.44672453", "0.4466935", "0.44620195", "0.4458205", "0.44567975", "0.44561818", "0.4454099", "0.44489357", "0.44466433", "0.44357732", "0.44116133", "0.43971178", "0.4395929", "0.43939763", "0.4393922", "0.43930513", "0.43904775", "0.43894243", "0.4381461", "0.43812355" ]
0.5085982
6
Returns USVolume object with size equal to the number in fluid ounces.
def fl_oz Measurements::USVolume.new(self, :fl_oz) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def volume\n return nil if dimension_u.nil? || dimension_v.nil? || dimension_w.nil?\n (dimension_u * dimension_v * dimension_w) / 1_000_000_000.0\n end", "def volume\n @length * @width * @depth\n end", "def pints\n Measurements::USVolume.new(self, :pint)\n end", "def volume (l, w, h)\n\tl * w * h\nend", "def get_volume_of_cuboid(length, width, height)\n return length * width * height\nend", "def cups\n Measurements::USVolume.new(self, :cup) \n end", "def volume\n return @width * @height / @depth\n end", "def floor\n Quantity.new(@value.floor, @unit)\n end", "def size\n sku.size * amount\n end", "def autosizedPlantLoopVolume\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n \n model = self.model\n \n sql = model.sqlFile\n \n if sql.is_initialized\n sql = sql.get\n \n query = \"SELECT Value \n FROM tabulardatawithstrings \n WHERE ReportName='ComponentSizingSummary' \n AND ReportForString='Entire Facility' \n AND TableName='PlantLoop' \n AND RowName='#{name}' \n AND ColumnName='Plant Loop Volume'\n AND Units='m3'\"\n \n val = sql.execAndReturnFirstDouble(query)\n \n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n \n end\n\n return result\n \n end", "def volume\n return (4.0/3.0) * Math::PI * self.radius**3\n end", "def volume_calc(length,width,height)\n volume = length * width * height\n end", "def size\n\t\t7500\n\tend", "def vsize\n (weight.to_f / 4).ceil\n end", "def volume(options)\n options[:width] * options[:height] * options[:depth]\nend", "def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end", "def get_volume\n @volume\n end", "def volumen(numero, opciones = {})\n volumen = numero\n volumenes << volumen\n end", "def create_version\n v_stream= [60, \"Microsoft.Container.DataSpaces\".bytes.to_a, 1, 1, 1].flatten!.pack VERSION_PACKING\n Storage.new('Version', :data=>v_stream, :size=>v_stream.size)\n end", "def autosizedHydronicTubingLength\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n\n model = self.model\n\n sql = model.sqlFile\n\n if sql.is_initialized\n sql = sql.get\n\n query = \"SELECT Value\n FROM tabulardatawithstrings\n WHERE ReportName='ComponentSizingSummary'\n AND ReportForString='Entire Facility'\n AND TableName='ZoneHVAC:LowTemperatureRadiant:VariableFlow'\n AND RowName='#{name}'\n AND ColumnName='Design Size Hydronic Tubing Length'\n AND Units='m'\"\n\n val = sql.execAndReturnFirstDouble(query)\n\n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n\n end\n\n return result\n\n end", "def volume \n puts \"The volume is #{@length * @width * @height}\"\n end", "def set_variation_volume_size(size)\n @volume_size = size\n end", "def price_unit_factor\n return 1 if unit_id == price_unit_id\n return pack_size || 1 if price_unit_id == pack_unit_id\n return (pack_size || 1) * (subpack_size || 1) if price_unit_id == subpack_unit_id\n return 1\n end", "def size(base = self.date_from)\n\t\t\t\t\treturn self.send(\"size_#{self.capacity_type.to_s}\", base)\n\t\t\t\tend", "def variant_with_size(size)\n self.variants.select{|v| v.size == size}.first || self.variants.where('size = ?', size).first\n end", "def volume; self.class.volume; end", "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end", "def sfx_volume\n return @sfx_volume\n end", "def get_volume\n return get_floor_height.to_f * get_area.to_f\n end", "def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend", "def initialize unit_size = 256 # defaults to 256\n\t\t\t@unit_size = unit_size\n\t\tend", "def d_size\n @capacity / @blockSize\n end", "def size(value)\n new(dataset.size(value))\n end", "def volume_of_sphere(radius)\n return 3.14 * 4 / 3 * (radius ** 3)\n return volume\nend", "def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def create_volume(options = {})\n options[:capacity] = options[:capacity] * GB if options[:capacity] < 100000\n vol = pool.create_volume_xml(Volume.to_xml(options))\n Volume.new vol, self\n end", "def create_mini_fat\n v_mf = []\n @storages.select{ |s| s.type == Storage::TYPES[:stream] && s.size < MINI_CUTOFF}.each do |stream|\n allocate_stream(v_mf, stream, 64)\n end\n v_mf.concat Array.new(128 - v_mf.size, -1)\n v_mf.pack 'l*'\n end", "def ceil\n Quantity.new(@value.ceil, @unit)\n end", "def canonic_size( size )\n if canonic_type == :decimal && size.is_a?( Integer )\n [ size, 0 ]\n else\n size\n end\n end", "def quarts\n Measurements::USVolume.new(self, :quart)\n end", "def d_size\n @diskObj.info[:capacity]\n end", "def get_shirt_size\n return @size\n end", "def set_volume_cuft\n self.volume_cuft = (self.length_ins/12) * (self.width_ins/12) * (self.height_ins/12)\n end", "def total_servingSize\n food.servingSize * quantity\n end", "def to_human_size(options = {})\n number = Float(self)\n\n storage_units_format = \"%n %u\"\n\n if number.to_i < 1024\n unit = UNIT_NAMES[:byte][:other]\n storage_units_format.gsub(/%n/, number.to_i.to_s).gsub(/%u/, unit)\n else\n max_exp = STORAGE_UNITS.size - 1\n exponent = (Math.log(number) / Math.log(1024)).to_i # Convert to base 1024\n exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit\n number /= 1024 ** exponent\n\n unit_key = STORAGE_UNITS[exponent]\n unit = UNIT_NAMES[unit_key.to_sym]\n\n formatted_number = \"%.02f\" % number\n storage_units_format.gsub(/%n/, formatted_number).gsub(/%u/, unit)\n end\n end", "def volume\n a, b, c, d = @points\n ((a - d) % ((b - d) * (c - d))) / 6\n end", "def piece_count=(v)\n return if v.nil?\n @piece_count = v\n @piece_size = ((@local_path.size / v) / 1024.0).ceil * 1024 \n end", "def human_size\n number_to_human_size size\n end", "def update_unit_price\n return if @packs.empty?\n lowest = @packs.min_by{|pack| pack.quantity}\n @unit_price = (lowest.price / lowest.quantity).to_f.round(2)\n end", "def volume_factor(stock)\n 1.01 + (rand() * 0.0001 * stock.price) + (rand() * 0.0005)\n end", "def size\n sync{@size[0]}\n end", "def subunits=(n)\n self.base_factor = 10**n\n end", "def size\n Float::MAX.to_i\n end", "def vu(value=1)\n @music.vu(value.to_i)\n end", "def volume_of_sphere(radius)\n volume = (4.0/3.0)*3.141592654*(radius**3)\n return volume.to_i\nend", "def sfx_volume=(value)\n value = value.to_i.abs\n @sfx_volume = value < 101 ? value : 100\n end", "def volume_price(quantity, user=nil, currency=nil)\n compute_volume_price_quantities :volume_price, self.price, quantity, user, currency\n end", "def file_size\n number_to_human_size(super)\n end", "def size\n 4\n end", "def piece_size=(v)\n return unless v\n @piece_count = nil\n @piece_size = [v, 1024].max\n end", "def volume(amount: T.unsafe(nil)); end", "def calc_sphere_volume(radius)\n answer = (4.0/3.0)*Math::PI*(radius**3)\n return answer.round(1)\nend", "def volume_of_sphere(radius)\n volume = Math::PI * radius ** 3 * 4 / 3\n return volume.round(3)\nend", "def purchase_unit_factor\n return 1 if unit_id == inventory_unit_id\n return 1 / (pack_size || 1) if inventory_unit_id == pack_unit_id\n return 1 / (pack_size || 1) / (subpack_size || 1) if inventory_unit_id == subpack_unit_id\n 1\n end", "def size\n @size \n end", "def size\n @size \n end", "def three_sizes\n \"#{object.bust}-#{object.waist}-#{object.hip}\"\n end", "def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end", "def size=(size)\n end", "def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end", "def volume_of_sphere(sphere_r)\n return (4/3) * (3.14) * (sphere_r ** 3)\n end", "def bid_volume\n @bids.map { |x| x.fetch(:size) }.inject(:+)\n end", "def volume_ft3\n self.volume\n end", "def size\n return 3\n end", "def volumeOfSphere( r )\n return (4.0/3.0) * Math::PI * (r**3)\nend", "def fetch_volume_by_id\n vol = storage_api.find_by_id(volume_id)\n data = vol.body.fetch(\"volume\")\n @name = data.fetch('display_name')\n @volume_type = data.fetch('volume_type')\n @size = data.fetch('size')\n\n # Sometimes the Rackspace API takes time to update,\n # and newly-attached volumes don't report any attachments\n # yet.\n attachments = data.fetch('attachments')\n if attachments.any?\n @device = attachments.first.fetch('device')\n end\n end", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def gear_inches\n ratio * wheel.diameter\nend", "def retrieve_volumes\n dbg { \"retrieving #{pool_info}, #{hv_info}\" }\n\n volumes = pool.list_all_volumes\n dbg { \"list_all_volumes #{pool_info}, #{hv_info}\" }\n\n storage_volumes = volumes.map.with_index do |vol, index|\n id = \"#{uuid}--#{index}\"\n StorageVolume.new(vol, pool: self, id: id)\n end\n\n dbg { \"retrieved size=#{storage_volumes.size}, #{pool_info}, #{hv_info}\" }\n storage_volumes\n end", "def nice_size size\n number_to_human_size size, :precision => 0\n end", "def petabytes\n self * PETABYTE\n end", "def specific_max_size(number)\n [self.size, number].min\n end", "def total_volume\n quantity * Item.find(item_id).volume\n end", "def storage_volume\n chs = cumulative_surplus\n chs_min = chs.min\n\n chs.map { |val| val - chs_min }\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end" ]
[ "0.6204754", "0.5772888", "0.5600196", "0.5472153", "0.5405416", "0.5397362", "0.53869087", "0.53432214", "0.53106874", "0.52871823", "0.52752054", "0.52500933", "0.52413994", "0.5163299", "0.51154315", "0.5080425", "0.50712526", "0.5071105", "0.5050411", "0.5044691", "0.5040982", "0.50140053", "0.50092816", "0.50060683", "0.4998712", "0.49809486", "0.49746242", "0.4974197", "0.49620688", "0.49582228", "0.49473095", "0.49210754", "0.49199218", "0.49151516", "0.49004194", "0.4895835", "0.48829785", "0.4874582", "0.4870394", "0.48677114", "0.48667476", "0.4854825", "0.4852357", "0.48511446", "0.4848936", "0.48443818", "0.48415807", "0.4835034", "0.48316038", "0.48217067", "0.48021725", "0.480181", "0.47973958", "0.47952908", "0.47925794", "0.47871715", "0.47850847", "0.47756132", "0.47722661", "0.47644773", "0.4761971", "0.47600576", "0.47550538", "0.47500655", "0.47427973", "0.474116", "0.474116", "0.47356072", "0.47332063", "0.47320545", "0.47282416", "0.4725971", "0.4719083", "0.47110823", "0.4709141", "0.47077748", "0.4704221", "0.47005856", "0.4682052", "0.4679884", "0.4678612", "0.46729434", "0.46711332", "0.4667471", "0.46637115", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676", "0.46605676" ]
0.5373153
7
Returns USVolume object with size equal to the number in cups.
def cups Measurements::USVolume.new(self, :cup) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def size\n sku.size * amount\n end", "def piece_count=(v)\n return if v.nil?\n @piece_count = v\n @piece_size = ((@local_path.size / v) / 1024.0).ceil * 1024 \n end", "def piece_size=(v)\n return unless v\n @piece_count = nil\n @piece_size = [v, 1024].max\n end", "def size\n\t\t7500\n\tend", "def size(base = self.date_from)\n\t\t\t\t\treturn self.send(\"size_#{self.capacity_type.to_s}\", base)\n\t\t\t\tend", "def pints\n Measurements::USVolume.new(self, :pint)\n end", "def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end", "def size(value)\n new(dataset.size(value))\n end", "def pbSize(pokemon)\n dexdata = pbOpenDexData\n pbDexDataOffset(dexdata,pokemon.fSpecies,33)\n baseheight = dexdata.fgetw # Gets the base height in tenths of a meter\n dexdata.close\n hpiv = pokemon.iv[0]&15\n ativ = pokemon.iv[1]&15\n dfiv = pokemon.iv[2]&15\n spiv = pokemon.iv[3]&15\n saiv = pokemon.iv[4]&15\n sdiv = pokemon.iv[5]&15\n m = pokemon.personalID&0xFF\n n = (pokemon.personalID>>8)&0xFF\n s = (((ativ^dfiv)*hpiv)^m)*256+(((saiv^sdiv)*spiv)^n)\n xyz = []\n if s<10\n xyz = [290,1,0]\n elsif s<110\n xyz = [300,1,10]\n elsif s<310\n xyz = [400,2,110]\n elsif s<710\n xyz = [500,4,310]\n elsif s<2710\n xyz = [600,20,710]\n elsif s<7710\n xyz = [700,50,2710]\n elsif s<17710\n xyz = [800,100,7710]\n elsif s<32710\n xyz = [900,150,17710]\n elsif s<47710\n xyz = [1000,150,32710]\n elsif s<57710\n xyz = [1100,100,47710]\n elsif s<62710\n xyz = [1200,50,57710]\n elsif s<64710\n xyz = [1300,20,62710]\n elsif s<65210\n xyz = [1400,5,64710]\n elsif s<65410\n xyz = [1500,2,65210]\n else\n xyz = [1700,1,65510]\n end\n return (((s-xyz[2])/xyz[1]+xyz[0]).floor*baseheight/10).floor\nend", "def canonic_size( size )\n if canonic_type == :decimal && size.is_a?( Integer )\n [ size, 0 ]\n else\n size\n end\n end", "def size\n deck.size\n end", "def size\n return 3\n end", "def three_sizes\n \"#{object.bust}-#{object.waist}-#{object.hip}\"\n end", "def petabytes\n self * PETABYTE\n end", "def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend", "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end", "def nice_size size\n number_to_human_size size, :precision => 0\n end", "def create_cups kit, number_of_compartments\n for i in 1..number_of_compartments\n kit.cups.create(:commit_status => false, :status => true, :cup_number => i.to_i)\n end\n end", "def size_from_default\n DEFAULT_SIZE\n end", "def capacity; @capacity ||= sheet1_b10; end", "def size\n Stal.solve(redis, [\"SCARD\", key])\n end", "def size\n 4\n end", "def size\n @sizes ||= strip(:size)\n end", "def size\n @gapi[\"size\"]\n end", "def size\n easy = Curl::Easy.new\n easy.url = self.uri + \"/size\"\n easy.http_get\n\n raise(SesameException.new(easy.body_str)) unless easy.response_code == 200\n\n easy.body_str.to_i\n end", "def size\n @size \n end", "def size\n @size \n end", "def get_size\n\t\t[\"small\", \"medium\", \"large\"].sample\n\tend", "def size\n cards.size\n end", "def human_size\n count = 0\n n = size\n while n >= 1024 and count < 4\n n /= 1024.0\n count += 1\n end\n format(\"%.1f\",n) + %w(B kB MB GB TB)[count]\n end", "def human_size\n number_to_human_size size\n end", "def size_from_bytes(qty, unit)\n qty = qty.to_i\n case unit.downcase\n when \"b\", \"bytes\"\n qty.to_s\n when \"kb\", \"kilobytes\"\n (qty / 1000).to_s\n when \"kib\", \"kibibytes\"\n (qty / 1024).to_s\n when \"mb\", \"megabytes\"\n (qty / 1000000).to_s\n when \"m\", \"mib\", \"mebibytes\"\n (qty / 1048576).to_s\n when \"gb\", \"gigabytes\"\n (qty / 1000000000).to_s\n when \"g\", \"gib\", \"gibibytes\"\n (qty / 1073741824).to_s\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def set_variation_volume_size(size)\n @volume_size = size\n end", "def get_shirt_size\n return @size\n end", "def book_cover_size\n if book_cover.size > 2.megabytes\n errors.add(:book_cover, \"should be less than 2MB\")\n end\n end", "def get_shoe_size\n return prompt_positive_integer(\"Number of decks at table? [#{Decks::MIN_DECKS}]\", Decks::MIN_DECKS)\n end", "def making_coffee (number_of_cups = 1, minutes_per_cup = 0.8256)\n (number_of_cups * minutes_per_cup).round(2)\nend", "def size\n size = popen(%W(du -s), full_path).first.strip.to_i\n (size.to_f / 1024).round(2)\n end", "def bid_volume\n @bids.map { |x| x.fetch(:size) }.inject(:+)\n end", "def variant_with_size(size)\n self.variants.select{|v| v.size == size}.first || self.variants.where('size = ?', size).first\n end", "def d_size\n @diskObj.info[:capacity]\n end", "def cards_needed\n [@size, 5].min\n end", "def to_size\n self\n end", "def test_deck_display_size_fullDeck\n print \"Expected size of 81: Found \"\n Deck.new.display_size\n end", "def create_version\n v_stream= [60, \"Microsoft.Container.DataSpaces\".bytes.to_a, 1, 1, 1].flatten!.pack VERSION_PACKING\n Storage.new('Version', :data=>v_stream, :size=>v_stream.size)\n end", "def size=(value)\n @size = value\n end", "def size=(value)\n @size = value\n end", "def create_volume(options = {})\n options[:capacity] = options[:capacity] * GB if options[:capacity] < 100000\n vol = pool.create_volume_xml(Volume.to_xml(options))\n Volume.new vol, self\n end", "def size\n info[\"size\"]\n end", "def total_cups(n)\n\ttotal = (n / 6).to_i + n\nend", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end", "def fetch_disk_size\n total_size = 0\n total_size = `lsblk -b --output SIZE -d -n | paste -s -d + - | bc`\n number_to_human_size total_size\n end", "def size\r\n @pack.size\r\n end", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def size\n @info[:size]\n end", "def initialize(args={})\n @size = args[:size] # <- promoted from RoadBike\n end", "def size=(size)\n end", "def get_collections_size()\n uri = build_uri('info/collection_usage')\n @tools.process_get_request(uri, @user_obj.encrypted_login, @user_pwd).body\n end", "def size_mb \n return size / 1048576 # (1024 * 1024) \n end", "def top_copurchases(sku,n,counts)\n counts[sku].flatten.group_by(&:sku).sort{|a,b|b[1].length <=> a[1].length}[0..(n-1)].map{|a|[a[0],a[1].length]}\nend", "def price_unit_factor\n return 1 if unit_id == price_unit_id\n return pack_size || 1 if price_unit_id == pack_unit_id\n return (pack_size || 1) * (subpack_size || 1) if price_unit_id == subpack_unit_id\n return 1\n end", "def readable_file_size(size, precision)\n case\n #when size == 1 : \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\nend", "def readable_file_size(size, precision)\n case\n #when size == 1 : \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\nend", "def size\n attribute_prop(3)\n end", "def index\n @clips = Clip.all\n @size = 0.000\n @clips.each do |c|\n @size += c.video.byte_size\n @size += c.thumbnail.byte_size\n end\n end", "def bytes\n case hydra_model\n when \"Collection\"\n super\n else\n fetch(Solrizer.solr_name(\"file_size\", :stored_sortable, type: :long))\n end \n end", "def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end", "def microdong_size\n average = 28\n roll = Dice.roll(3, 5) - 22\n percent = (100 + roll * 3) / 100.0\n return (percent * average).to_i\nend", "def find_round_sizes(number, no_qual)\n rounds = how_many_rounds(number)\n rounds[0] = heat_sizes(no_qual)\n\n return rounds\n end", "def specific_max_size(number); end", "def human_size size_bytes\n size = size_bytes\n type = \"B\"\n\n %w{KB MB GB}.each do |t|\n if size > 1024\n size = size/1024\n type = t\n else\n break\n end\n end\n\n \"#{size}#{type}\"\nend", "def size size = nil\n @size = size.to_i if size\n @size\n end", "def size(num)\n params(size: num)\n end", "def initialize(size)\n @size = size\n end" ]
[ "0.59053004", "0.5895638", "0.53773814", "0.5276277", "0.5270556", "0.5211324", "0.515371", "0.5089328", "0.5083918", "0.5066057", "0.5033164", "0.50311327", "0.49864823", "0.49481007", "0.4923944", "0.4914555", "0.4902628", "0.48771346", "0.48523316", "0.48504195", "0.4837696", "0.4833915", "0.4832097", "0.48315236", "0.48245266", "0.4816189", "0.48080304", "0.47906435", "0.47906435", "0.47876102", "0.4778576", "0.4775257", "0.4757315", "0.47529447", "0.47528028", "0.474848", "0.4744221", "0.4742844", "0.47391078", "0.4738672", "0.47245824", "0.4721884", "0.4720963", "0.4708263", "0.4706952", "0.47039554", "0.4703572", "0.4692813", "0.4692813", "0.46924645", "0.46893707", "0.46775568", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.46774825", "0.4673753", "0.4669577", "0.4666744", "0.46569052", "0.46557018", "0.4645914", "0.46389583", "0.46352804", "0.46272215", "0.46232796", "0.46197692", "0.46186632", "0.46186632", "0.4618093", "0.46133003", "0.4608392", "0.46083295", "0.4607779", "0.4606117", "0.46054214", "0.46053824", "0.46008", "0.45988086", "0.45978653" ]
0.6999369
0
Returns USVolume object with size equal to the number in pints.
def pints Measurements::USVolume.new(self, :pint) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def size(num)\n params(size: num)\n end", "def bid_volume\n @bids.map { |x| x.fetch(:size) }.inject(:+)\n end", "def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end", "def retrieve_volumes\n dbg { \"retrieving #{pool_info}, #{hv_info}\" }\n\n volumes = pool.list_all_volumes\n dbg { \"list_all_volumes #{pool_info}, #{hv_info}\" }\n\n storage_volumes = volumes.map.with_index do |vol, index|\n id = \"#{uuid}--#{index}\"\n StorageVolume.new(vol, pool: self, id: id)\n end\n\n dbg { \"retrieved size=#{storage_volumes.size}, #{pool_info}, #{hv_info}\" }\n storage_volumes\n end", "def ask_volume\n @asks.map { |x| x.fetch(:size) }.inject(:+)\n end", "def piece_size=(v)\n return unless v\n @piece_count = nil\n @piece_size = [v, 1024].max\n end", "def create_version\n v_stream= [60, \"Microsoft.Container.DataSpaces\".bytes.to_a, 1, 1, 1].flatten!.pack VERSION_PACKING\n Storage.new('Version', :data=>v_stream, :size=>v_stream.size)\n end", "def piece_count=(v)\n return if v.nil?\n @piece_count = v\n @piece_size = ((@local_path.size / v) / 1024.0).ceil * 1024 \n end", "def size\n return 3\n end", "def specific_max_size(number)\n [self.size, number].min\n end", "def variation(size)\n ActiveStorage::Variation.new(combine_options(size))\n end", "def all_sizes\n [0.1, 0.5, 1, 5, 10]\n end", "def create_volume(options = {})\n options[:capacity] = options[:capacity] * GB if options[:capacity] < 100000\n vol = pool.create_volume_xml(Volume.to_xml(options))\n Volume.new vol, self\n end", "def petabytes\n self * PETABYTE\n end", "def get_size\n\t\t[\"small\", \"medium\", \"large\"].sample\n\tend", "def canonic_size( size )\n if canonic_type == :decimal && size.is_a?( Integer )\n [ size, 0 ]\n else\n size\n end\n end", "def size\n sku.size * amount\n end", "def initialize(size)\n @size = size\n end", "def get_prizes\n @prizes = Prize.all.shuffle.first(6)\n end", "def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end", "def pbSize(pokemon)\n dexdata = pbOpenDexData\n pbDexDataOffset(dexdata,pokemon.fSpecies,33)\n baseheight = dexdata.fgetw # Gets the base height in tenths of a meter\n dexdata.close\n hpiv = pokemon.iv[0]&15\n ativ = pokemon.iv[1]&15\n dfiv = pokemon.iv[2]&15\n spiv = pokemon.iv[3]&15\n saiv = pokemon.iv[4]&15\n sdiv = pokemon.iv[5]&15\n m = pokemon.personalID&0xFF\n n = (pokemon.personalID>>8)&0xFF\n s = (((ativ^dfiv)*hpiv)^m)*256+(((saiv^sdiv)*spiv)^n)\n xyz = []\n if s<10\n xyz = [290,1,0]\n elsif s<110\n xyz = [300,1,10]\n elsif s<310\n xyz = [400,2,110]\n elsif s<710\n xyz = [500,4,310]\n elsif s<2710\n xyz = [600,20,710]\n elsif s<7710\n xyz = [700,50,2710]\n elsif s<17710\n xyz = [800,100,7710]\n elsif s<32710\n xyz = [900,150,17710]\n elsif s<47710\n xyz = [1000,150,32710]\n elsif s<57710\n xyz = [1100,100,47710]\n elsif s<62710\n xyz = [1200,50,57710]\n elsif s<64710\n xyz = [1300,20,62710]\n elsif s<65210\n xyz = [1400,5,64710]\n elsif s<65410\n xyz = [1500,2,65210]\n else\n xyz = [1700,1,65510]\n end\n return (((s-xyz[2])/xyz[1]+xyz[0]).floor*baseheight/10).floor\nend", "def specific_max_size(number); end", "def run_primitive(input, output, number_of_primitives, size)\n system('primitive',\n '-i', input,\n '-o', output,\n '-n', number_of_primitives.to_s,\n '-m', '0',\n '-s', size.to_s)\n end", "def volume (l, w, h)\n\tl * w * h\nend", "def initialize(size = 2)\n raise ArgumentError if size < 1\n @pool = size\n end", "def initialize(number = 0, size = DEFAULT_SIZE)\n @number, @size = number, size\n raise ArgumentError, \"number must be =< #{max_number}\" if number > max_number\n end", "def volume(options)\n options[:width] * options[:height] * options[:depth]\nend", "def set_variation_volume_size(size)\n @volume_size = size\n end", "def size\n 4\n end", "def variant_with_size(size)\n self.variants.select{|v| v.size == size}.first || self.variants.where('size = ?', size).first\n end", "def initialize(args={})\n @size = args[:size] # <- promoted from RoadBike\n end", "def vsize\n (weight.to_f / 4).ceil\n end", "def size=(size)\n end", "def size\n @parts.size\n end", "def volume\n @length * @width * @depth\n end", "def initialize( description, price )\n\n @id = rand(100..999)\n @description = description\n @price = price\n @size = []\n\n end", "def create_parcel_slot_lot(number)\n @max_key = number\n @slot_numbers = Slot.generate_slot_numbers(number)\n @parcel = Parcel.new\n puts \"Created a parcel slot with #{number} slots\"\nend", "def vcpus\n OpenStruct.new(count: max_vcpus)\n end", "def size(value)\n new(dataset.size(value))\n end", "def interpret_size(size); end", "def volume_calc(length,width,height)\n volume = length * width * height\n end", "def volumen(numero, opciones = {})\n volumen = numero\n volumenes << volumen\n end", "def uniq_sizes\n real_variants.uniq(&:size)\n end", "def sample_size\n @n\n end", "def pizza_size \n\tsize = [\"small\", \"medium\", \"large\", \"super\", \"giganto\"].sample # .sample randomizing all the sizes\nend", "def prodenum(n)\n $primitives ||= primitives(90)\n $new_number_products_cache ||= Array.new(4, [])\n\n result = (4..n).to_a.flat_map { |i| primitives_combinations(i) }\n (result | [1].concat($primitives.select { |pr| pr <= n })).sort\n end", "def human_size\n number_to_human_size size\n end", "def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def volume \n puts \"The volume is #{@length * @width * @height}\"\n end", "def volume\n return nil if dimension_u.nil? || dimension_v.nil? || dimension_w.nil?\n (dimension_u * dimension_v * dimension_w) / 1_000_000_000.0\n end", "def initialize size=6, mines=20\n @size = size\n @mines = mines\n end", "def size\n @sizes ||= strip(:size)\n end", "def size\n\t\t7500\n\tend", "def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def size\n @n\n end", "def size\n @n\n end", "def size(*) end", "def size(*) end", "def size(base = self.date_from)\n\t\t\t\t\treturn self.send(\"size_#{self.capacity_type.to_s}\", base)\n\t\t\t\tend", "def nice_size size\n number_to_human_size size, :precision => 0\n end", "def file_number_initial_value\n @file_number ||= 100_000\n # this seed file creates 40 new veterans on each run, 100 is sufficient margin to add more data\n @file_number += 100 while Veteran.find_by(file_number: format(\"%<n>09d\", n: @file_number))\n @file_number\n end", "def my_size\n 1\n end", "def size\n @p.size\n end", "def initialize phenotype_count, orthogroup_count, storage_count\n # Make sure to provide storage_count + phenotype_count as the initial capacity, since otherwise a resize will be needed.\n super([phenotype_count, orthogroup_count], 0, capacity: storage_count+phenotype_count+1, stype: :yale, dtype: :byte)\n @skip_table = {}\n end", "def lv_create_size_in_kb(logical_volume_name, volume_group, size_in_kb)\n External.cmd(@server, \"#{@command} lvcreate -l #{size_in_kb} -n #{logical_volume_name} #{volume_group.name}\") if volume_group_check_space_in_kb(volume_group,size_in_kb)\n end", "def number_of_voices(n)\n # Check the number of voices is valid.\n if [1, 2, 3, 4].include?(n)\n @metadata[:number_of_voices] = n\n else\n raise \"There must be 1, 2, 3 or 4 voices, not #{ n }.\"\n end\n return self\n end", "def size\n @size \n end", "def size\n @size \n end", "def three_sizes\n \"#{object.bust}-#{object.waist}-#{object.hip}\"\n end", "def size\n\tparts.size\nend", "def size=(value)\n @size = value\n end", "def size=(value)\n @size = value\n end", "def initialize unit_size = 256 # defaults to 256\n\t\t\t@unit_size = unit_size\n\t\tend", "def cells(n)\n n * @vm.databytes\n end", "def get_volume_of_cuboid(length, width, height)\n return length * width * height\nend", "def load_factor\n @items / self.get_size\n end", "def read_uint_by_size(size)\n case size\n when 1\n read_uint8\n when 2\n read_uint16\n when 3\n read_uint24\n when 4\n read_uint32\n when 6\n read_uint48\n when 8\n read_uint64\n else\n raise \"Integer size #{size} not implemented\"\n end\n end", "def size_integer(base = self.date_from)\n\t\t\t\t\t@sizes = {} if @sizes.nil?\n\t\t\t\t\tif @sizes[base.to_s].nil?\n\t\t\t\t\t\tsize = 0\n\t\t\t\t\t\tself.reservations(base).each do |reservation|\n\t\t\t\t\t\t\tif reservation.above_line?\n\t\t\t\t\t\t\t\tsize += reservation.size\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@sizes[base.to_s] = size\n\t\t\t\t\tend\n\t\t\t\t\treturn @sizes[base.to_s]\n\t\t\t\tend", "def initialize(number_of_players)\n @players = []\n number_of_players.times {|n| @players << Player.new}\n end", "def slot_size (size)\r\n @slot_size = size\r\n end", "def file_size\n number_to_human_size(super)\n end", "def load_factor\n @item_count/ size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end" ]
[ "0.54818875", "0.52362853", "0.51518744", "0.50460017", "0.49586555", "0.4953716", "0.49293515", "0.49263522", "0.49217504", "0.49129778", "0.49011004", "0.48987666", "0.48982686", "0.48757625", "0.48498526", "0.48389614", "0.4837991", "0.4832898", "0.4831524", "0.48302537", "0.4827883", "0.48252374", "0.48009086", "0.47898573", "0.47881916", "0.47830528", "0.47761637", "0.4775709", "0.4770604", "0.476154", "0.47584867", "0.4756442", "0.4754485", "0.47441626", "0.4725603", "0.47238702", "0.46898812", "0.4685974", "0.46823278", "0.46776578", "0.46773615", "0.46754315", "0.46725312", "0.46489018", "0.4641775", "0.46416482", "0.46357492", "0.4630451", "0.46294057", "0.46227953", "0.45934162", "0.4588038", "0.45789593", "0.4575913", "0.45750052", "0.45745525", "0.4570447", "0.4570447", "0.45680678", "0.45680678", "0.45625094", "0.4560921", "0.45449165", "0.4544013", "0.45415273", "0.4539096", "0.45283508", "0.45245707", "0.4522925", "0.4522925", "0.45218593", "0.45126915", "0.4511969", "0.4511969", "0.44924846", "0.44892782", "0.44892317", "0.44876292", "0.44838065", "0.44819966", "0.4481668", "0.44800752", "0.4479207", "0.44790992", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935", "0.446935" ]
0.591707
0
Returns USVolume object with size equal to the number in quarts.
def quarts Measurements::USVolume.new(self, :quart) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def size\n sku.size * amount\n end", "def get_volume_of_cuboid(length, width, height)\n return length * width * height\nend", "def create_version\n v_stream= [60, \"Microsoft.Container.DataSpaces\".bytes.to_a, 1, 1, 1].flatten!.pack VERSION_PACKING\n Storage.new('Version', :data=>v_stream, :size=>v_stream.size)\n end", "def volume\n @length * @width * @depth\n end", "def pints\n Measurements::USVolume.new(self, :pint)\n end", "def set_variation_volume_size(size)\n @volume_size = size\n end", "def volume\n return nil if dimension_u.nil? || dimension_v.nil? || dimension_w.nil?\n (dimension_u * dimension_v * dimension_w) / 1_000_000_000.0\n end", "def volume (l, w, h)\n\tl * w * h\nend", "def variant_with_size(size)\n self.variants.select{|v| v.size == size}.first || self.variants.where('size = ?', size).first\n end", "def cups\n Measurements::USVolume.new(self, :cup) \n end", "def volume(options)\n options[:width] * options[:height] * options[:depth]\nend", "def volume \n puts \"The volume is #{@length * @width * @height}\"\n end", "def volume_factor(stock)\n 1.01 + (rand() * 0.0001 * stock.price) + (rand() * 0.0005)\n end", "def size\n @mp3s.size\n end", "def variation(size)\n ActiveStorage::Variation.new(combine_options(size))\n end", "def three_sizes\n \"#{object.bust}-#{object.waist}-#{object.hip}\"\n end", "def size_from_bytes(qty, unit)\n qty = qty.to_i\n case unit.downcase\n when \"b\", \"bytes\"\n qty.to_s\n when \"kb\", \"kilobytes\"\n (qty / 1000).to_s\n when \"kib\", \"kibibytes\"\n (qty / 1024).to_s\n when \"mb\", \"megabytes\"\n (qty / 1000000).to_s\n when \"m\", \"mib\", \"mebibytes\"\n (qty / 1048576).to_s\n when \"gb\", \"gigabytes\"\n (qty / 1000000000).to_s\n when \"g\", \"gib\", \"gibibytes\"\n (qty / 1073741824).to_s\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def size\n @parts.size\n end", "def bid_volume\n @bids.map { |x| x.fetch(:size) }.inject(:+)\n end", "def volume\n return (4.0/3.0) * Math::PI * self.radius**3\n end", "def volume_calc(length,width,height)\n volume = length * width * height\n end", "def size\n return 3\n end", "def size\n 4\n end", "def volume_of_cube(length)\n return length ** 3\nend", "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end", "def volume_of_cube(length)\n return length **3\nend", "def volume\n return @width * @height / @depth\n end", "def volume\n a, b, c, d = @points\n ((a - d) % ((b - d) * (c - d))) / 6\n end", "def uniq_sizes\n real_variants.uniq(&:size)\n end", "def size(base = self.date_from)\n\t\t\t\t\treturn self.send(\"size_#{self.capacity_type.to_s}\", base)\n\t\t\t\tend", "def round\n Quantity.new(@value.round, @unit)\n end", "def size\n return @songs.length\n end", "def piece_size=(v)\n return unless v\n @piece_count = nil\n @piece_size = [v, 1024].max\n end", "def volume_of_cube(length)\n return length**3\nend", "def volume_of_cube(length)\n return length**3\nend", "def volume_of_sphere(sphere_r)\n return (4/3) * (3.14) * (sphere_r ** 3)\n end", "def vsize\n (weight.to_f / 4).ceil\n end", "def volume_of_cube(n)\n return n * n * n\nend", "def size\n\tparts.size\nend", "def volumen(numero, opciones = {})\n volumen = numero\n volumenes << volumen\n end", "def test_volume_of_sphere()\n first_volume = sphere_volume(1)\n second_volume = sphere_volume(3)\n third_volume = sphere_volume(5)\n assert_equal(4/3 * Math::PI * 1 ** 3, first_volume)\n assert_equal(4/3 * Math::PI * 3 ** 3, second_volume)\n assert_equal(4/3 * Math::PI * 5 ** 3, third_volume)\n end", "def number_of_voices(n)\n # Check the number of voices is valid.\n if [1, 2, 3, 4].include?(n)\n @metadata[:number_of_voices] = n\n else\n raise \"There must be 1, 2, 3 or 4 voices, not #{ n }.\"\n end\n return self\n end", "def get_volume\n @volume\n end", "def volume_of_cube(length_of_the_side)\nreturn length_of_the_side.to_i**3\nend", "def sfx_volume\n return @sfx_volume\n end", "def normalize_size_to(integer)\n until size >= integer\n unshift 0\n end\n self\n end", "def size(num)\n params(size: num)\n end", "def size(value)\n new(dataset.size(value))\n end", "def subunits=(n)\n self.base_factor = 10**n\n end", "def volume_of_cube(length_of_side)\n return length_of_side ** 3\nend", "def floor\n Quantity.new(@value.floor, @unit)\n end", "def size\n\t\t7500\n\tend", "def get_size\n\t\t[\"small\", \"medium\", \"large\"].sample\n\tend", "def volume; self.class.volume; end", "def volume_of_cube(side_length)\n volume = side_length **3\n #return volume\nend", "def volume_price(quantity, user=nil, currency=nil)\n compute_volume_price_quantities :volume_price, self.price, quantity, user, currency\n end", "def update_storage_size_from_s3\n FetchS3ObjectLengthJob.perform_later(self.class.to_s, self.id)\n end", "def volume_of_a_cube(n)\n return n**3\nend", "def vu(value=1)\n @music.vu(value.to_i)\n end", "def cube_vol(length, dimension = 3)\n check_pre((length.nat? and dimension.int_pos?))\n length**dimension\nend", "def sfx_volume=(value)\n value = value.to_i.abs\n @sfx_volume = value < 101 ? value : 100\n end", "def initialize(name, size)\n @name = name\n @size = size\n end", "def get_shirt_size\n return @size\n end", "def initialize(size)\n @size = size\n end", "def volume_of_cube(side_length)\n return side_length ** 3\nend", "def volume_of_cube(s)\n return (s ** 3)\nend", "def volume_of_sphere(radius)\n volume = Math::PI * radius ** 3 * 4 / 3\n return volume.round(3)\nend", "def test_volume_of_cube()\n first_volume = cube_volume(1)\n second_volume = cube_volume(3)\n third_volume = cube_volume(5)\n assert_equal(1, first_volume)\n assert_equal(27, second_volume)\n assert_equal(125, third_volume)\n end", "def create_volume(options = {})\n options[:capacity] = options[:capacity] * GB if options[:capacity] < 100000\n vol = pool.create_volume_xml(Volume.to_xml(options))\n Volume.new vol, self\n end", "def initialize unit_size = 256 # defaults to 256\n\t\t\t@unit_size = unit_size\n\t\tend", "def test_volume_of_cube()\n first_volume = volume_of_a_cube (3) \n assert_equal(27,first_volume)\n end", "def piece_count=(v)\n return if v.nil?\n @piece_count = v\n @piece_size = ((@local_path.size / v) / 1024.0).ceil * 1024 \n end", "def volume_of_sphere(radius)\n return 3.14 * 4 / 3 * (radius ** 3)\n return volume\nend", "def series_volume\n end", "def size\n deck.size\n end", "def volumeOfSphere( r )\n return (4.0/3.0) * Math::PI * (r**3)\nend", "def volume_of_cube(side_length)\n return (side_length ** 3)\nend", "def calc_sphere_volume(radius)\n answer = (4.0/3.0)*Math::PI*(radius**3)\n return answer.round(1)\nend", "def get_song_by_number(number)\n songs.find_by_song_number(number)\n end", "def cubed\n Quantity.new(@value, @unit * @unit * @unit)\n end", "def canonic_size( size )\n if canonic_type == :decimal && size.is_a?( Integer )\n [ size, 0 ]\n else\n size\n end\n end", "def find_round_sizes(number, no_qual)\n rounds = how_many_rounds(number)\n rounds[0] = heat_sizes(no_qual)\n\n return rounds\n end", "def ask_volume\n @asks.map { |x| x.fetch(:size) }.inject(:+)\n end", "def to_human_size(options = {})\n number = Float(self)\n\n storage_units_format = \"%n %u\"\n\n if number.to_i < 1024\n unit = UNIT_NAMES[:byte][:other]\n storage_units_format.gsub(/%n/, number.to_i.to_s).gsub(/%u/, unit)\n else\n max_exp = STORAGE_UNITS.size - 1\n exponent = (Math.log(number) / Math.log(1024)).to_i # Convert to base 1024\n exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit\n number /= 1024 ** exponent\n\n unit_key = STORAGE_UNITS[exponent]\n unit = UNIT_NAMES[unit_key.to_sym]\n\n formatted_number = \"%.02f\" % number\n storage_units_format.gsub(/%n/, formatted_number).gsub(/%u/, unit)\n end\n end", "def all_sizes\n [0.1, 0.5, 1, 5, 10]\n end", "def size=(size)\n end", "def volume_of_sphere(radius)\n volume = (4.0/3.0)*3.141592654*(radius**3)\n return volume.to_i\nend", "def volume_of_sphere(r)\n return (((4*(MATH::PI))/3)*r**3).round()\nend", "def storage_volume\n chs = cumulative_surplus\n chs_min = chs.min\n\n chs.map { |val| val - chs_min }\n end", "def find_volume_of_cube (length, width, height, lwh)\n puts \"The volume is #{length}*#{width}*#{height}= #{lwh}\"\nend", "def autosizedHydronicTubingLength\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n\n model = self.model\n\n sql = model.sqlFile\n\n if sql.is_initialized\n sql = sql.get\n\n query = \"SELECT Value\n FROM tabulardatawithstrings\n WHERE ReportName='ComponentSizingSummary'\n AND ReportForString='Entire Facility'\n AND TableName='ZoneHVAC:LowTemperatureRadiant:VariableFlow'\n AND RowName='#{name}'\n AND ColumnName='Design Size Hydronic Tubing Length'\n AND Units='m'\"\n\n val = sql.execAndReturnFirstDouble(query)\n\n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n\n end\n\n return result\n\n end", "def test_volume_of_sphere()\n volume = volume_of_sphere(4)\n assert_equal(267, volume) #Had to take off the decimals and then change the whole equation to \n #an integer (.to_i) to take the answers decimal places off as Ruby could not handle rounding etc.\n end", "def autosizedPlantLoopVolume\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n \n model = self.model\n \n sql = model.sqlFile\n \n if sql.is_initialized\n sql = sql.get\n \n query = \"SELECT Value \n FROM tabulardatawithstrings \n WHERE ReportName='ComponentSizingSummary' \n AND ReportForString='Entire Facility' \n AND TableName='PlantLoop' \n AND RowName='#{name}' \n AND ColumnName='Plant Loop Volume'\n AND Units='m3'\"\n \n val = sql.execAndReturnFirstDouble(query)\n \n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n \n end\n\n return result\n \n end", "def fl_oz\n Measurements::USVolume.new(self, :fl_oz)\n end", "def readable_file_size(size, precision)\n case\n #when size == 1 : \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\nend", "def readable_file_size(size, precision)\n case\n #when size == 1 : \"1 B\"\n when size < KILO_SIZE then \"%d B\" % size\n when size < MEGA_SIZE then \"%.#{precision}f K\" % (size / KILO_SIZE)\n when size < GIGA_SIZE then \"%.#{precision}f M\" % (size / MEGA_SIZE)\n else \"%.#{precision}f G\" % (size / GIGA_SIZE)\n end\nend", "def music_volume\n return @music_volume\n end", "def get_prizes\n @prizes = Prize.all.shuffle.first(6)\n end", "def total_volume\n quantity * Item.find(item_id).volume\n end" ]
[ "0.58693725", "0.57066494", "0.55376124", "0.5508433", "0.54773945", "0.5356651", "0.5325346", "0.5288244", "0.52838975", "0.52795494", "0.52773076", "0.526648", "0.52329814", "0.51955104", "0.51882565", "0.51796865", "0.5142378", "0.511737", "0.50706977", "0.5068005", "0.50496745", "0.50482595", "0.5039974", "0.5013609", "0.5007686", "0.49777445", "0.49751952", "0.4964592", "0.49556312", "0.49537376", "0.49229327", "0.49066514", "0.48923722", "0.48895893", "0.48848593", "0.48848593", "0.4883297", "0.48832193", "0.48811466", "0.48739147", "0.4851201", "0.4845808", "0.48412386", "0.48383725", "0.48375252", "0.4836912", "0.48225114", "0.48167896", "0.47921613", "0.4790975", "0.47895637", "0.47834432", "0.477562", "0.47680342", "0.47676146", "0.47673112", "0.4763948", "0.47604474", "0.4757604", "0.47475123", "0.47448093", "0.47444126", "0.4742613", "0.47421363", "0.47419894", "0.47410026", "0.47398838", "0.47331744", "0.47304738", "0.47303873", "0.47228897", "0.47226602", "0.47224888", "0.47203097", "0.47196454", "0.47158626", "0.47087854", "0.4708569", "0.47070244", "0.47054306", "0.47011766", "0.46968764", "0.46948224", "0.469456", "0.46940178", "0.4687771", "0.46838462", "0.46765813", "0.4671863", "0.467016", "0.46653458", "0.46593055", "0.46551105", "0.4652327", "0.46439743", "0.46368316", "0.46368316", "0.46300516", "0.46255842", "0.46217355" ]
0.6697649
0
Returns USVolume object with size equal to the number in gallons.
def gallons Measurements::USVolume.new(self, :gallon) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preboil_volume_gallons\n boil_off_gallons + @batch_size_gallons\n end", "def volume_size\n # If not user-specified, I'm using a fudge factor of 1.5 on the volume size -- arbitrarily chosen\n @volume_size || (`du -x #{volume_to_bundle}`.split(/\\n/)[-1].split[0].to_f * 1.5 / 1024).ceil\n end", "def size\n @gapi[\"size\"]\n end", "def load()\n return @population/@size\n end", "def canonic_size( size )\n if canonic_type == :decimal && size.is_a?( Integer )\n [ size, 0 ]\n else\n size\n end\n end", "def size\n\t\t7500\n\tend", "def size\n sku.size * amount\n end", "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end", "def volume\n @length * @width * @depth\n end", "def size(num)\n params(size: num)\n end", "def get_public_genotype\n if self.marker.class.to_s == \"Snp\"\n return self.genotype_allele\n else\n return self.size\n end\n end", "def vsize\n (weight.to_f / 4).ceil\n end", "def specific_max_size(number)\n [self.size, number].min\n end", "def getBasePart(max,rerolls=[])\n z=Density.new\n z.delete(0)\n z.fail=true\n z.exact=false\n z.uniform=false\n n=max - rerolls.reject{ |n| n==max }.size\n for k in (1..(max-1)).reject{ |n| rerolls.include?n } do\n z[k]=Rational(1,n)\n end\n return z\n end", "def get_size\n\t\t[\"small\", \"medium\", \"large\"].sample\n\tend", "def getBasePart(max,rerolls=[])\n z=Density.new\n z.delete(0)\n z.exact=false\n z.fail=true\n z.uniform=false\n n=max - rerolls.reject{ |n| n==max }.size\n for k in (1..(max-1)).reject{ |n| rerolls.include?n } do\n z[k]=Rational(1,n)\n end\n return z\n end", "def size\n 4\n end", "def variant_with_size(size)\n self.variants.select{|v| v.size == size}.first || self.variants.where('size = ?', size).first\n end", "def size(base = self.date_from)\n\t\t\t\t\treturn self.send(\"size_#{self.capacity_type.to_s}\", base)\n\t\t\t\tend", "def all_sizes\n [0.1, 0.5, 1, 5, 10]\n end", "def volume (l, w, h)\n\tl * w * h\nend", "def create_version\n v_stream= [60, \"Microsoft.Container.DataSpaces\".bytes.to_a, 1, 1, 1].flatten!.pack VERSION_PACKING\n Storage.new('Version', :data=>v_stream, :size=>v_stream.size)\n end", "def specific_max_size(number); end", "def size(value)\n new(dataset.size(value))\n end", "def human_size\n number_to_human_size size\n end", "def bid_volume\n @bids.map { |x| x.fetch(:size) }.inject(:+)\n end", "def initialize(size)\n @size = size\n end", "def size\n case\n when @count < 1000 then 'tiny'\n when @count < 2000 then 'small'\n when @count < 3000 then 'medium'\n when @count < 4000 then 'large'\n when @count < 5000 then 'hefty'\n else 'massive'\n end\n end", "def size\n {\n \"x\" => @gdalfile.RasterXSize,\n \"y\" => @gdalfile.RasterYSize,\n \"bands\" => @bands.length,\n \"data_type\" => @bands[0].data_type()\n }\n end", "def get_shirt_size\n return @size\n end", "def size_d(floc)\n \"#{gene_d(floc)}/#{@win_size}\"\n\n end", "def volume\n return nil if dimension_u.nil? || dimension_v.nil? || dimension_w.nil?\n (dimension_u * dimension_v * dimension_w) / 1_000_000_000.0\n end", "def getSize() \n @obj.getSize()\n end", "def pints\n Measurements::USVolume.new(self, :pint)\n end", "def gigabytes\n self * GIGABYTE\n end", "def size=(size)\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n sync{@size[0]}\n end", "def size\n num_geometries\n end", "def size\n @n\n end", "def size\n @n\n end", "def length\n genes.length\n end", "def size\n return 3\n end", "def get_volume_of_cuboid(length, width, height)\n return length * width * height\nend", "def size\n @size \n end", "def size\n @size \n end", "def total_servingSize\n food.servingSize * quantity\n end", "def retrieve_volumes\n dbg { \"retrieving #{pool_info}, #{hv_info}\" }\n\n volumes = pool.list_all_volumes\n dbg { \"list_all_volumes #{pool_info}, #{hv_info}\" }\n\n storage_volumes = volumes.map.with_index do |vol, index|\n id = \"#{uuid}--#{index}\"\n StorageVolume.new(vol, pool: self, id: id)\n end\n\n dbg { \"retrieved size=#{storage_volumes.size}, #{pool_info}, #{hv_info}\" }\n storage_volumes\n end", "def set_variation_volume_size(size)\n @volume_size = size\n end", "def piece_count=(v)\n return if v.nil?\n @piece_count = v\n @piece_size = ((@local_path.size / v) / 1024.0).ceil * 1024 \n end", "def initialize(args={})\n @size = args[:size] # <- promoted from RoadBike\n end", "def petabytes\n self * PETABYTE\n end", "def initialize size=6, mines=20\n @size = size\n @mines = mines\n end", "def size=(value)\n @size = value\n end", "def size=(value)\n @size = value\n end", "def to_size\n self\n end", "def variation(size)\n ActiveStorage::Variation.new(combine_options(size))\n end", "def volume\n return @width * @height / @depth\n end", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def piece_size=(v)\n return unless v\n @piece_count = nil\n @piece_size = [v, 1024].max\n end", "def to_level raw_size\n\t\t\tMath.log2(1.0 * raw_size / @unit_size).ceil\n\t\tend", "def volume_calc(length,width,height)\n volume = length * width * height\n end", "def autosizedHydronicTubingLength\n\n result = OpenStudio::OptionalDouble.new()\n\n name = self.name.get.upcase\n\n model = self.model\n\n sql = model.sqlFile\n\n if sql.is_initialized\n sql = sql.get\n\n query = \"SELECT Value\n FROM tabulardatawithstrings\n WHERE ReportName='ComponentSizingSummary'\n AND ReportForString='Entire Facility'\n AND TableName='ZoneHVAC:LowTemperatureRadiant:VariableFlow'\n AND RowName='#{name}'\n AND ColumnName='Design Size Hydronic Tubing Length'\n AND Units='m'\"\n\n val = sql.execAndReturnFirstDouble(query)\n\n if val.is_initialized\n result = OpenStudio::OptionalDouble.new(val.get)\n end\n\n end\n\n return result\n\n end", "def gear_inches\n ratio * diameter\nend", "def three_sizes\n \"#{object.bust}-#{object.waist}-#{object.hip}\"\n end", "def initialize(size)\n @grid = Array.new(size) {Array.new(size, :N)}\n @size = size * size\n end", "def cells(n)\n n * @vm.databytes\n end", "def size\n @players.size\n end", "def volume\n return (4.0/3.0) * Math::PI * self.radius**3\n end", "def create_volume(options = {})\n options[:capacity] = options[:capacity] * GB if options[:capacity] < 100000\n vol = pool.create_volume_xml(Volume.to_xml(options))\n Volume.new vol, self\n end", "def to_gb\n self / 1073741824\n end", "def size; @size end", "def initialize(number = 0, size = DEFAULT_SIZE)\n @number, @size = number, size\n raise ArgumentError, \"number must be =< #{max_number}\" if number > max_number\n end", "def size\n @public_holiday_specifications.size\n end", "def size #:nodoc:\n 1\n end", "def size #:nodoc:\n 1\n end", "def per_person\n (total_bill / @party_size).ceil.to_i\n end" ]
[ "0.54164016", "0.54120004", "0.54046893", "0.51552993", "0.5092678", "0.5036013", "0.5012161", "0.5001489", "0.49648178", "0.49374592", "0.49356452", "0.49311453", "0.49130836", "0.4911076", "0.4909478", "0.49091643", "0.4909143", "0.49090102", "0.48976865", "0.48694587", "0.486169", "0.48598656", "0.48552746", "0.48543814", "0.48331115", "0.4820242", "0.47920954", "0.47915125", "0.47836396", "0.4777469", "0.47674012", "0.47585183", "0.47537193", "0.47459108", "0.47394198", "0.47130263", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.4707286", "0.47064993", "0.47063324", "0.46999675", "0.46999675", "0.46835035", "0.4682348", "0.46811426", "0.46790567", "0.46790567", "0.4677236", "0.4667842", "0.46669942", "0.4659838", "0.4656859", "0.46476114", "0.46475536", "0.46473476", "0.46473476", "0.4641473", "0.46371615", "0.46329057", "0.4632509", "0.4627034", "0.46269965", "0.46148974", "0.46145174", "0.46084464", "0.46006322", "0.4600188", "0.45966482", "0.45915636", "0.45911777", "0.4586133", "0.45850825", "0.45842347", "0.45835721", "0.4582871", "0.45576984", "0.45576984", "0.45560732" ]
0.6488842
0
properly formats the time
def padded(num) if num <= 0 "00" elsif num < 10 "0" + num.to_s else num.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formattimeanddate(unformattedtime)\n unformattedtime.strftime('%I:%M:%S %p - %d %m %Y')\n end", "def format_time(time)\n return time.strftime(\"%l:%M%p\")\n end", "def format_time\n hours = format_hour @hour\n minutes = format_minute @minutes\n ampm = @hour < 12 ? @@ampm_hash['a'] : @@ampm_hash['p']\n time = ''\n time += hours[0] + minutes[0] + ' ' + ampm[0] + \"\\n\"\n time += hours[1] + minutes[1] + ' ' + ampm[1] + \"\\n\"\n time += hours[2] + minutes[2] + ' ' + ampm[2] + \"\\n\"\n time\n end", "def time_format(time)\n\t if time\n\t time.strftime(\"%d/%m/%Y %H:%M\")\n\t end\n\tend", "def format_time(time)\n strftime_preset = '%Y-%m-%dT%l:%M:%S%z'\n time.strftime(strftime_preset)\n end", "def formattime2(unformattedtime)\n unformattedtime.strftime('%H:%M:%S')\n end", "def fmt_time(dt) _format_dt dt, H12_M_PM end", "def formatTime( time )\n hours = 0\n minutes = 0\n time[/(\\d+):(\\d+)/]\n hours = $1.to_i\n minutes = $2.to_i\n if time.include? \"PM\"\n if( hours!=12 )\n hours += 12\n end \n end \n if time.include? \"AM\"\n if (hours == 12)\n hours = 0\n end\n end\n # The year, month and day are irrelevant. \n return Time.local( 1, 1, 1, hours, minutes, 0)\n end", "def proper_time(time)\n\tTime.at(time).gmtime.strftime('%R:%S')\nend", "def normalize_time\n if time.present?\n Time::DATE_FORMATS[:ms] = \"%M:%S\"\n self.time = \"0:#{time.to_formatted_s(:ms)}\".to_time\n end\n end", "def fmt_time(t)\n if t.present?\n ApplicationHelper.localtime(t).strftime(ApplicationHelper.gen_time_fmt)\n end\n end", "def tt(time, format=:short); '13:37'; end", "def approach_time_format\n \"%b %e, %Y %l:%M%p\"\n end", "def display_time(time)\n time.strftime(\"%Y-%m-%d %H:%M\") rescue \"-\"\n end", "def display_time(time)\n time.strftime(\"%Y-%m-%d %H:%M\") rescue \"-\"\n end", "def display_time(time)\n time.strftime(\"%Y-%m-%d %H:%M\") rescue \"-\"\n end", "def format_time(time)\n part = time.strftime(@time_pattern)\n\n if(!GRUtil.is_empty?(part))\n part\n else\n \"\"\n end\n end", "def display_datetime(time)\n time.strftime('%e %B, %l:%M%p')\n end", "def update_time_formats!\n Time::DATE_FORMATS.update(\n :db => '%Y-%m-%d %H:%M:%S',\n :ui => '%d.%m.%Y %H:%M',\n :yaml => '%Y-%m-%d %H:%M:%S %:z', # For DateTimes\n :default => lambda do |time|\n non_zero_time = time.hour != 0 || time.min != 0 || time.sec != 0\n time.strftime(non_zero_time ? '%d.%m.%Y %H:%M' : '%d.%m.%Y')\n end\n )\n end", "def format_time(time)\n time = Time.at(time / 1e6, time % 1e6)\n return time.strftime(\"%FT%TZ\")\n end", "def formatted_time\n start_time = \"#{self.start_time.strftime(\"%l:%M\")} #{self.start_time.strftime(\"%p\")}\"\n end_time = \"#{self.end_time.strftime(\"%l:%M\")} #{self.end_time.strftime(\"%p\")}\"\n \"#{start_time} - #{end_time}\"\n end", "def timeformat_change(time)\n from_format = time.to_s.split(\" \")\n from_format = \"#{from_format[0]} #{from_format[1]}\"\n return from_format\n end", "def time_format(time)\n time.strftime('%F %r') + \" \" + time.zone\n end", "def format_start(start_time)\n start_time.strftime('%H:%M')\n end", "def time_format(seconds)\nend", "def time_format(seconds)\nend", "def format_time(time)\n hour = time.hour\n min = time.min\n if min >= 30\n hour += 1\n min = 0\n else\n min = 30\n end\n\n d = Time.now\n Time.new(d.year,d.month,d.day,hour,min,0)\n\n end", "def time_format\n return @time_format\n end", "def nice_time(time)\n time = time.to_i\n return \"\" if time == 0\n h = time / 3600\n m = (time - (3600 * h)) / 60\n s = time - (3600 * h) - (60 * m)\n good_date(h) + \":\" + good_date(m) + \":\" + good_date(s)\n end", "def nice_time(time)\n time = time.to_i\n return \"\" if time == 0\n t = \"\"\n h = time / 3600\n m = (time - (3600 * h)) / 60\n s = time - (3600 * h) - (60 * m)\n t = good_date(h) + \":\" + good_date(m) + \":\" + good_date(s)\n end", "def nice_time\n Time.at(time).utc.strftime('%-M:%Ss')\n end", "def date_format tim\n # tim.strftime '%Y/%m/%d %H:%M:%S'\n tim.strftime '%Y/%m/%d %H:%M'\nend", "def common_timestring\n \"%I:%M%p %Z %a %d %B %Y\"\n end", "def time_format\n return :time12 if new_us_user?\n\n clock_type == '12h' ? :time12 : :time24\n end", "def in_standard_time\n self.strftime(\"%I:%M %P\")\n end", "def fix_time(time=nil)\n if time == nil\n # no full time, use current\n hh, mn, ss = Time.now.strftime(\"%H:%M:%S\").split(':')\n elsif time.size == 3\n # we got full time\n hh = time[0].rjust(2,'0')\n mn = time[1].rjust(2,'0')\n ss = time[2].rjust(2,'0')\n elsif time.size == 2\n # we got full time minus seconds\n hh = time[0].rjust(2,'0')\n mn = time[1].rjust(2,'0')\n ss = Time.now.strftime(\"%S\")\n end\n return hh, mn, ss\n end", "def event_time(format = \"%l:%M %p\")\n self.showtime.strftime(format) if self.showtime\n end", "def format_date_time( dt )\n dt.strftime( \"%B %e, %Y %I:%M%p\" )\nend", "def format_time(time)\n first_colon = time.index(':')\n if first_colon.nil? \n #if it's not a time\n return time\n end\n second_colon = time.index(':', first_colon + 1)\n result = time[0, first_colon]\n if result.length < 2\n result = \"0#{result}\"\n end\n if second_colon.nil?\n second_colon = time.length\n end\n result += time[first_colon, second_colon - first_colon]\n return result\nend", "def format_time(time, opts = {})\n format = opts[:include_timezone] ? \"%H:%M%:z\" : \"%H:%M\"\n if time.is_a? String\n case time\n when 'now'\n return DateTime.now.strftime format\n else\n unless time =~ /^\\d{2}\\:\\d{2}$/\n raise Fitgem::InvalidTimeArgument, \"Invalid time (#{time}), must be in HH:mm format\"\n end\n timezone = DateTime.now.strftime(\"%:z\")\n return opts[:include_timezone] ? [ time, timezone ].join : time\n end\n elsif DateTime === time || Time === time\n return time.strftime format\n else\n raise Fitgem::InvalidTimeArgument, \"Date used must be a valid time object or a string in the format HH:mm; supplied argument is a #{time.class}\"\n end\n end", "def time_display(datetime)\n datetime.strftime(\"%m/%d/%Y, %l:%M %p\")\n end", "def time_str\n Time.at(time[0..-4].to_f + time[-3..-1].to_f / 1000)\n .strftime(\"%M:%S.%L\")\n end", "def timekey_to_timeformat(timekey)\n case timekey\n when nil then ''\n when 0...60 then '%Y%m%d%H%M%S' # 60 exclusive\n when 60...3600 then '%Y%m%d%H%M'\n when 3600...86400 then '%Y%m%d%H'\n else '%Y%m%d'\n end\n end", "def print_time( fmt )\n printf( fmt, utime, stime )\n end", "def format_time(time, format)\n if time.is_a?(String)\n Time.parse(time).strftime(format)\n elsif time.is_a?(Time) || time.is_a?(DateTime) || time.is_a?(Date)\n time.strftime(format)\n end\n end", "def pretty_time\n t = self.start_time\n t.strftime(\"%a, %b %e, %l:%M %p\")\n end", "def prep_time_passed\n return \"7:34\"\n end", "def formatted_pickup_time\n\t\tstart_ampm = 'am'\n\t\tend_ampm = 'am'\n\t\tt = ''\n\t\tif (pickup_start_hour > 12) then\n\t\t\tt += (pickup_start_hour - 12).to_s\n\t\t\tstart_ampm = 'pm'\n\t\telse\n\t\t\tt += pickup_start_hour.to_s\n\t\tend\n\t\tif (pickup_end_hour > 12) then\n\t\t\tend_ampm = 'pm'\n\t\tend\n\t\tif pickup_start_minute != 0 then\n\t\t\tt += ':' + pickup_start_minute.to_s\n\t\tend\n\t\tif start_ampm === 'am' and end_ampm === 'pm' then\n\t\t\tt += 'am'\n\t\tend\n\t\tt += '-'\n\t\tif pickup_end_hour > 12 then\n\t\t\tt += (pickup_end_hour - 12).to_s\n\t\telse\n\t\t\tt += pickup_end_hour.to_s\n\t\tend\n\t\tif pickup_end_minute != 0 then\n\t\t\tt += ':' + pickup_end_minute.to_s\n\t\tend\n\t\tt += end_ampm\n\t\tt\n\tend", "def time_s\n time_to_s(time)\n end", "def formatted_date_time date, time\n date_time = merge_date_time date, time\n I18n.localize date_time\n end", "def out_of_bounds_time_format; end", "def time_conversion s\n converted_time = \"#{(s[0,2].to_i + 12) % 12}#{s[2,6]}\".rjust(8, \"0\")\n converted_time = \"#{converted_time[0,2].to_i + 12}#{s[2,6]}\" if s[8,9] == \"PM\"\n converted_time\n end", "def format_time(seconds)\n if seconds < 60\n sprintf \"%ds\", seconds\n elsif seconds < 60 * 60\n sprintf \"%dm:%02ds\", seconds / 60, seconds % 60\n else\n sprintf \"%dh:%02dm\", seconds / (60 * 60), seconds % (60 * 60) / 60\n end\nend", "def fmt_miltime(t)\n if t.present?\n ApplicationHelper.localtime(t).strftime(ApplicationHelper.time_fmt)\n end\n end", "def formattime()\n\t\tamOrpm = 0\t# this will decide P or A\n\t\ttopResult = ''\t# save top string from the digital clock\n\t\tmiddleResult = ''\t# save middle string from the digital clock\n\t\tbotResult = ''\t\t# save bot string from the digital clock\n\t\t\n\t\thour = gethour().to_i\t# change to integer for hour\n\t\tmin = getminute().to_i\t# change to integer for minute\n\t\t@amOrpm = @t.strftime(\"%p\")\t# this get PM or AM, I used strftime method which provided from the Time class\n\t\tif @amOrpm == \"PM\"\t# if PM\t\n\t\t\tamOrpm = 1\t# save 1\n\t\telse\t\t\t# if AM\n\t\t\tamOrpm = 0\t# save 0\n\t\tend\n\n\t\ttopResult = top(hour,min)\t# Save top string from the digital clock with top method\n\t\tmiddleResult = middle(hour,min)\t# Save middle string from the digital clock with middle method\n\t\tbotResult = bot(hour,min, amOrpm)\t# Save bot string from the digital clock with bot method\n\t\ttotal = topResult + middleResult + botResult\t# save all the string in the total\n\t\treturn total\t\t\t# return total represent perfect digital time\n\tend", "def time_date_hm ; time_date && time_date.strftime(\"%H:%M\") ; end", "def short_time\n \ttime.strftime \"%b %-d\"\n end", "def time_format=(value)\n @time_format = value\n end", "def convert_to_usable_time(xanga_time)\n arr = xanga_time.split(\" \")\n ret = arr[0]\n ret.insert(0,\"0\") if arr[0].length == 4 #pad left-most zero\n \n if arr[1] == \"PM\" #add 12 to it\n str = ret.slice(0,2)\n 0.upto(11){ str.succ! } \n ret[0,2] = str\n end\n \n ret.concat(\":00 +0000\")\n end", "def time\n\t\tI18n.l(moment, format: :time_only)\n\tend", "def in_international_time\n self.strftime(\"%H:%M\")\n end", "def livia_time(d)\n unless d.nil?\n d.to_time.strftime(\"%H:%M\")\n else\n ''\n end\n end", "def display_time_for_appointment\n date.strftime(\"%I:%M:%S %p, %B #{date.day.ordinalize}, %Y\")\n end", "def updateLabel(time)\n\t super(\"%02dh %02dm %02ds\" % [time.hour, time.min, time.sec]\t)\n end", "def transformTime(time)\n temp1 = time[0..1]\n temp2 = time[2..3]\n temp3 = time[4..5]\n time = temp1+\":\"+temp2+\":\"+temp3\n \n end", "def formatted_time\n [\n start_time.strftime(\"%A, %e %B %Y\"),\n \"from\",\n start_time.strftime(\"%l:%M %p\"),\n \"to\",\n end_time.strftime(\"%l:%M %p\"),\n \"(#{timezone})\"\n ].join(\" \")\n end", "def to_s(*args)\n if args.empty?\n strftime('%H:%M:%S')\n else\n # Superclass may have defined a method that takes a format string,\n # and we shouldn't override in that case.\n super\n end\n end", "def display_time(time_type, time)\n message = Time.new.strftime('%H:%M:%S') + \" #{time_type} \"\n message += time.days.positive? ? \"#{time.days} day, \" : ''\n message.insert(message.length - 2, 's') if time.days > 1\n message += time.hours.positive? ? \"#{time.hours}:#{time.minutes}\" : \"#{time.minutes} min\"\n puts message\nend", "def timelong( time )\n time.strftime('%Y-%m-%d %H:%M:%S') if time\n end", "def formatted_datetime(date_time)\n date_time.strftime(\"%a, %e %b %Y %H:%M\")\n end", "def german_time_format(date)\n date.strftime(\"%d.%m.%y - %H:%M\")\n end", "def timestamp\n time.strftime formatter\n end", "def time( time = birth )\n # Check to be sure time is a valid Time object\n raise RuntimeError, 'Invalid Time' unless time.instance_of? Time\n\n show_day = time.strftime( '%a' )\n show_time = '2000' # Defaults to 8PM\n\n # Friday is a 9:00 PM show\n show_time = '2100' if time.wday == 5\n\n # Saturday after 10 PM file creation is 10:30 PM show\n if ( time.wday == 6 && time.hour >= 22 ) || ( time.wday == 0 && time.hour <= 2 )\n show_day = 'Sat'\n show_time = '2230'\n end\n\n # Return the day-time string\n show_day + '-' + show_time\n end", "def timeConversion(s)\n #\n # Write your code here.\n #\n split = s.split(\":\")\n pm = split[2][-2,2]\n split[2] = split[2][0,2]\n if pm == \"AM\" && split[0] == \"12\"\n split[0] = 00\n end\n if pm == \"PM\"\n split[0] = split[0].to_i + 12\n if split[0] == 24\n split[0] = 12\n end\n end\n\n split[0] = split[0].to_s.rjust(2,\"0\")\n split[1] = split[1].to_s.rjust(2,\"0\")\n split[2] = split[2].to_s.rjust(2,\"0\")\n\n p split.join(\":\")\nend", "def show_in_strftime\n @date.strftime(\"%d/%m/%Y -- %H:%M\")\n end", "def nytimes_time(time, opts={})\n raise ArgumentError.new \"Time or DateTime required\" unless time.is_a?(DateTime) || time.is_a?(Time)\n str = \"\"\n str << time.strftime(\"%l:%M\").strip\n str << time.strftime(\" %p\").sub('PM','p.m.').sub('AM','a.m.') unless opts[:hide_abbreviation]\n str\n end", "def humanize_time(time)\n humanize_date(time.to_date) + (time.to_date.cweek == Date.today.cweek ? \" at \" + time.strftime(\"%l:%M %p\") : \"\")\n end", "def web_time; strftime(WEB_TIME_FORMAT); end", "def format_time_h_mm(time_string)\n\t\tresult = ''\n\t\ttime_duration = Time.at(time_string).utc\n\n\t\t#format hours\n\t\tif time_duration.hour > 0\n \t\t\tresult << time_duration.strftime('%k hour')\n \t\t\tif time_duration.hour > 1\n\t\t\t\tresult << 's'\n\t\t\tend\n\t\t\tresult << ', '\n \t\tend\n\n \t\t#format minutes\n \t\tif time_duration.min > 0\n \t\t\tresult << time_duration.strftime('%M minute')\n\t \t\tif time_duration.min > 1\n\t\t\t\tresult << 's'\n\t \t\tend\n \t\tend\n\tend", "def format_time(time_string)\n Time.parse(time_string).strftime('%d-%b-%y')\n end", "def as_time( d = nil )\n d = (d || self)\n return '' unless [Time, DateTime].include? d.class\n format = 'time_short'\n I18n.l d, :format => I18n.t( 'time.formats.' + format )\n end", "def email_time; strftime(EMAIL_TIME_FORMAT); end", "def log_fmt_timestamp(time)\n [(time/3600).to_i, (time/60 % 60).to_i, (time % 60).to_i].map{|t| t.to_s.rjust(2,'0')}.join(':')\n end", "def human_time(time)\n time = time.utc.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")\n %|<span class=\"human_time\" title=\"#{time}\">#{time}</span>| \n end", "def friendly_time\n\t\t@event_info.each do |event_hash|\n\t\t\tdatetime = event_hash[\"datetime\"].strftime(\"%A, %d %b %Y %l:%M %p\")\t\n\t\tend\n\tend", "def FormatTimesDates\n\ttime = Time.new\n\tputs time.to_s\n\tputs time.ctime\n\tputs time.localtime\n\tputs time.strftime(\"%Y-%m-%d %H:%M:%S\")\n\tputs time.strftime(\"%d/%m/%Y\")\nend", "def time_as_s time\n time.strftime('%H:%M:%S')\n end", "def iso_format_time(time)\n return time unless time.is_a? Time or time.is_a? Date\n time = time.getutc if time.is_a? Time\n time = time.new_offset(0) if time.is_a? DateTime\n time.strftime('%Y-%m-%dT%H:%M:%SZ')\n end", "def time_for_string(time)\n time = time.scan(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/)[0].sub(' ','T')\n Time.xmlschema(time)\n end", "def format_time_from_hour hour\n hrs = hour.to_i\n min = ((hour - hrs) * 60.0 + 0.5).to_i\n \"%2d:%02d\" % [hrs, min]\n end", "def friendly_time\n\tTime.now.strftime(\"%I:%M:%S %p\") \nend", "def format_datetime datetime, fmt=\"%F %H:%M %Z\"\n return unless datetime.present?\n datetime.strftime fmt if datetime\n end", "def time\n start.try(:to_time).try(:strftime, '%-l:%M %P')\n end", "def to_s\n if year == 0 and mon == 0 and day == 0\n h = neg ? hour * -1 : hour\n sprintf \"%02d:%02d:%02d\", h, min, sec\n else\n sprintf \"%04d-%02d-%02d %02d:%02d:%02d\", year, mon, day, hour, min, sec\n end\n end", "def parse_time(time)\n time = \"0#{time}\" if time.match(/^\\d:\\d\\d/)\n time = time.gsub(/u/, '') if utime?\n time = time.gsub(/s/, '') if stime?\n\n time\n end", "def to_s\n s = @display.strftime(time_format)\n case @display_granularity\n when :ten_minute\n s.chop!\n s << \"~\"\n when :one_hour\n s.chop!\n s.chop!\n s << \"~~\"\n end\n return s\n end", "def format_hour_minute(hour_minute)\n hour_minute.lstrip.rstrip.rjust(2,'0') \n end", "def format_registration_time(date_time)\n format_time = DateTime.strptime(date_time, '%m/%d/%y %H:%M')\nend", "def strftime(format, time = T.unsafe(nil)); end", "def from_to_time_format(from,to)\n @to_format = to\n @from_format = from\n if from == nil && to == nil\n from = (Time.new-24*60*60).to_s.split(\" \")[0]\n to = from + \" 24:00:00\"\n from = from + \" 00:00:00\"\n @from_format = from\n @to_format = to\n return from,to\n end\n if to == nil || to == \"\"\n to = timeformat_change(Time.new)\n @to_format = to\n end\n if from.to_s.size < 5\n from_format = (Time.new + from.to_i*60*60)\n @from_format = timeformat_change(from_format)\n else\n if from.size < 12\n from = from.split(\"-\")\n from = Time.new(from[0].to_i,from[1].to_i,from[2].to_i) \n @from_format = timeformat_change(from)\n end\n end\n if to.size < 12\n @to_format = to+\" 24:00:00\"\n end\n show_info(\"from_time: #{@from_format}\\t to_time #{@to_format}\")\n return @from_format,@to_format\n end", "def time_string(time)\n h = time/3600.to_i # heure\n m = time/60.to_i-h*60 # minute\n s = time - h * 3600 - m * 60 # seconde\n h=pres(h)\n m=pres(m)\n s=pres(s)\n return [h,m,s].join(\":\")\n end" ]
[ "0.81690294", "0.79916906", "0.7936207", "0.79025716", "0.78992206", "0.78752506", "0.7859879", "0.78264236", "0.7731965", "0.7684614", "0.76450264", "0.76369077", "0.7611573", "0.7575992", "0.7575992", "0.7575992", "0.75607324", "0.7508419", "0.74513304", "0.74320227", "0.7413507", "0.74093676", "0.74022985", "0.7381743", "0.7368538", "0.7368538", "0.73670745", "0.73479354", "0.73331547", "0.7314798", "0.72945255", "0.72379905", "0.71972406", "0.7192723", "0.7182296", "0.7160978", "0.71393824", "0.71327466", "0.7114788", "0.71113026", "0.71095467", "0.7108283", "0.70980155", "0.7082028", "0.7069388", "0.7066499", "0.7057432", "0.70563334", "0.7036332", "0.7030623", "0.700936", "0.70069855", "0.70055765", "0.7003264", "0.69944733", "0.6989961", "0.6984596", "0.6981769", "0.69662106", "0.6962445", "0.696057", "0.6955532", "0.69510466", "0.6941368", "0.6926828", "0.69236714", "0.6890427", "0.6888394", "0.6888353", "0.68875104", "0.6884314", "0.6873955", "0.68723714", "0.6866127", "0.6862987", "0.68595487", "0.6853424", "0.68457127", "0.684342", "0.6824646", "0.68226856", "0.6822231", "0.6817958", "0.68174595", "0.68129086", "0.68105316", "0.67940015", "0.678315", "0.67821556", "0.67752737", "0.67637634", "0.6756211", "0.6747192", "0.6721795", "0.6714118", "0.6712973", "0.67111576", "0.6700586", "0.6686059", "0.6685024", "0.66710025" ]
0.0
-1
recreates the array to show the range of time between the breaks, thus preparing it for the CountingMinutes method
def TimeRecreator(time1, time2) time1 = time1.split("-").pop + "-" time1 += time2.split("-").shift end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end", "def get_timeslots_12hrs\n \t#create the new array\n \t@timeslots_12hrs = Array.new\n\n for i in 0...@timeslots.length\n @temp_holder = @timeslots[i].split(':')\n @temp_holder[0] = @temp_holder[0].to_i\n if @temp_holder[0] > 12\n @temp_holder[0] = @temp_holder[0] - 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n elsif @temp_holder[0] == 12\n @timeslots_12hrs.push(@temp_holder[0].to_s + \":\" + @temp_holder[1] + \"pm\")\n else\n @timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return @timeslots_12hrs\n end", "def get_timeslots_12hrs\n #create the new array\n timeslots_12hrs = Array.new\n\n for i in 0...@timeslots.length\n temp_holder = @timeslots[i].split(':')\n temp_holder[0] = temp_holder[0].to_i\n\n if temp_holder[0] > 12\n temp_holder[0] = temp_holder[0] - 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n elsif temp_holder[0] == 12\n timeslots_12hrs.push(temp_holder[0].to_s + \":\" + temp_holder[1] + \"pm\")\n else\n timeslots_12hrs.push(@timeslots[i] + \"am\")\n end\n end\n\n return timeslots_12hrs\n end", "def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end", "def time_range\n range_time = []\n (1..12).each do |n|\n time = n == 1 ? 12 : n - 1\n range_time << \"#{time}:00 am\"\n range_time << \"#{time}:30 am\"\n end\n (1..12).each do |n|\n time = n == 1 ? 12 : n - 1\n range_time << \"#{time}:00 pm\"\n range_time << \"#{time}:30 pm\"\n end\n range_time\n end", "def fill_month range\n # reset array to empty first\n @month = []\n range.times do |num|\n @month.push(@hours[num])\n end\n end", "def summary_array\n row = []\n column = [DueText.minutes, till_or_since, calc_mins_till.round(2), DueText.minutes_suffix]\n row << column\n column = [DueText.hours, till_or_since, calc_hours_till.round(2), DueText.hours_suffix]\n row << column\n column = [DueText.days, till_or_since, calc_days_till.round(2), DueText.days_suffix]\n row << column\n column = [DueText.weeks, till_or_since, calc_weeks_till.round(2), DueText.weeks_suffix]\n row << column\n column = [DueText.months, till_or_since, calc_months_till.round(2), DueText.months_suffix]\n row << column\n column = [DueText.years, till_or_since, calc_years_till.round(2), DueText.years_suffix]\n row << column\n end", "def timeslots\n\t\tif (self != nil)\n\t\t\tcompany = self.company\n\t\t\tstart_time = company.start_time\n\t\t\tend_time = company.end_time\n\t\t\tcompany_duration = (( end_time - start_time )/60).round(2)\n\t\t\tno_of_slots = ( company_duration / (self.time_slot.hour*60 + self.time_slot.min) ).to_i\n\t\t\ttime_slot_array =Array.new\n\t\t\tremember_hour = start_time.hour.round\n\t\t\tremember_min = start_time.min\n\t\t\tno_of_slots.times do | index |\n\t\t\t\ta = remember_hour == 0 ? \"00\" : remember_hour\n\t\t\t\tb = remember_min == 0 ? \"00\" : remember_min\n\t\t\t\tc = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour == 0 ? \"00\" :((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\td = (remember_min + self.time_slot.min) % 60 == 0 ? \"00\" : (remember_min + self.time_slot.min) % 60\n\t\t\t\ttime_slot_array << [\"#{a}:#{b}-#{c}:#{d}\", index]\n\t\t\t\tremember_hour = ((remember_min + self.time_slot.min)/60 )+remember_hour+self.time_slot.hour\n\t\t\t\tremember_min = (remember_min + self.time_slot.min) % 60\n\t\t\tend\n\t\t\ttime_slot_array\n\t\tend\n\tend", "def split(range = nil)\n if self.record_category and self.activity?\n entry_end = self.end_timestamp || Time.now\n time = range ? [self.timestamp, range.begin.midnight.in_time_zone].max : self.timestamp\n end_time = range ? [entry_end, range.end.midnight.in_time_zone].min : entry_end\n list = Array.new\n while time < end_time\n new_end = [entry_end, (time + 1.day).midnight.in_time_zone].min\n list << [time, new_end, self]\n time = new_end\n end\n else\n return [self.timestamp, nil, self]\n end\n list\n end", "def to_a(resolution: :hour)\n return [] if @start.nil? && @finish.nil?\n\n if finish < start\n to_time_array(start, TimeOfDay.new(23), resolution) +\n to_time_array(TimeOfDay.new(0), finish, resolution)\n else\n to_time_array(start, finish, resolution)\n end\n end", "def create_time_periods(time_period_length = MSecPerHour)\n days = []\n time_periods = nil\n prev_start = @raw_data[0][0] + 1 # cross over into first day\n \n for data in @raw_data\n # Has data crossed over to next day?\n if prev_start > data[0] # Time increases throughout the day...\n days << time_periods if time_periods != nil\n \n cur_time_period = 0\n time_periods = [[]]\n \n puts \"New day: data=#{data[0]}\" if Verbose\n \n # Has data crossed over to next time period?\n elsif data[0] > ((cur_time_period + 1) * time_period_length)\n # Handle cases where the count is 0 for a time period\n while data[0] > ((cur_time_period + 1) * time_period_length)\n cur_time_period += 1\n time_periods[cur_time_period] = []\n end\n \n puts \"New time period: data=#{data[0]}\" if Verbose\n end\n \n time_periods[cur_time_period] << data\n prev_start = data[0]\n end\n \n # Add last time period\n days << time_periods\n days\n end", "def time_slots\n collection=[]\n start_time=Time.now.beginning_of_hour\n end_time=Time.now.tomorrow.midnight-1.hour\n time=start_time\n\n while time < end_time\n collection<<[time.beginning_of_hour.hour, time.beginning_of_hour]\n time=time+1.hour\n end\n\n collection\n end", "def default_time_slots\n start_time = Time.parse(\"9:00\")\n end_time = Time.parse(\"20:30\")\n slots = []\n t = start_time\n while t <= end_time\n slots << t.strftime(\"%H:%M\")\n t += 30.minutes;\n end\n\n slots\n end", "def split_playtime(start)\r\r\n number = []\r\r\n number[0] = start / 60 / 60\r\r\n number[1] = start / 60 % 60\r\r\n number[2] = start % 60\r\r\n return number\r\r\n end", "def split_playtime(start)\n number = []\n number[0] = start / 60 / 60\n number[1] = start / 60 % 60\n number[2] = start % 60\n return number\n end", "def buffer\n [[1.minute, interval/20].max, 30.minutes].min\n end", "def to_a(resolution: :hour)\n resolution_multiplier = resolution == :hour ? 60 * 60 : 60\n time_units = ((start - finish) / resolution_multiplier).abs.to_i\n\n Array.new(time_units) do |time_unit|\n start + (time_unit * resolution_multiplier)\n end\n end", "def make_event_times_array(dates_array, hour, min)\n\t\tevent_times = Array.new\n\n\t\tdates_array.each_index do |index|\n\t\t\n\t\t\tevent_times[index] = create_event_time(dates_array[index],hour, min)\n\t\tend\n\n\t\treturn event_times\n\tend", "def active_period\n [[@starting, @from].max, [@to - 1, @ending].min] # -1 sec: include only last unit day\n end", "def total_minutes_towards_goal(array)\n total = 0 \n array.each do |each_one|\n total += each_one.time_unit_minutes\n end\n total\n end", "def makeArrayConsecutive2(statues)\n max_value = statues.max\n min_value = statues.min\n result_array = []\n\n if min_value == max_value\n 0\n else\n for i in range(min_value, max_value)\n result_array.append(i)\n end\n end\n result_array.size - statues.size\nend", "def fill_schedule\n @schedule.each do |key,value|\n (6..20).each { |n| @schedule[key][\"#{n}:30 - #{n+1}:30\"] = \"0\" }\n end\n end", "def initialize(time_window)\n @timeframes = [] \n \n for group in time_window.split(\";\")\n days, times = Array.new(7, false), []\n\n for item in group.split(\" \")\n # Range of values?\n if item.include?(\"-\")\n # Yes, Figure out if range is days or times\n range = item.split(\"-\")\n \n if Days.include?(range[0]) \n set_day_range(days, range[0], range[1])\n else\n times << TimeRange.new(range[0], range[1])\n end\n else\n days[Days.index(item)] = true if Days.include?(item)\n end\n end\n \n @timeframes << TimeFrame.new(days, times)\n end\n end", "def parse_intervals\n intervals = Array.new\n headers_index = 16\n data_index = headers_index + 1\n headers = @data[headers_index].map!(&:underscore)\n current_interval = nil\n @data[data_index,@data.size].map.with_index do |r,i|\n if r.empty?\n @_interval_sample_index = data_index + i + 1\n break\n else\n zipped = (headers).zip(@data[data_index + i])\n i = WFWorkoutInterval.new\n Hash[zipped].map { |k,v|\n if k == \"interval\"\n if current_interval == v\n i.subinterval = true\n else\n i.subinterval = false\n end\n current_interval = v\n end\n i.instance_variable_set(\"@#{k}\",v)\n }\n intervals.push(i)\n end\n end\n return intervals\n end", "def generate_time\n\t\tret = Array.new\n\t\tcount unless @fileinfo[:count]\n\t\ttrigger unless @fileinfo[:trigger]\n\t\tsampling unless @fileinfo[:sampling]\n\n\t\t(0..@fileinfo[:count] - @fileinfo[:trigger] - 1).each {|i| \n\t\t\tret << (i * @fileinfo[:sampling] * 1e-6)\n\t\t}\n\t\treturn ret\n\tend", "def date_calc(start,day_start,day_duration,round)\n time=start;schedule=[]\n round.size.times do |r|\n#print day_start+day_duration;print \"\\n\"\n if time >= day_start + day_duration\n#print time;print \"\\n\"\n time=day_start+1.day\n day_start = time\n end\n schedule[r] = time\n time+=HEAT_INTERVAL\n end\n\n return schedule\n end", "def load_time_ranges\n @time_ranges = ActiveSupport::HashWithIndifferentAccess.new\n time_ranges = @config['time']\n time_ranges.each do |t,r|\n time_range = ActiveSupport::HashWithIndifferentAccess.new\n src_ranges ||= r\n src_ranges.map { |k,v| time_range[k.to_sym] = rangify_time_boundaries(v) }\n @time_ranges[t.to_sym] = time_range\n end\n\n end", "def start_times\n \t@start_time1 = self.start_time1\n\n @start_time2 = self.start_time2\n\n @start_time3 = self.start_time3\n\n start_times = [@start_time1, @start_time2, @start_time3]\n end", "def set_boundaries\n months = calculate_month_and_next_month(@values[:year],\n @values[:time_frame])\n set_values(months)\n return \"Calculated interval for month from input:\" \\\n \" #{months[:actual]} - #{months[:next]}\"\n end", "def downtime(start_time, end_time)\n outs = outages(start_time, end_time)[:outages]\n\n total_secs = {}\n percentages = {}\n\n outs.collect {|obj| obj.condition}.uniq.each do |st|\n total_secs[st] = 0\n percentages[st] = (start_time.nil? || end_time.nil?) ? nil : 0\n end\n\n unless outs.empty?\n\n # Initially we need to check for cases where a scheduled\n # maintenance period is fully covered by an outage period.\n # We then create two new outage periods to cover the time around\n # the scheduled maintenance period, and remove the original.\n\n delete_outs = []\n sched_maintenances = scheduled_maintenances(start_time, end_time)[:scheduled_maintenances]\n\n sched_maintenances.each do |sm|\n\n split_outs = []\n\n outs.each { |o|\n next unless o.end_time && (o.start_time < sm.start_time) &&\n (o.end_time > sm.end_time)\n delete_outs << o\n\n out_split_start = Outage.new\n out_split_start.condition = o.condition\n out_split_start.start_time = o.start_time\n out_split_start.end_time = sm.start_time\n out_split_start.duration = sm.start_time - o.start_time\n out_split_start.summary = \"#{o.summary} [split start]\"\n\n out_split_end = Outage.new\n out_split_end.condition = o.condition\n out_split_end.start_time = sm.end_time\n out_split_end.end_time = o.end_time\n out_split_end.duration = o.end_time - sm.end_time\n out_split_end.summary = \"#{o.summary} [split finish]\"\n\n split_outs += [out_split_start, out_split_end]\n }\n\n outs -= delete_outs\n outs += split_outs\n # not strictly necessary to keep the data sorted, but\n # will make more sense when debgging\n outs.sort! {|a,b| a.start_time <=> b.start_time}\n end\n\n delete_outs.clear\n\n sched_maintenances.each do |sm|\n\n outs.each do |o|\n next unless o.end_time && (sm.start_time < o.end_time) &&\n (sm.end_time > o.start_time)\n\n if sm.start_time <= o.start_time &&\n sm.end_time >= o.end_time\n\n # outage is fully overlapped by the scheduled maintenance\n delete_outs << o\n\n elsif sm.start_time <= o.start_time\n # partially overlapping on the earlier side\n o.start_time = sm.end_time\n o.duration = o.end_time - o.start_time\n elsif sm.end_time >= o.end_time\n # partially overlapping on the later side\n o.end_time = sm.start_time\n o.duration = o.end_time - o.start_time\n end\n end\n\n outs -= delete_outs\n end\n\n total_secs = outs.inject(total_secs) {|ret, o|\n ret[o.condition] += o.duration if o.duration\n ret\n }\n\n unless (start_time.nil? || end_time.nil?)\n total_secs.each_pair do |st, ts|\n percentages[st] = (total_secs[st] * 100.0) / (end_time.to_f - start_time.to_f)\n end\n total_secs['ok'] = (end_time - start_time) - total_secs.values.reduce(:+)\n percentages['ok'] = 100 - percentages.values.reduce(:+)\n end\n end\n\n {:total_seconds => total_secs, :percentages => percentages, :downtime => outs}\n end", "def breakable_range; end", "def time_range\n return 0 if start_hour.blank? || start_minute.blank?\n\n return 0 if end_hour.blank? || end_minute.blank?\n\n hours_between_times\n end", "def missing_ranges()\n return [] if @time_map.nil?\n @time_map.missing_ranges()\n end", "def __evolve_time__\n map { |value| value.__evolve_time__ }\n end", "def timecodes\n return [] if start_time.nil?\n start_hour = start_time.strftime(\"%H\")\n start_min = start_time.strftime(\"%M\").to_i < 30 ? \"00\" : \"30\"\n curr_time = Time.parse(\"#{start_hour}:#{start_min}\")\n timecode_array = []\n while curr_time < Time.parse(\"#{end_time.strftime(\"%H\")}:#{end_time.strftime(\"%M\")}\") - 1.second\n timecode_array << \"#{curr_time.strftime(\"%H\").to_i}:#{curr_time.strftime(\"%M\")}\"\n curr_time = curr_time + 30.minutes\n end\n timecode_array_with_days = []\n %w(monday tuesday wednesday thursday friday saturday sunday).each do |day|\n timecode_array_with_days << timecode_array.collect{|t| \"#{t}_#{day}\"}.flatten if read_attribute(day)\n end\n timecode_array_with_days.flatten\n end", "def load_showtimes\n available_times = {\n 10.45 => \"10:45am\", 11.00 => \"11:00am\", 11.15 => \"11:15am\", 11.30 => \"11:30am\",11.45 => \"11:45am\", 12.00 => \"12:00pm\", 12.15 => \"12:15pm\", 12.30 => \"12:30pm\", 12.45 => \"12:45pm\", \n 13.00 => \"1:00pm\", 13.15 => \"1:15pm\", 13.30 => \"1:30pm\",13.45 => \"1:45pm\",14.00 => \"2:00pm\",14.15 => \"2:15pm\",14.30 => \"2:30pm\", 14.45 => \"2:45pm\", 15.00 => \"3:00pm\",15.15 => \"3:15pm\",16.00 => \"4:00pm\", 16.15 => \"4:15pm\", 16.30 => \"4:30pm\", 16.45 => \"4:45pm\", 17.00 => \"5:00pm\",17.15 => \"5:15pm\", 17.30 => \"5:30pm\",17.45 => \"5:45pm\",18.00 => \"6:00pm\", 18.15 => \"6:15pm\", 18.30 => \"6:30pm\", 18.45 => \"6:45pm\", 19.00 => \"7:00pm\", 19.15 => \"7:15pm\", 19.30 => \"7:30pm\", 19.45 => \"7:45pm\", 20.00 => \"8:00pm\", 20.15 => \"8:15pm\", 20.30 => \"8:30pm\", 20.45 => \"8:45pm\", 21.00 => \"9:00pm\", 21.15 => \"9:15pm\", 21.30 => \"9:30pm\", \n 22.00 => \"10:00pm\", 22.15 => \"10:15pm\", 22.30 => \"10:30pm\", 22.45 => \"10:45pm\", 23.00=> \"11:00pm\", 23.15 => \"11:15pm\", \n 23.30 => \"11:30pm\", 23.45 => \"11:45pm\",24.00 => \"12:00am\"}\n\n\n\n showtimes = [10.45]\n\n if self.runtime >= 1.33 && self.runtime <= 1.5\n showtimes << 12.30 << 14.00 << 15.30 << 17.00 << 18.30 << 20.00 << 21.30 << 23.00\n\n elsif self.runtime >= 1.5 && self.runtime <= 2 \n showtimes << 13.00 << 15.00 << 17.00 << 19.00 << 21.00 << 23.00 << 24.00\n\n elsif self.runtime >= 2 && self.runtime <= 3\n showtimes << 14.15 << 17.15 << 21.15 << 24.00\n end \n\n\n\n showtimes.map! do |time|\n time = Showing.create!(military_time: time.to_f, time_string: available_times[time], movie: self)\n end\n\n self.showings = showtimes\n end", "def schedule_break start_time, end_time, rate = 0.0\n check_break start_time, end_time\n\n roadall.insert(-2, [start_time.to_i, nil, roadall.last.last])\n roadall.insert(-2, [end_time.to_i, nil, rate])\n end", "def generate_time_blocks(windows)\n results = windows.map do |window|\n\n # Create a date based n todays date, but with the time changed to\n # that of the entry start/end.\n entry_start = base.change(\n hour: window.start_time.hour,\n min: window.start_time.minute)\n\n # By rounding off with #floor, we go the easy route (no partial time blocks)\n # Note: iterator is zero based.\n blocks = (window.duration / block_size).floor.times.map { |i|\n\n start_time = Skej::Warp.zone(\n entry_start + (i * block_size).minutes,\n session.chosen_office.time_zone)\n\n end_time = Skej::Warp.zone(\n start_time + block_size.minutes,\n session.chosen_office.time_zone)\n\n target_day = Skej::NLP.parse(session, window.day)\n .strftime('%A')\n .downcase\n .to_sym\n\n TimeBlock.new(\n session: session,\n time_entry_id: window.time_entry.id,\n business_id: session.business_id,\n time_sheet_id: window.time_sheet_id,\n office_id: window.office_id,\n day: target_day,\n start_time: start_time,\n end_time: end_time)\n\n }\n end.flatten # results\n end", "def time_fragments\n []\n end", "def merged_meetings(meeting_time_ranges)\n # assuming meetings can fall at most 12 30-minute blocks past 9am\n start_times = Array.new(13, nil) # array of start times at their index\n end_times = Array.new(13, nil) # array of end times - their index is their start time\n meeting_time_ranges.each do |meeting_time_range|\n start_time = meeting_time_range[0]\n end_time = meeting_time_range[1]\n\n # add start_time to start_times\n start_times[start_time] = start_time\n\n # add end_time to end_times at its start_time index, unless there is already a later end_time at that index\n end_times[start_time] = end_time unless !end_time[start_time].nil? && end_time[start_time] > end_time\n end\n\n merged_meeting_times = []\n\n # start_times look something like [0, nil, nil, 3, 4, nil, nil, nil, nil, 9, 10, nil]\n # end_times look something like [1, nil, nil, 5, 8, nil, nil, nil, nil, 10, 12, nil]\n last_start_time = nil\n last_end_time = nil\n start_times.each do |start_time|\n next if start_time.nil?\n\n if last_start_time.nil? # no values have been stored yet\n last_start_time = start_time\n last_end_time = end_times[start_time]\n next\n end\n\n if start_time <= last_end_time # current start_time is before the last end_time\n if start_time < last_start_time\n # current start_time earlier than last_start_time - assign as last_start_time\n last_start_time = start_time\n end\n\n if end_times[start_time] > last_end_time\n # current end_time later than last_end_time - assign it end_time as last_end_time\n last_end_time = end_times[start_time]\n end\n next\n end\n\n if start_time > last_end_time\n # we have reached the start of a new range - store the last range\n merged_meeting_times << [last_start_time, last_end_time]\n\n # reset the last_end_time and last_start_time to the current values\n last_start_time = start_time\n last_end_time = end_times[start_time]\n next\n end\n end\n\n # be sure to append the remaining last meeting time range\n merged_meeting_times << [last_start_time, last_end_time]\n\n merged_meeting_times\nend", "def time_range\n start_time..end_time\n end", "def get_time_list(from,to)\n time_list = Array.new\n time_list.push(from)\n temp_from = from.split(\" \")[0]\n temp_to = to.split(\" \")[0]\n date_from = Date.parse temp_from\n date_to = Date.parse temp_to\n if date_to < date_from\n puts \"from is starttime,to is endtime\"\n return nil\n end\n time = Array.new\n date_from.upto( date_to){ |i| time.push(i.to_s); time_list.push(\"#{i} 24:00:00\")}\n time_list[time_list.size-1] = to\n return time,time_list\n end", "def time_slots\n\n # you can book by the hour, and you can stay for an hour\n reservation_interval = 1.hour\n\n # Determine the earliest time we will allow reservation\n # It can't be in the past, we'll start 10 minutes from now\n start_time = Time.zone.now + 10.minutes\n # Then we have to round to the next hour block\n start_time = Time.zone.at( (start_time.to_f / reservation_interval).ceil * reservation_interval )\n # Then, if we are still earlier than opening hour, just use the opening hour\n # We can use the 'max' Array method\n start_time = [start_time, start_time.change(hour: opening_hour)].max\n\n # Determine the furthest in the future we will allow reservations\n end_time = (start_time + 3.days).change(hour: closing_hour)\n\n # Now, we want to make a list of every hour between our start_time and our end_time\n # For this we can use a begin... end while condition loop.\n # We'll start with an empty array that will hold all the hours,\n # and a variable to hold each hour, which we will keep increasing by 1 hour, and then add to our array\n # Our loop condition will have us stop looping once we've reached the end time\n\n all_times = []\n a_time = start_time\n\n begin\n\n # add this time to our list of times\n all_times << a_time\n\n # increment the time\n a_time += reservation_interval\n\n # Once we get to closing time, we have to skip ahead to the next day's opening\n # That way you can't make a reservation at 2am\n if (a_time + reservation_interval) > a_time.change(hour: closing_hour)\n a_time = (a_time + 1.day).change(hour:opening_hour)\n end\n\n end while a_time < end_time\n\n all_times\n end", "def get_start_times\n times = []\n self.start_time.split('%').each do |t|\n times.push(DateTime.strptime(t, '%m-%d-%Y %H:%M'))\n end\n times\n end", "def create_int_array\n [first.time_to_int, last.time_to_int]\n end", "def local_mins(array)\n length = array.length\n return [0] if length == 1\n\n mins = []\n\n # For rest of elments\n (0..length - 1).each do |i|\n if i.zero? && array[i] <= array[i + 1]\n mins << i\n elsif i == length - 1 && array[i] < array[i - 1]\n mins << i\n elsif i + 1 < length && array[i] <= array[i - 1] && array[i] < array[i + 1]\n mins << i\n end\n end\n mins\nend", "def add_to_list(interval)\n # edge case \n if (interval.begin_t < @list[0].begin_t)\n @list.insert(0, IntervalCounter.new(interval.begin_t, @list[0].begin_t, interval.items))\n end\n # other cases\n i = 0\n while @list[i]\n if (interval.begin_t < @list[i].begin_t && interval.end_t > @list[i].end_t)\n @list[i].items = increment_new_list(interval.items, @list[i].items, true)\n \n elsif (interval.end_t > @list[i].begin_t && interval.end_t < @list[i].end_t)\n items_list = increment_new_list(interval.items, @list[i].items, false)\n time_slot = IntervalCounter.new(@list[i].begin_t, interval.end_t, items_list)\n @list[i].begin_t = interval.end_t\n @list.insert(i, time_slot)\n \n elsif (interval.begin_t > @list[i].begin_t && interval.begin_t < @list[i].end_t)\n items_list = increment_new_list(interval.items, @list[i].items, false)\n time_slot = IntervalCounter.new(interval.begin_t, @list[i].end_t, items_list)\n @list[i].end_t = interval.begin_t\n @list.insert(i + 1, time_slot)\n \n elsif (interval.begin_t > @list[i].begin_t && interval.end_t < @list[i].end_t)\n time_slot = IntervalCounter.new(interval.end_t, @list[i].end_t, list[i].items)\n @list[i].end_t = interval.begin_t\n items_list = increment_new_list(interval.items, @list[i].items, false)\n @list.insert(i + 1, IntervalCounter.new(interval.begin_t, interval.end_t, items_list))\n @list.insert(i + 1, time_slot)\n end\n if (interval.end_t > @list[@list.length-1].end_t) \n @list.insert(@list.length, IntervalCounter.new(@list[@list.length-1].end_t, interval.end_t, interval.items))\n end\n i += 1\n end\n @list\n end", "def fill_out_final_blanks(festival_start)\n @current_time_check = end_time_of_previous_show\n festival_end = festival_start + 9.hours\n remaining_hours = TimeDifference.between(end_time_of_previous_show, festival_end).in_hours.to_i\n remaining_hours.times do\n @current_time_check += 1.hour\n @shows_with_blanks << Event.new(start_date_time: @current_time_check-1.hour, end_date_time: @current_time_check)\n end\n return @shows_with_blanks\n end", "def intervals\n parts = {}\n [:minute, :hour, :day, :month, :day_of_week].each do |granularity|\n if times = times_for(granularity)\n parts[granularity] = times\n end\n end\n\n merged_product parts\n # interval_list.concat times.map {|t| {granularity => t} }\n # m = expression[:minute]\n # m.split(\",\").each do |part|\n # time, divisor = part.split(\"/\")\n # start_time, end_time = time.split \"-\"\n\n # interval_list << {:minute => start_time.to_i}\n # end\n end", "def recalc_times(starting_at=0, list=@events)\n\tt = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n\tlist[starting_at .. -1].each { | e |\n\t t += e.delta_time\n\t e.time_from_start = t\n\t}\n end", "def shift_time_array\n time_shift = Time.now.in_time_zone(self.time_zone).utc_offset\n time_shift = (time_shift/3600).round\n\n if self.week_preferred != \"allday\"\n self.week_array.map! { |hour| (hour != 0 ? (hour + (time_shift)) % 24 : 0 )}\n self.week_array.sort!\n end\n\n if self.weekend_preferred != \"allday\"\n self.weekend_array.map! { |hour| (hour != 0 ? (hour + (time_shift)) % 24 : 0 )}\n self.weekend_array.sort!\n end\n end", "def times_for_schedule_update_requests(start_time, end_time)\n times = []\n\n task_time = start_time.beginning_of_day + 15.hours\n task_time += 1.day if task_time < start_time\n\n while task_time < end_time\n times << task_time\n task_time += 1.day\n end\n\n times\n end", "def peak_reg_time()\n arr_hour = $reg_cluster[\"hour\"]\n arr_hour.map { |h| [h, arr_hour.count(h)] }.sort { |a,b| b[1] <=> a[1] }[0..2].map { |val| if !$reg_cluster[\"peak_times\"].include?(val)\n $reg_cluster[\"peak_times\"].push(val)\n end }\n\n #format hour \n def format_hour (hour)\n if hour.to_i > 12 \n hour = (hour.to_i - 12).to_s + \" P.M.\" \n else \n hour = hour + \" A.M.\"\n end \n end \n\n #peak registration days\n arr_day = $reg_cluster[\"days\"]\n arr_day.map { |d| [d, arr_day.count(d)] }.sort { |a,b| b[1] <=> a[1] }.map { |val| if !$reg_cluster[\"peak_days\"].include?(val)\n $reg_cluster[\"peak_days\"].push(val)\n end }\n\n #format day\n def format_day (day)\n case day\n when 0\n \"Sunday\"\n when 1\n \"Monday\"\n when 2\n \"Tuesday\"\n when 3\n \"Wednesday\"\n when 4\n \"Thursday\"\n when 5\n \"Friday\"\n when 6\n \"Saturday\"\n else \"day error\"\n end\n end \n \n #marketing message\n puts \"Peak registration times are #{format_hour($reg_cluster[\"peak_times\"][0][0])} and #{format_hour($reg_cluster[\"peak_times\"][1][0])} on #{format_day($reg_cluster[\"peak_days\"][0][0])}s and #{format_day($reg_cluster[\"peak_days\"][1][0])}s\"\n\nend", "def normalize_ranges(ranges)\n registers = ranges.map { |r| Array(r) }.flatten.sort.uniq\n result = []\n totals = []\n run_start = nil\n count = 0\n registers.each_with_index do |r, i|\n run_start ||= r\n next unless i + 1 == registers.length ||\n r + 1 != registers[i + 1] ||\n (r - run_start) == 100 ||\n REGISTER_BREAKPOINTS.include?(r + 1)\n\n if r == run_start\n result << r\n if (count += 1) == 100\n totals << result\n result = []\n count = 0\n end\n else\n range = run_start..r\n if count + range.count > 100\n totals << result unless result.empty?\n result = []\n count = 0\n end\n count += range.count\n result << range\n end\n run_start = nil\n end\n totals << result unless result.empty?\n totals\n end", "def time_intervals(program,insert_repeat_interval = true)\n intervals = map{|d|d.time_intervals}.flatten.uniq.find_all{|i|program.interval === i.tstart}\n if program.repeat_first_interval and insert_repeat_interval\n firstinterval = intervals.min.copy\n firstinterval.shift!(-program.resolution*60)\n intervals << firstinterval\n end\n intervals\n end", "def merged_meetings_2(meeting_time_ranges)\n # merged_meetings where we cannot assume how many time blocks\n meeting_time_ranges = meeting_time_ranges.sort\n\n merged_meeting_times = []\n\n last_start_time = nil\n last_end_time = nil\n meeting_time_ranges.each do |meeting_time_range|\n start_time = meeting_time_range[0]\n end_time = meeting_time_range[1]\n\n if last_start_time.nil? # no values have been stored yet\n last_start_time = start_time\n last_end_time = end_time\n next\n end\n\n if start_time <= last_end_time # current start_time is before the last end_time\n if start_time < last_start_time\n # current start_time earlier than last_start_time - assign as last_start_time\n last_start_time = start_time\n end\n\n if end_time > last_end_time\n # current end_time later than last_end_time - assign it end_time as last_end_time\n last_end_time = end_time\n end\n next\n end\n\n if start_time > last_end_time\n # we have reached the start of a new range - store the last range\n merged_meeting_times << [last_start_time, last_end_time]\n\n # reset the last_end_time and last_start_time to the current values\n last_start_time = start_time\n last_end_time = end_time\n next\n end\n end\n\n # be sure to append the remaining last meeting time range\n merged_meeting_times << [last_start_time, last_end_time]\n\n merged_meeting_times\nend", "def make_ranges_linear\n min, max = @data.values.sort.first, @data.values.sort.last\n value = ( ( max - min ) / File.open(@palette).readlines.size ).to_i + 1\n offset = (( value / 10 ** (value.to_s.size - 1) ).round + 1)* 10 ** (value.to_s.size - 1)\n last = offset > min ? offset : min\n @ranges = [ { :range => [1, last-1] } ]\n while last < max do\n @ranges << { :range => [last, last + offset - 1] }\n last += offset\n end\n @ranges << { :range => [last, last + offset] }\n end", "def time_sums(n)\n times = []\n hr = 0\n until hr == 24\n min = 0\n until min == 60\n min_sum = min.to_s.split('').map(&:to_i).reduce(&:+)\n hr_sum = hr.to_s.split('').map(&:to_i).reduce(&:+)\n sum = min_sum + hr_sum\n\n minString = min.to_s.split('')\n hrString = hr.to_s.split('')\n\n minString.unshift('0') until minString.length == 2\n hrString.unshift('0') until hrString.length == 2\n\n times << hrString.join('') + \":\" + minString.join('') if sum == n\n\n min += 1\n end\n hr += 1\n end\n times\nend", "def range_summary(array)\r\n\r\nend", "def every(step)\n c_time = self.begin.to_datetime\n finish_time = self.end.to_datetime.end_of_day\n f_compare = exclude_end? ? :< : :<=\n\n arr = []\n while c_time.send(f_compare, finish_time)\n arr << c_time.to_date\n c_time = c_time.advance(step)\n end\n arr\n end", "def block_slots\n slots = []\n\n unless block_delivery_end_time.blank? || block_delivery_start_time.blank?\n\n available_hours = block_delivery_end_time - block_delivery_start_time\n\n number_of_slots = available_hours / 60.minutes\n\n number_of_slots.to_i.times do |i|\n slots << {\n from: block_delivery_start_time + i.hours,\n to: block_delivery_start_time + (i + 1).hours,\n type: :daytime\n }\n end\n end\n\n slots\n end", "def restaurant_time_select\n\t\ttimes = (0..23).map { |hour| [formatted_time(hour), hour] }\n\tend", "def rank_times\n hours = Array.new(24){0}\n @file.each do |line|\n hour = line[:regdate].split(\" \")\n hour = hour[1].split(\":\")\n hours[hour[0].to_i] += 1\n\n end\n hours.each_with_index{ |counter,hours| puts \"#{hours}: #{counter}\"}\n end", "def range_summary(array)\n\nend", "def make_array min,sec\n (\"%d%02d*\" % [min,sec]).gsub(/^0+([^*])/,'\\1').split(//)\nend", "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "def planned_notification_dates\n interval = [90,30,15,5]\n dates_interval = []\n interval.each do |date|\n dates_interval << hw_coverage_end_date.to_date - date\n end\n dates_interval.sort\n end", "def collect\n [@range_low, @range_high]\n end", "def next_time_slots\n\t\ttime_slot_array = self.timeslots\n\t\ttime_slot_array.drop_while do |x|\n\t\t\tx[0].split(\"-\")[0].to_time < Time.now\n\t\tend\n\tend", "def format_hours\n\n self.breakHours = self.breakHours[1,self.breakHours.length] if !self.breakHours.blank? && self.breakHours =~ /0[0-9]:/\n\t\tself.hours = self.hours[1,hours.length] if !self.hours.blank? && self.hours =~ /0[0-9]:/\n \n\tend", "def recalc_times(starting_at=0, list=@events)\n t = (starting_at == 0) ? 0 : list[starting_at - 1].time_from_start\n list[starting_at .. -1].each do |e|\n t += e.delta_time\n e.time_from_start = t\n end\n end", "def create_times_table\n\treturn_array = []\n\tgame_array = []\n\n\t#2 * 2-9\n\t#3 * 3-9\n\t#4 * 4-9\n\t# etc ...\n\n\t(2..9).each do |i|\n\t\t(i..9).each do |j|\n\t\t\tgame_array << i * j\n\t\t\tgame_array << i \n\t\t\tgame_array << j\n\t\t\t2.times do \n\t\t\t\tgame_array << add_wrong(9, game_array)\n\t\t\tend\n\t\t\t2.times do\n\t\t\t\tgame_array << add_wrong(20, game_array)\n\t\t\tend\n\t\t\t2.times do \n\t\t\t\tgame_array << add_wrong(81, game_array)\n\t\t\tend\n\n\t\t\treturn_array << game_array\n\t\t\tgame_array = []\n\t\tend\n\tend\n\treturn_array.each do |game_array|\n\t\tTimes.create(level: 10, t1: game_array[0],\n\t\t\tt2: game_array[1], t3: game_array[2],\n\t\t\tt4: game_array[3], t5: game_array[4],\n\t\t\tt6: game_array[5], t7: game_array[6],\n\t\t\tt8: game_array[7], t9: game_array[8])\n\tend\n\t\t\t\nend", "def history_by_time_period(workout,number,metric,time_period)\n multiplier = 1\n if time_period == \"week\"\n multiplier = 7\n elsif time_period == \"month\"\n multiplier = 30\n elsif time_period == \"year\"\n multiplier = 365\n end\n\n starting_date = Date.today.prev_day(number * multiplier).next_day\n result_array = []\n number.times do\n next_date = starting_date.next_day(multiplier).prev_day\n result_sum = workout.sum_field_by_custom_time_range(metric, method(:check_range), starting_date, next_date)\n result_array << result_sum\n starting_date = starting_date.next_day(multiplier)\n end\n return result_array\n end", "def time\n\talltime = Array.new\n\tslices = 10\n\ti = 0\n\twhile i < slices.to_i do\n\t\talltime.push(Time.now)\n\t\ti+=1\n\tend\n\tyield\nend", "def merge_ranges(schedule)\n merged_schedule = []\n\n schedule.each do |meeting|\n overlapping_time_slots = check_times(meeting, merged_schedule)\n merged_schedule -= overlapping_time_slots if merged_schedule.include?(overlapping_time_slots)\n merged_schedule << slot_merger(overlapping_time_slots)\n end\n\n merged_schedule\nend", "def most_free_time(arr)\n free_times = []\n arr = arr.map do |event|\n start_time, end_time = event.split('-')\n [time_to_minutes(start_time), time_to_minutes(end_time)]\n end.sort\n 1.upto(arr.size - 1) do |idx|\n free_times << arr[idx].first - arr[idx -1].last\n end\n most = free_times.max\n hours, mins = most.divmod(60)\n \"#{format('%02d', hours)}:#{format('%02d', mins)}\"\nend", "def set_boundaries\n return \"Calculated interval for week from input:\" \\\n \" #{@values[:start_time]} - #{@values[:end_time]}\"\n end", "def timeIntervalToNumberInterval(time)\n\t@helper1 = time.split('-')\n\t@helper2 = []\n\t@helper2[0] = @helper1[0].split(':')\n\t@helper2[1] = @helper1[1].split(':')\n# next block deals with possibilities that hours or minutes started from zero, like 08:09 which would mess up the to_i function\n\tif (@helper2[0][0][0] == \"0\")\n\t\t@helper2[0][0] = @helper2[0][0][1,-1]\n\tend\n\tif (@helper2[0][1][0] == \"0\")\n\t\t@helper2[0][1] = @helper2[0][1][1,-1]\n\tend\n\tif (@helper2[1][0][0] == \"0\")\n\t\t@helper2[1][0] = @helper2[1][0][1,-1]\n\tend\n\tif (@helper2[1][1][0] == \"0\")\n\t\t@helper2[1][1] = @helper2[1][1][1,-1]\n\tend\n\n\n\t@answer = []\n\t@answer[0] = @helper2[0][0].to_i*60 + @helper2[0][1].to_i\n\t@answer[1] = (@helper2[1])[0].to_i*60 + (@helper2[1])[1].to_i\n\t@answer\n\nend", "def group_time_accounted_array(params,tcol)\r\n \r\n conditions,data,table_headers,duration = {},[],[],0\r\n \r\n \r\n lookup_activities = current_company.company_activity_types\r\n activities = ReportsHelper.get_lookups(lookup_activities)\r\n\r\n if params[:report][:selected] == \"all\"\r\n billamount,discount,override,finalamount,num_discount = 0,0,0,0,0\r\n tcol.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n\r\n duration += actual_duration.to_f if actual_duration\r\n unless obj.is_internal\r\n billamount = billamount + (obj.actual_activity_rate * actual_duration.to_f)\r\n# discount += obj.billing_percent if obj.billing_percent\r\n if obj.billing_percent\r\n discount += obj.billing_percent\r\n num_discount += 1\r\n end\r\n override += obj.final_billed_amount if obj.billing_method_type == 3\r\n finalamount += obj.final_billed_amount if obj.final_billed_amount\r\n end\r\n\r\n unless obj.is_internal #Not Internal\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),obj.contact ? obj.contact.name : \"\",obj.matter ? obj.matter.clipped_name : \"\",\"No\",actual_duration,activities[obj.activity_type],obj.is_billable ? \"Yes\" : \"No\",obj.actual_activity_rate,obj.actual_activity_rate * actual_duration.to_f,obj.billing_percent,obj.billing_method_type == 3 ? obj.final_billed_amount : '',obj.final_billed_amount]\r\n else\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize), \"N.A\",\"N.A\",\"Yes\",actual_duration,activities[obj.activity_type],\"N.A\",\"N.A\",\"N.A\",\"N.A\",\"N.A\",\"N.A\"]\r\n end\r\n end\r\n # This condition applied to avoid 0/0 = (Not A Number) with ref to Bug -Bug #7108 Shows junk value in T&E PDF report --Rahul P.\r\n if (discount>0 and num_discount>0)\r\n discount = (discount.to_f/num_discount.to_f)\r\n else\r\n discount = 0\r\n end\r\n #raise discount.inspect\r\n conditions[:table_width] = 750\r\n conditions[:all_entries] = [duration,billamount,discount,override,finalamount]\r\n column_widths = { 0 => 60, 1 => 60, 2 => 60 , 3 => 60 , 4 => 40 , 5 => 70 , 6 => 60 ,7 => 40 , 8 => 60 , 9 => 60,10 => 60,11 => 60 , 12 => 60}\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_client),t(:text_matter),t(:label_internal),t(:label_duration_hrs),t(:text_activity_type),t(:text_billable),\"#{t(:label_rate_hr)}\",\"#{t(:text_bill)} #{t(:text_amt)}\",t(:text_discount_p),\"#{t(:text_override)} #{t(:text_amt)}\",\"#{t(:label_final_bill)} #{t(:text_amt)}\"]\r\n alignment = { 0 => :center, 1 => :left,2 => :left, 3 => :left,4 => :center,6 => :left, 7 => :center,10=>:center} if params[:format] == \"pdf\"\r\n \r\n elsif params[:report][:selected] == \"internal\"\r\n \r\n \r\n tcol.each do |obj|\r\n @dur_setng_is_one100th ? actual_duration = one_hundredth_timediffernce(obj.actual_duration) : actual_duration = one_tenth_timediffernce(obj.actual_duration)\r\n duration += actual_duration.to_f if obj.actual_duration\r\n data << [obj.time_entry_date,obj.performer.try(:full_name).try(:titleize),actual_duration,activities[obj.activity_type]]\r\n end\r\n conditions[:internal_entries] = [duration]\r\n table_headers = [t(:label_date),t(:text_lawyer),t(:label_duration_hrs),t(:text_activity_type)]\r\n column_widths = { 0 => 100, 1 => 100, 2 => 100 , 3 => 100} \r\n end\r\n \r\n [data,conditions,table_headers,column_widths, alignment]\r\n \r\n end", "def collect_time_information\n ### Time information\n mark_data_time_information = Array.new\n time_information = @case_details[:case][:system][:time]\n\n mark_data_time_information << 'Answer the following about each time period present in the evidence on the system'\n time_information.each do | key, value | mark_data_time_information << \"-#{key.capitalize}::#{value}\"\n end\n mark_data_time_information << ''\n\n return mark_data_time_information\n end", "def times_for_send_update_requests(start_time, end_time)\n times = []\n\n task_time = start_time.beginning_of_hour + 30.minutes\n task_time += 1.hour if task_time < start_time\n\n while task_time < end_time\n times << task_time\n task_time += 1.hour\n end\n\n times\n end", "def generate_time_slots(time_entries)\n time_entries.map { |entry| extract_available_slots(entry) }.flatten\n end", "def breakingRecords(scores)\n min, max = scores[0], scores[0]\n count_min, count_max = 0, 0\n scores[1...scores.length].each {|i|\n case\n when i < min then count_min += 1; min = i\n when i > max then count_max += 1; max = i\n end\n }\n result = [count_max, count_min]\nend", "def load_hours\n @day = Schedule.first\n @hours = Array.new(48)\n\n @hours[0] =@day.h0\n @hours[1] =@day.h1\n @hours[2] =@day.h2\n @hours[3] =@day.h3\n @hours[4] =@day.h4\n @hours[5] =@day.h5\n @hours[6] =@day.h6\n @hours[7] =@day.h7\n @hours[8] =@day.h8\n @hours[9] =@day.h9\n @hours[10]=@day.h10\n @hours[11]=@day.h11\n @hours[12]=@day.h12\n @hours[13]=@day.h13\n @hours[14]=@day.h14\n @hours[15]=@day.h15\n @hours[16]=@day.h16\n @hours[17]=@day.h17\n @hours[18]=@day.h18\n @hours[19]=@day.h19\n @hours[20]=@day.h20\n @hours[21]=@day.h21\n @hours[22]=@day.h22\n @hours[23]=@day.h23\n @hours[24]=@day.h24\n @hours[25]=@day.h25\n @hours[26]=@day.h26\n @hours[27]=@day.h27\n @hours[28]=@day.h28\n @hours[29]=@day.h29\n @hours[30]=@day.h30\n @hours[31]=@day.h31\n @hours[32]=@day.h32\n @hours[33]=@day.h33\n @hours[34]=@day.h34\n @hours[35]=@day.h35\n @hours[36]=@day.h36\n @hours[37]=@day.h37\n @hours[38]=@day.h38\n @hours[39]=@day.h39\n @hours[40]=@day.h40\n @hours[41]=@day.h41\n @hours[42]=@day.h42\n @hours[43]=@day.h43\n @hours[44]=@day.h44\n @hours[45]=@day.h45\n @hours[46]=@day.h46\n @hours[47]=@day.h47\n\n return @hours\n end", "def total_resouce_value(minutes = 10)\n changes, area, holds, cycles = {}, @data, [], []\n max_x, max_y = area[0].size, area.size\n\n # print_area(area, 0)\n\n (1..minutes).each do |time|\n (0..max_x - 1).each do |x|\n (0..max_y - 1).each do |y|\n adjacents = [\n [x - 1, y - 1],\n [x - 1, y],\n [x - 1, y + 1],\n [x, y - 1],\n [x, y + 1],\n [x + 1, y - 1],\n [x + 1, y],\n [x + 1, y + 1]\n ].select { |k, v| k >= 0 && v >= 0 && k <= max_x - 1 && v <= max_y - 1 }\n .map { |dx, dy| area[dx][dy] }.compact\n\n case area[x][y]\n when '.'\n changes.merge!([x, y] => '|') if adjacents.count('|') >= 3\n when '|'\n changes.merge!([x, y] => '#') if adjacents.count('#') >= 3\n when '#'\n changes.merge!([x, y] => '.') unless adjacents.include?('|') && adjacents.include?('#')\n end\n end\n end\n\n changes.each { |(cx, cy), value| area[cx][cy] = value }\n\n resource = [area.flatten.count('|'), area.flatten.count('#')].reduce(&:*)\n\n if holds.include?(resource)\n unless cycles.include?(resource)\n cycles << resource\n else\n if holds.join.include? cycles.join\n puts \"Part 2: #{cycles[(minutes - holds.size) % cycles.size - 1]}\"\n return\n else\n cycles = []\n end\n end\n end\n\n holds << resource\n\n # print_area(area, time)\n end\n\n puts \"Part 1: #{area.flatten.count('|') * area.flatten.count('#')}\"\n end", "def trim_times(event,v1,v2)\n\t\tevent.times.each do |t|\n\t\t\tif t[0]==v1 && t[1]==v2\n\t\t\t\tevent.times.delete(t)\n\t\t\telsif t[0] >= v1 && t[0] < v2\n\t\t\t\tt[0] = v2\n\t\t\telsif t[1] <= v2 && t[1] > v1\n\t\t\t\tt[1] = v1\n\t\t\telsif t[0] < v1 && t[1] > v2\n\t\t\t\ttemp = t[1]\n\t\t\t\tt[1] = v1\n\t\t\t\tevent.times.push([v2,temp])\n\t\t\tend\n\t\tend\n\tend", "def schedule_raids(array)\n array.each do |key, value1|\n value1['raids'].each do |value2|\n unless Time.parse(value2['0']).past?\n new_cron(\n value2['0'], key, value2['key'],\n \"**#{value2['name']} Raid** is starting now!\"\n )\n end\n unless Time.parse(value2['15']).past?\n new_cron(\n value2['15'], key, value2['key'],\n \"**#{value2['name']} Raid** is starting in 15 minutes!\"\n )\n end\n unless Time.parse(value2['30']).past?\n new_cron(\n value2['30'], key, value2['key'],\n \"**#{value2['name']} Raid** is starting in 30 minutes!\"\n )\n end\n unless Time.parse(value2['45']).past?\n new_cron(\n value2['45'], key, value2['key'],\n \"**#{value2['name']} Raid** is starting in 45 minutes!\"\n )\n end\n next if Time.parse(value2['60']).past?\n new_cron(\n value2['60'], key, value2['key'],\n \"**#{value2['name']} Raid** is starting in 1 hour!\"\n )\n end\n end\nend", "def generate_sleep_times(log)\n\n sleep_times = Array.new(60) { [] }\n current_guard = /Guard #(\\d+) begins/.match(log.first)[1]\n asleep = nil\n awake = nil\n\n log[1..-1].each do |line|\n new_guard = /Guard #(\\d+) begins/.match(line)\n minute = /\\[\\d+-\\d+-\\d+ \\d+:(\\d+)\\]/.match(line)[1].to_i\n if new_guard\n # if asleep\n # sleep_times[current_guard] = sleep_times[current_guard] << [asleep, 60]\n # end\n current_guard = new_guard[1]\n elsif /falls asleep/.match(line)\n asleep = minute\n elsif /wakes up/.match(line)\n awake = minute\n\n (asleep...awake).each do |min|\n sleep_times[min] = sleep_times[min] << current_guard\n end\n asleep = nil\n awake = nil\n end\n end\n\n sleep_times\nend", "def month_range start_time, end_time\n start_date = start_time.month_start.to_date\n end_date = end_time.month_start.to_date\n current_date = start_date\n result = []\n while current_date <= end_date\n result << current_date.to_time\n current_date = current_date.next_month\n end\n result\nend", "def build_spans on_range\n @spans = Array.new @size[1]\n\n @size[1].times do |y|\n spans = []\n left = (@size[1]-y-1)*@size[0]\n start = nil\n\n @size[0].times do |x|\n d = on_range.include?(@pixels[left+x])\n\n if !start && d\n start = x\n elsif start && !d\n spans << [start, x]\n start = nil\n end\n end\n\n spans << [start, @size[0]] if start\n @spans[y] = spans\n end\n end", "def every(step)\n return [@start] unless @finish > @start\n\n [].tap do |range|\n while @start <= @finish do\n range << @start.to_date.to_s\n @start = @start.advance(step)\n end\n end\n end", "def get_intervals\n @notes.combination(2).map do |low_voice, high_voice|\n {\n low: low_voice,\n high: high_voice,\n value: high_voice.pitch - low_voice.pitch\n }\n end\n end", "def time\n [self.game_begins, [self.game_ends, Time.now].min].max\n end", "def graph_data(events, minute_range)\n graph_data =[]\n events.each do | e |\n if (Time.now - e.capture_time) / 60 < minute_range\n graph_data << [e.capture_time, e.value]\n end\n end\n return graph_data\n end", "def count_time(relevant_line)\n t0 = 0\n time_between = []\n relevant_line.each do |n|\n t1 = Time.parse(n)\n d = t1 - t0\n t0 = t1\n time_between << d\n end\n time_between\nend", "def get_break_time\n return {break_time: @config.short_break_duration}\n end", "def watch_frequency\n starts, ends = start_times, end_times\n start_index, end_index = 0, 0\n frequencies = []\n active_intervals = 0\n return [] if end_times.empty?\n (0..end_times.last).each do |video_time|\n start_advance = elements_till(starts, start_index) { |time| time <= video_time }\n end_advance = elements_till(ends, end_index) { |time| time < video_time }\n\n active_intervals += start_advance - end_advance\n start_index += start_advance\n end_index += end_advance\n\n frequencies << active_intervals\n end\n frequencies\n end", "def unfinished_dispatch_time_ranges\n dispatches.where(safe_return: false).map(&:active_time_window)\n end", "def gametime_collapsed_segments\n segments.reduce([]) do |segs, seg|\n if segs.last.try(:gametime_duration_ms) == 0\n skipped_seg = segs.last\n segs + [Segment.new(\n segs.pop.attributes.merge(\n name: \"#{skipped_seg.name} + #{seg.name}\",\n realtime_start_ms: skipped_seg.realtime_start_ms,\n realtime_end_ms: seg.realtime_end_ms,\n realtime_duration_ms: seg.realtime_duration_ms,\n gametime_start_ms: skipped_seg.gametime_start_ms,\n gametime_end_ms: skipped_seg.gametime_end_ms,\n gametime_duration_ms: seg.gametime_duration_ms,\n gametime_reduced: true\n )\n )]\n else\n segs + [seg]\n end\n end\n end", "def crop_start_stop_time_from_data\n # use recorded at (for tracks & message), time for presence\n start_at = nil\n stop_at = nil\n\n self.data.each do |el|\n if el.id != nil\n mom = nil\n CC.logger.debug(\"crop_start_stop_time_from_data of #{el.class}: #{el}\")\n case \"#{el.class}\"\n when \"UserApis::Mdi::Dialog::PresenceClass\"\n mom = el.time\n when \"UserApis::Mdi::Dialog::MessageClass\"\n mom = el.recorded_at\n when \"UserApis::Mdi::Dialog::TrackClass\"\n mom = el.recorded_at\n end\n\n raise \"Couldn't find time associated with a #{el.class}\" if mom == nil\n\n start_at ||= mom\n stop_at ||= mom\n start_at = mom if mom < start_at\n stop_at = mom if mom > stop_at\n\n end\n end\n\n self.start_at = start_at\n self.stop_at = stop_at\n\n end", "def speeches\n self.time_slots\n end" ]
[ "0.7078079", "0.66560566", "0.6642302", "0.66038734", "0.64250267", "0.6342845", "0.6201754", "0.614959", "0.61229086", "0.59673417", "0.58816534", "0.58641773", "0.5860681", "0.58066803", "0.57719225", "0.5770065", "0.57268566", "0.5713473", "0.56946844", "0.56618726", "0.5633413", "0.562019", "0.5584046", "0.55667615", "0.55638826", "0.5549399", "0.55483174", "0.5533312", "0.5530373", "0.55236566", "0.5513486", "0.55077755", "0.5480192", "0.54782957", "0.5475855", "0.54592884", "0.5459062", "0.545677", "0.5452742", "0.5433875", "0.54322904", "0.54192567", "0.5402557", "0.5400763", "0.5397013", "0.5396284", "0.53877705", "0.5364457", "0.5362313", "0.5352666", "0.53446376", "0.534085", "0.5329414", "0.5329366", "0.5320285", "0.531355", "0.53125334", "0.53027505", "0.5295932", "0.5295081", "0.52878374", "0.5286354", "0.5283299", "0.528248", "0.52816546", "0.52796566", "0.52796566", "0.52793527", "0.52765787", "0.5276111", "0.52599597", "0.5259326", "0.5256537", "0.52526087", "0.52439016", "0.52323335", "0.52277374", "0.5225688", "0.52207524", "0.5220729", "0.521963", "0.52190673", "0.5215151", "0.5214085", "0.5212822", "0.5209487", "0.52007645", "0.52006286", "0.51980704", "0.51980233", "0.519718", "0.5185084", "0.5184235", "0.51817954", "0.5168422", "0.5167035", "0.5161214", "0.5153928", "0.5153216", "0.51523495", "0.5151289" ]
0.0
-1
current user keeps track of the user logged in so we can display (log in or log out as..) links on the layout view
def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n\t\tview_context.current_user\n\tend", "def user_layout\n if user_signed_in?\n # If user is admin, set admin flag\n if current_user.admin?\n @admin = true\n end\n # set users fullname for display\n @user_name = current_user.name\n @user = current_user\n end\n \n end", "def current_user\n # Each time you use current_user, it might hit the database, so here we save the value to an instance variable, so you only hit the db once per page request.\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def loggedIn\n @user = current_user\nend", "def current_user_link\n view_context.link_to current_user.name, current_user_url\n end", "def show\n\t\t@user = current_user\n\tend", "def show\n redirect_to(default_url) unless logged_in? || User.count > 0\n @user = current_user\n end", "def current_user\n @current_user if logged_in?\n end", "def current_user\n @current_user if logged_in?\n end", "def set_current_user\n if logged_in?\n @current_user = current_user\n end\n end", "def current_user \n\tif session[:user_id] \n\t\t@current_user = User.find(session[:user_id]) \n\tend \nend", "def current_user\n session[:usr_id]\n end", "def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end", "def current_user\n\tif session[:user_id]\n\t@current_user = User.find(session[:user_id])\n\tend\nend", "def index\n @current_user = current_user if signed_in?\n end", "def current_user\n @usys_logged_in_user ||= lookup_user\n end", "def current_user\n session[:user]\n end", "def current_user\n if session[:user_id] && !User.where(id: session[:user_id]).empty?\n @current_user = User.find(session[:user_id])\n else\n log_out\n end\n end", "def current_user\n load_session\n @current_user\n end", "def set_current_user\n \t\tif session[:user_id]\n \t\t\tCurrent.user = User.find_by(id: session[:user_id])\n \t\tend\n \tend", "def current_user\n if session[:user_id] \n @current_user = User.find(session[:user_id])\n end\n end", "def current_user\n\t@current_user = User.find(session[:user_id]) if session[:user_id]\nend", "def current_user\n\t\tif session[:user_id]\n\t\t @current_user = User.find(session[:user_id])\n\t\telse\n\t\t @current_user = nil\n\t\tend\n\t\t @current_user\n end", "def current_user #used in many methods to pull in the current user stored in sessions. \n \tUser.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n current_session.user\n end", "def current_user\n if session[:user_id]\n @current_user=session[:user_id]\n end\nend", "def current_user\n session.user\n end", "def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend", "def current_user # Check the current user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end", "def show\n @user = current_user\n end", "def current_user\n @current_user ||= find_logged_in_user\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def header_user_link\n @current_user ||= current_user\n get_edit_user_link @current_user, dashboard_path\n end", "def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end", "def current_user\n @user = User.find(session[:user_id])\n end", "def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend", "def current_user\n\t\t\t@current_user ||= User.find_by(id: session[:user_id])\t\n\tend", "def current_user=(user)\n @current_user = user\n session[:user_id] = user.id\n session[:logged_in] = true\n end", "def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end", "def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end", "def current_user\n @current_user || User.find(session[:user_id]) if session[:user_id]\n \tend", "def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n @user = User.find_by(id: session[:user_id])\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user = current_user\n end", "def show\n @user=current_user\n end", "def set_current_user\n if session[:user_id] \n @current_user = User.find(session[:user_id])\n end \n end", "def current_user\n\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n end", "def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end", "def set_logged_in_user\n @logged_in_user = logged_in_user\n end", "def current_user\n User.find_by_id(session[:user_id]) if session[:user_id] \n end", "def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend", "def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend", "def current_user\n current_user = User.find_by(id: session[:user_id])\n end", "def current_user\n \t@current_user ||= User.find_by(:id, session[:user_id])\n end", "def current_user \n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend", "def current_user\n # if current_user is et use it otherwise ask the data store\n @current_user ||= User.find_by(id: session[:user_id])\n end", "def show\n @session_user = current_user\n end", "def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend", "def index\n @user = @current_user\n end", "def current_user\n @current_user = User.find_by(id: session[:user_id])\n end", "def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend", "def current_user\n \t\treturn unless session[:user_id]\n \t\t@current_user ||= User.find_by_id(session[:user_id])\n \tend", "def logged_in(user)\n session[:user_id] = user.id\n flash[:notice] = \"logged in as #{logged_in_user.display_name}\"\n set_last_authenticated_action_at\n redirect_to_last_marked_page_or_default(user.is_admin? ? {:controller => 'admin'} : {:controller => 'user', :action => 'profile', :id => user.id})\n end", "def current_user\n current_usuario\n end", "def identify_the_user\n \t@current_user = User.find_by_id(session[\"user_id\"])\n end", "def current_user\n #非ログインユーザの場合ダミーユーザとして機能させる\n current_user = User.find_by(id: session[:user_id])\n if current_user.nil?\n @current_user = User.find_by(id: 0)\n else\n @current_user ||= current_user\n end\n end", "def current_user\n @current_user = User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n\t\tauthenticated(User)\n\tend", "def me\n @user = current_user\n end", "def current_user\n user = User.find_by(id: session[:user_id])\n end", "def show\n #@user=current_user\n end", "def current_user\n puts \"******* current_user *******\"\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n puts \"@current_user: #{@current_user.inspect}\"\n end", "def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\t\tputs @current_user\t\n\tend", "def current_user\n @current_user ||=User.find(session[:user_id]) if session[:user_id] # memoization\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] # ||= means if not, here means if there is no current user logged in, do the following\n end", "def current_user\n \t@current_user ||= User.find_by_id(session[:user_id]) if session[:user_id] #first time only User.. will work and assign to current user\n end", "def current_user\n\tUser.find_by(id: session[:user_id])\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] \n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end" ]
[ "0.7643973", "0.75631905", "0.7511521", "0.749292", "0.74634653", "0.7450103", "0.74430835", "0.7407329", "0.7407329", "0.74049497", "0.74004626", "0.7374364", "0.7371413", "0.73526466", "0.7342652", "0.73397124", "0.73215735", "0.7320007", "0.7316836", "0.7312192", "0.728954", "0.72835994", "0.7280736", "0.7274388", "0.7265849", "0.7261344", "0.72596264", "0.7247659", "0.7242554", "0.72413844", "0.7237624", "0.72369665", "0.72361076", "0.72361076", "0.72308123", "0.72240627", "0.721415", "0.72109246", "0.72108924", "0.721076", "0.72096086", "0.7205762", "0.72022605", "0.7198792", "0.71956354", "0.71956354", "0.7194583", "0.71944237", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.719388", "0.7193061", "0.7189615", "0.71893513", "0.7189162", "0.7187589", "0.71852934", "0.717799", "0.71774673", "0.71774673", "0.71758723", "0.7174477", "0.71737266", "0.7173186", "0.7166172", "0.7165848", "0.7165732", "0.71649677", "0.71648806", "0.7153962", "0.7153586", "0.7151531", "0.714869", "0.7138915", "0.7132247", "0.7131482", "0.71314657", "0.7129986", "0.71289504", "0.712865", "0.71283656", "0.71266985", "0.7125936", "0.7124901", "0.7124547", "0.71223086", "0.71209574", "0.7115179", "0.71150655", "0.71150655" ]
0.0
-1
Silly but usable form prototype Not really meant to be used in a real case It uses a textarea for everything Override it Or even better, use SequelCrushyform plugin instead
def backend_fields(cols) o = '' cols.each do |c| identifier = "#{id.to_i}-#{self.class}-#{c}" o << "<label for='#{identifier}'>#{c.to_s.capitalize}</label><br />\n" o << "<textarea id='#{identifier}' name='model[#{c}]'>#{self.send(c)}</textarea><br />\n" end o end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form; end", "def text_area; end", "def forms; end", "def ing_form; end", "def _whimsy_forms_input(\n name: nil,\n label: 'Enter string',\n type: 'text',\n rows: nil, # If rows, then is a textarea instead of input\n value: '',\n required: false,\n readonly: false,\n icon: nil,\n iconlabel: nil,\n iconlink: nil,\n placeholder: nil,\n pattern: nil,\n helptext: nil\n )\n return unless name\n tagname = 'input'\n tagname = 'textarea' if rows\n aria_describedby = \"#{name}_help\" if helptext\n _div.form_group do\n _label.control_label.col_sm_3 label, for: \"#{name}\"\n _div.col_sm_9 do\n _div.input_group do\n if pattern\n _.tag! tagname, class: 'form-control', name: \"#{name}\", id: \"#{name}\",\n type: \"#{type}\", pattern: \"#{pattern}\", placeholder: \"#{placeholder}\", value: value,\n aria_describedby: \"#{aria_describedby}\", required: required, readonly: readonly\n else\n _.tag! tagname, class: 'form-control', name: \"#{name}\", id: \"#{name}\",\n type: \"#{type}\", placeholder: \"#{placeholder}\", value: value,\n aria_describedby: \"#{aria_describedby}\", required: required, readonly: readonly\n end\n _whimsy_forms_iconlink(icon: icon, iconlabel: iconlabel, iconlink: iconlink)\n end\n if helptext\n _span.help_block id: \"#{aria_describedby}\" do\n _markdown \"#{helptext}\"\n end\n end\n end\n end\n end", "def textarea_field?(field_name); end", "def text_field; end", "def change_form_content \n\tend", "def set_form(easy)\n end", "def default_form_builder; end", "def create_textarea_field(form,\n value,\n name,\n label,\n field_id,\n required: false,\n validation: nil,\n html_class: nil,\n readonly: false,\n index: 0,\n ttip: nil,\n example: nil,\n default_value: nil)\n render partial: 'dynamic_form/fields/textarea_field',\n locals: {\n f: form,\n index:,\n field_value: value,\n field_name: name,\n field_label: label,\n field_class: html_class,\n field_id:,\n input_type: nil,\n readonly:,\n required:,\n validation:,\n ttip:,\n example:,\n default_value:\n }\n end", "def textareas; end", "def _whimsy_forms_input(**args)\n return unless args[:name]\n args[:label] ||= 'Enter string'\n args[:type] ||= 'text'\n args[:id] = args[:name]\n args[:aria_describedby] = \"#{args[:name]}_help\" if args[:helptext]\n _whimsy_control_wrapper(args) do\n args[:class] = 'form-control'\n if args[:rows]\n _textarea! type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class], aria_describedby: args[:aria_describedby], rows: args[:rows] do\n _! args[:value]\n end\n else\n _input type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class], aria_describedby: args[:aria_describedby]\n end\n end\n end", "def text_area_tag(name, content = T.unsafe(nil), options = T.unsafe(nil)); end", "def input_textarea(name, attributes = {})\n input_text(name).merge(attributes)\n end", "def script_form_double\n BootstrapForm::FormBuilder.new('script', nil, self, {})\n end", "def originalsourceform; end", "def textarea(label, name, args = {})\n id = args[:id] ? args[:id] : id_for(name)\n \n # Get the value of the textarea\n if !args[:value] and @form_values.respond_to?(name)\n value = @form_values.send(name)\n else\n value = args[:value]\n args.delete(:value)\n end\n \n args = args.merge(:name => name, :id => id)\n\n @g.p do\n label_for(id, label, name)\n @g.textarea(args){ value }\n end\n end", "def injection_form\n # Nothing to do here\n end", "def form_input(fieldtype, modelname, fieldname)\n case fieldtype\n when \"text\"\n text_field modelname, fieldname\n when \"password\"\n password_field modelname, fieldname\n when \"textarea\"\n text_area modelname, fieldname, \"rows\" => 5, \"cols\" => 30\n when \"submit\"\n submit modelname, fieldname\n end\n end", "def build_line_form(line,action,caption,is_edit = nil)\n\n field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'line_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'line_phc'}\n\n field_configs[field_configs.length()] = {:field_type=>'CheckBox', :field_name=>'is_dedicated'}\n\n\n build_form(line,field_configs,action,'line',caption,is_edit)\n\n\n end", "def emit_input(\n name: nil,\n label: 'Enter string',\n type: 'text',\n rows: nil, # If rows, then is a textarea instead of input\n value: '',\n required: false,\n readonly: false,\n icon: nil,\n iconlabel: nil,\n iconlink: nil,\n placeholder: nil,\n pattern: nil,\n helptext: nil\n )\n return unless name\n tagname = 'input'\n tagname = 'textarea' if rows\n aria_describedby = \"#{name}_help\" if helptext\n _div.form_group do\n _label.control_label.col_sm_3 label, for: name\n _div.col_sm_9 do\n _div.input_group do\n if pattern\n _.tag! tagname, class: 'form-control', name: name, id: name,\n type: type, pattern: pattern, placeholder: placeholder, value: value,\n aria_describedby: aria_describedby, required: required, readonly: readonly\n else\n _.tag! tagname, class: 'form-control', name: name, id: name,\n type: type, placeholder: placeholder, value: value,\n aria_describedby: aria_describedby, required: required, readonly: readonly\n end\n if iconlink\n _div.input_group_btn do\n _a.btn.btn_default type: 'button', aria_label: iconlabel, href: iconlink, target: 'whimsy_help' do\n _span.glyphicon class: icon, aria_label: iconlabel\n end\n end\n elsif icon\n _span.input_group_addon do\n _span.glyphicon class: icon, aria_label: iconlabel\n end\n end\n end\n if helptext\n _span.help_block id: aria_describedby do\n _ helptext\n end\n end\n end\n end\nend", "def emit_input(\n name: nil,\n label: 'Enter string',\n type: 'text',\n rows: nil, # If rows, then is a textarea instead of input\n value: '',\n required: false,\n readonly: false,\n icon: nil,\n iconlabel: nil,\n iconlink: nil,\n placeholder: nil,\n pattern: nil,\n helptext: nil\n )\n return unless name\n tagname = 'input'\n tagname = 'textarea' if rows\n aria_describedby = \"#{name}_help\" if helptext\n _div.form_group do\n _label.control_label.col_sm_3 label, for: \"#{name}\"\n _div.col_sm_9 do\n _div.input_group do\n if pattern\n _.tag! tagname, class: 'form-control', name: \"#{name}\", id: \"#{name}\",\n type: \"#{type}\", pattern: \"#{pattern}\", placeholder: \"#{placeholder}\", value: value,\n aria_describedby: \"#{aria_describedby}\", required: required, readonly: readonly\n else\n _.tag! tagname, class: 'form-control', name: \"#{name}\", id: \"#{name}\",\n type: \"#{type}\", placeholder: \"#{placeholder}\", value: value,\n aria_describedby: \"#{aria_describedby}\", required: required, readonly: readonly\n end\n if iconlink\n _div.input_group_btn do\n _a.btn.btn_default type: 'button', aria_label: \"#{iconlabel}\", href: \"#{iconlink}\", target: 'whimsy_help' do\n _span.glyphicon class: \"#{icon}\", aria_label: \"#{iconlabel}\"\n end\n end\n elsif icon\n _span.input_group_addon do\n _span.glyphicon class: \"#{icon}\", aria_label: \"#{iconlabel}\"\n end\n end\n end\n if helptext\n _span.help_block id: \"#{aria_describedby}\" do\n _ \"#{helptext}\"\n end\n end\n end\n end\nend", "def text_area(method, options = {})\n label_text = options.delete(:label)\n label_text += \"*\" if attr_required?(method)\n @template.content_tag(:div, :class => \"input-field\") do\n @template.content_tag(:div, :class => \"input-field-header\") do\n label(method, label_text) +\n error_html(method)\n end +\n super\n end.html_safe\n end", "def form_data?; end", "def input_description(f, name, id = nil)\n f.input name, as: :text, input_html: { 'data-parsley-trigger': 'keyup',\n 'data-parsley-minlength': 3,\n 'data-parsley-maxlength': 512,\n 'data-parsley-validation-threshold': 0,\n id: id}\n end", "def input_description(f, name, id = nil)\n f.input name, as: :text, input_html: { 'data-parsley-trigger': 'keyup',\n 'data-parsley-minlength': 3,\n 'data-parsley-maxlength': 512,\n 'data-parsley-validation-threshold': 0,\n id: id}\n end", "def textarea(name = \"\", cols = 70, rows = 10) # :yield:\n attributes = if name.kind_of?(String)\n { \"NAME\" => name, \"COLS\" => cols.to_s,\n \"ROWS\" => rows.to_s }\n else\n name\n end\n super(attributes)\n end", "def spoofForm(val)\n @deltaflag = false\n @form = val\n end", "def setup(easy)\n super\n if form.empty?\n easy.postfieldsize = 0\n easy.copypostfields = \"\"\n end\n end", "def form_field\n case self.column_type\n when \"text\"\n %{<textarea name=\"#{self.form_element_name}\" id=\"#{self.form_element_id}\" cols=\"60\" rows=\"20\"><%= @#{self.model_name}.#{self.column_name} %></textarea>}\n else\n %{<input type=\"text\" name=\"#{self.form_element_name}\" id=\"#{self.form_element_id}\" size=\"30\" value=\"<%= @#{self.model_name}.#{self.column_name} %>\" />}\n end\n end", "def fill_inputs\n update(:all,'input').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element[:value] = send($1).send($2)\n end\n end\n update(:all,'textarea').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element.inner_html = send($1).send($2)\n end\n end\n end", "def new_text_input\n end", "def replace_form_frame\n end", "def initialize form, config={}, &block\n \n @text = config.fetch(:text, \"NOTFOUND\")\n @editable = false\n @focusable = false\n # we have some processing for when a form is attached, registering a hotkey\n register_events :FORM_ATTACHED\n super\n @justify ||= :left\n @name ||= @text\n @repaint_required = true\n end", "def render_grid_input(name, value, **opt)\n render_form_input(name, value, **opt, type: :textarea)\n end", "def html_form\n f = String.new\n f << form_operation.in_hidden(name:'operation')\n f << id.in_hidden(name:'quiz[id]', id:\"quiz_id-#{id}\")\n # Le temps courant, au cas où, pour voir si le formulaire n'est\n # pas soumis trop vite\n f << NOW.in_hidden(name: 'quiz[time]')\n f << questions_formated\n f << bouton_soumission_ou_autre.in_div(class: 'buttons')\n\n f = f.force_encoding('utf-8').in_form(id: form_id, class:'quiz', action: form_action)\n end", "def configure_form(var_oid, use_format, form_field_name, form_field_oid, form_field_label)\n wait_for_add_new\n add_new.click\n wait_for_variable_oid\n variable_oid.set var_oid\n format.set use_format\n field_name.set form_field_name\n field_oid.set form_field_oid\n label.set form_field_label\n save_form.first.click\n end", "def _form\n @comment = Comment.new\n end", "def title_input\n adding_field do |f|\n f.text_field :title, :class => \"text_area\", :id => \"question_title\", :autocomplete => 'off'\n end\n end", "def build_subline_form(action,caption)\n\n\tline_config_codes = LineConfig.find_by_sql('select distinct line_config_code from line_configs').map{|g|[g.line_config_code]}\n\tline_config_codes.unshift(\"<empty>\")\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\t field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_code'}\n\n\t field_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'subline_description'}\n\n#\t----------------------------------------------------------------------------------------------\n#\tCombo fields to represent foreign key (line_config_id) on related table: line_configs\n#\t----------------------------------------------------------------------------------------------\n\tfield_configs[2] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'line_config_code',\n\t\t\t\t\t\t:settings => {:list => line_config_codes}}\n\n\tbuild_form(nil,field_configs,action,'subline',caption)\n\nend", "def form\n end", "def description_input\n adding_field do |f|\n view_context.render \"questions/editor\", :f => f\n end\n end", "def default_input_html; {} end", "def setup_form\n build_form\n super\n end", "def initialize form=nil, config={}, &block\n @form = form\n @buffer = String.new\n #@type=config.fetch(\"type\", :varchar)\n @row = 0\n @col = 0\n @editable = true\n @focusable = true\n #@event_args = {} # arguments passed at time of binding, to use when firing event\n map_keys \n init_vars\n register_events(:CHANGE)\n super\n @width ||= 20\n @maxlen ||= @width\n end", "def form_node; end", "def short_answer(answer)\n frm.text_field(:name=>/deliverShortAnswer/).value=answer\n end", "def xf_text_area (object_name, method, label = nil, attrs = {})\n attrs = attrs.symbolize_keys()\n text (\"textarea\", object_name, method, label, attrs)\n end", "def textarea config={}, &block\n require 'canis/core/widgets/extras/rtextarea'\n # TODO confirm events many more\n events = [ :CHANGE, :LEAVE, :ENTER ]\n block_event = events[0]\n #_process_args args, config, block_event, events\n #config[:width] = config[:display_length] unless config.has_key? :width\n # if no width given, expand to flows width\n #config[:width] ||= @stack.last.width if @stack.last\n useform = nil\n #useform = @form if @current_object.empty?\n w = TextArea.new useform, config\n w.width = :expand unless w.width\n w.height ||= :expand # TODO This has to come before other in stack next one will overwrite.\n _position(w)\n w.height ||= 8 # TODO\n # need to expand to stack's width or flows itemwidth if given\n if block\n w.bind(block_event, &block)\n end\n return w\n end", "def formation; end", "def help; @form.help_manager.display_help; end", "def text_field(name, value = nil, options = {})\n\t\t\tset_class(options)\n\t\t\tsuper\n\t\tend", "def build_comment_form\n old_build_comment_form\n span I18n.t('active_admin.comments.comments_help'), class: 'empty'\n end", "def override_input(form_ui)\n method = \"active_scaffold_input_#{form_ui}\"\n method if respond_to? method\n end", "def form_start\n ''\n end", "def initialize form, config={}, &block\n @surround_chars = ['[', ']'] # 2008-12-23 23:16 added space in Button so overriding\n super\n end", "def build_field(value, index)\n options = build_field_options(value, index)\n cp_service = AuthorityService::CurrentPersonService.new\n options[:value] = cp_service.find_value_string(value)\n if options.delete(:type) == 'textarea'.freeze\n @builder.text_area(attribute_name, options)\n else\n @builder.text_field(attribute_name, options)\n end\n end", "def edit_form\n\t\tnewform = \"\"\n\t\titem_text = question_items.first.text #\n\t\tanswer_item = (self.answer_item.nil? or (self.answer_item =~ /\\d+([a-z]+)/).nil?) ? \"\" : \"\\t\" + $1 + \". \"\n\t\tself.question_items.each do |item|\n\t\t\tnewform = if item.position==1\n\t\t\t\tdiv_item( answer_item + item.text, \"itemquestiontext span-9\")\n\t\t\telse\n\t\t\t\tdiv_item( item_text, \"itemquestiontext span-9\")\n\t\t\tend\n\t\tend\n\t\tnewform\n\tend", "def setField (name , value , formName = \"\" , frameName = \"\" , append=false)\n fname = getFunctionName()\n log fname + ' Starting. Trying to set field with name: ' + name + ' to ' + value.to_s if $debuglevel >=0\n messages = []\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name and o == nil and ( c.invoke(\"type\").to_s.downcase == \"text\" or c.invoke(\"type\").to_s.downcase == \"textarea\" )\n\n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n #o = container.all[ name.to_s ] \n # the line above is the preffered way to do this \n # but the frames whack it - maybe we can try getElementByName.....\n # o = container.getElementByName( name.to_s )\n # this didnt seem to work either!!\n\n if o == nil\n return false, [ OBJECTNOTFOUND ]\n end\n\n if o.disabled\n return false, [ OBJECTDISABLED ]\n end\n\n\n setBackGround(o) \n o.focus() \n if append ==false\n # clear out the field first\n if o.value.length > 0\n o.select()\n o.fireEvent(\"onSelect\")\n if waitForIE()\n # we dont want to wait here\n else\n clearBackground()\n return false, [fname + \" problem loading the page\"]\n end\n\n\n o.value = \"\"\n o.fireEvent(\"onKeyPress\")\n o.fireEvent(\"onChange\")\n end\n\n end\n\n doKeyPress( o , value ) \n o.fireEvent(\"onKeyPress\")\n o.fireEvent(\"onChange\")\n\n if waitForIE()\n \n else\n clearBackground()\n return false, [fname + \" problem loading the page\"]\n end\n\n\n rescue => e\n log fname + \" threw an exception: #{e} \\n #{e.backtrace.join(\"\\n\")} \" if $debuglevel >=0\n #showException(e)\n clearBackground()\n return false, [OBJECTNOTFOUND]\n end\n clearBackground()\n return true, messages\n end", "def input_html_options; end", "def text_input; end", "def form_type\n ''\n end", "def prompt_text(form, answer, hint)\n form.text_field :answer, :class => 'form-control input-lg', :placeholder => hint\n end", "def fast_input_form(options = {}, value = nil) # 20-9 is value deprecated?\n\t\tdisabled = options[:disabled] ? true : false\n\t\tshow_all = options[:show_all].nil? || options[:show_all] #show_all = options[:show_all].nil? ? false : true\n\t\tfast = options[:fast] ? true : false\n\t\tedit = options[:edit] ? true : false\n\t\tvalue = options[:value] || nil\n\t\tno = options[:number].to_s || self.question.number.to_s \n\t\tc_id = cell_id(no)\n\n\t\tnewform = []\n\t\tquestion_no = \"Q\" + no # self.question_no.number.to_s\n\t\trequired = self.required? ? \"required\" : \"\"\n\n\t\tlabel = []\n\t\tswitch_src = \"\"\n\t\tshow_value = false\n\t\tself.question_items.each_with_index do |item, i|\n\t\t\tswitch_src = (i > 0 && !fast) ? switch_source(options) : \"\" # set switch on positive answers; 0 is 'no'\n\t\t\tvalues << item.value\n\t\t\tshow_value = true if(item.text.to_i == 0 and not ((item.text == \"0\") || (item.text == \"1\")))\n\t\t\tlabel << (show_value || (item.text.to_i == 0 and not ((item.text == \"0\") || (item.text == \"1\"))) ? (\"<span>#{item.value} = #{item.text}</span>\") : item.text) unless item.text.empty?\n\t\tend\n\t\t# if items.to_i has duplicates, they are probably 0's, meaning that they have text in them, not just numbers as values. When more than one text becomes 0, there's more than one not-integer text\n\t\t# shows text values, except where all item texts are numbers\n\t\tshow_label = self.question_items.map { |item| item.text.to_i }.select {|i| i == 0}.size > 1\n\t\tnewform = div_item((show_label ? label.map {|l| span_item(l, fast_inner_span)}.join : \"\"), \"radiolabel\") <<\n\t\tspan_item(\" <input id='#{c_id}' \" <<\n\t\t\"name='#{question_no}[#{c_id}]' class='rating #{required} #{switch_src} #{c_id}' type='text' #{(self.value.nil? ? \"\" : \"value='\" + self.value.to_s + \"'\")} size='2' >\", \"radio\") << # removed />\n\t\t\"\\n\" << self.add_validation(options)\n\t\treturn div_item(newform, \"#{class_name} #{fast_inner_span}\")\n\tend", "def emailform\n end", "def emailform\n end", "def form_setup\n\tend", "def text_area(label, options = {})\n if options[:long]\n options.reverse_merge!({ :rows => 20, :cols => 70 })\n else\n options.reverse_merge!({ :rows => 10, :cols => 30 })\n end\n\n labeled_field(label, options) { super label, options }\n end", "def create_input object_id, model_name, text_area_cols=66\n\n coder = HTMLEntities.new # create a coder to code value fields for each question\n\n obj_id = object_id\n obj_string = get_camel_caps(model_name)\n obj = obj_string.constantize.find(obj_id)\n obj_type = obj.field_type\n subq_field_name = model_name + \"_sub[\" + obj_id.to_s + \"]\"\n editing = @study.nil?\n retVal = \"\"\n if obj_type.match(\"matrix_\")\n retVal = create_matrix_input(obj, obj_type, model_name, {:editing=>editing})\n else\n\n # if this is a text field there are no options. otherwise, get the options\n unless obj_type == \"text\"\n # gather options for this field\n question_choices = (obj_string + \"Field\").constantize.where(model_name + \"_id\" => obj_id).order(\"row_number ASC\")\n options = question_choices.collect{|opt| opt.option_text}\n\n end\n chosen_values = []\n #unless session[:study_id].nil?\n unless @study.nil?\n chosen = get_selected(obj_id, model_name, obj_string)\n chosen_values = chosen.collect{|x| x[0]}\n chosen_subqs = chosen.collect{|x| x[1]}\n end\n case obj_type\n # RADIO BUTTON INPUTS\n when \"radio\", \"yesno\"\n i=0\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"CHECKED\"\n end\n\n retVal += '<input aria-label=\"Question Answer Option\" class=\"cbox question_radio_input editable_field\" title=\"option\" type=\"radio\" section_name=\"'+model_name+'\" option_id=\"'+question_choices[i].id.to_s+'\" obj_id=\"'+obj.id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+']\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + 'id = \"' + model_name + '_' + obj_id.to_s + '_' + question_choices[i].id.to_s + '\" ' + checked.to_s + '> <label>' + option.to_s + '</label>'\n\n if question_choices[i].has_subquestion\n #retVal += '... <span class=\"radio_group_'+obj_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_sq_span\">'\n retVal += \"...<span class='radio_group_#{obj_id.to_s}' id='option_#{question_choices[i].id.to_s}_sq_span'>\"\n disabled = \"\"\n\n if checked == \"CHECKED\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, subq_field_name, 'radio',\"false\")\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, subq_field_name, 'radio',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n end\n unless editing || obj_string.match(\"^Eft\")\n retVal += \"<br/><a href='#' class='clear_selection_link' question_name='#{model_name}[#{obj_id.to_s}]'>Clear Selections</a><br/>\"\n end\n # SELECT (DROPDOWN BOX) INPUTS\n when \"select\"\n retVal += '<select class=\"question_select_input editable_field\" title=\"Make Your Selection\" section_name=\"'+model_name+'\" obj_id=\"'+obj_id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+']\" id=\"'+model_name+'_'+obj_id.to_s+'\">'\n # NO LONGER USING THE AUTO-OTHER FIELD\n #retVal += attach_listener_for_other(model_name+\"_\"+obj_id.to_s)\n\n #some variables for showing the other fields\n\n # WE ARE NO LONGER USING THE 'OTHER' FIELD SINCE USERS CAN ADD THEIR OWN\n #options << 'Other'\n text_input = \"\"\n found_it = false\n found_at_index = -1\n i=0\n retVal += \"<option value='' >-- Make Your Selection --</option>\"\n options.each do |option|\n selected = \"\"\n if chosen_values.include?(option.to_s)\n selected = \"SELECTED\"\n found_it = true\n found_at_index = i\n # NO LONGER USING THE AUTOMATIC 'OTHER' FIELD\n #elsif chosen_values.length > 0 && !found_it && option.to_s == \"Other\"\n #\tselected = \"SELECTED\"\n #\ttext_input = get_other_input_element(chosen_values[0], obj_id.to_s, model_name)\n end\n continued=\"\"\n if !question_choices[i].nil?\n if question_choices[i].has_subquestion\n continued = \"...\"\n end\n end\n\n retVal += '<option value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\" ' + selected + \">\" + option.to_s + continued+\"</option>\"\n i+=1\n end\n retVal +=\"</select> &nbsp;<span id='select_\" + obj_id.to_s + \"_sq_span'>\"\n if found_it && found_at_index > -1\n if question_choices[found_at_index].has_subquestion\n subq_val = chosen_subqs[chosen_values.index(options[found_at_index])]\n retVal += fill_in_subquestion(question_choices[found_at_index].subquestion, subq_val, subq_field_name, 'select',\"false\")\n end\n ## TOOK OUT THE FOLLOWING LINES WHEN ADDING IN 'MAKE YOUR SELECTION' OPTION\n #elsif\tquestion_choices[0].has_subquestion\n #\tretVal += fill_in_subquestion(question_choices[0].subquestion,nil,subq_field_name,\"select\",false)\n end\n\n retVal += \"</span>\"\n retVal += text_input.to_s\n # CHECKBOX INPUTS\n when \"checkbox\"\n i=0\n options.each do |option|\n checked = \"\"\n if chosen_values.include?(option.to_s)\n checked = \"checked\"\n end\n retVal += '<input aria-label=\"Question Answer Field\" type=\"checkbox\" title=\"option\" section_name=\"'+model_name+'\" class=\"cbox question_checkbox_input editable_field\" ' + checked + ' option_id=\"'+question_choices[i].id.to_s+'\" obj_id=\"'+obj_id.to_s+'\" name=\"'+model_name+'['+obj_id.to_s+'][]\" id=\"'+model_name+'_'+obj_id.to_s+'_'+question_choices[i].id.to_s+'\" value=\"' + coder.encode(option.to_s.gsub('\"','\\\"')) + '\"> <label>' + option.to_s + '</label>'\n\n if question_choices[i].has_subquestion\n retVal += '... <span class=\"checkbox_group_'+obj_id.to_s+'\" id=\"option_' + question_choices[i].id.to_s + '_sq_span\">'\n\n field_name = model_name + \"_sub[\" + obj_id.to_s + \"][\" + question_choices[i].id.to_s + \"]\"\n\n if checked == \"checked\"\n subq_val = chosen_subqs[chosen_values.index(option.to_s)]\n retVal += fill_in_subquestion(question_choices[i].subquestion, subq_val, field_name, 'checkbox',\"\")\n else\n retVal += fill_in_subquestion(question_choices[i].subquestion, nil, field_name, 'checkbox',\"disabled\")\n end\n retVal += '</span>'\n end\n retVal += \"<br/>\"\n i+=1\n end\n else\n value=\"\"\n unless chosen_values.empty?\n value = \"value='#{chosen_values[0]}'\"\n end\n #retVal += '<input type=\"text\"\" class=\"editable_field\" id=\"'+model_name+'_'+obj_id.to_s+'\" name=\"'+model_name+'[' + obj_id.to_s+ ']\"' + value +'>'\n retVal += \"<textarea aria-label='Question Answer Field' cols=#{text_area_cols} rows=1 class='editable_field' id='#{model_name + '_' + obj_id.to_s}' name='#{model_name+'['+obj_id.to_s+']'}'>#{chosen_values.first}</textarea>\"\n end\n end\n return retVal\n end", "def form_p(id, params = {})\n type = params[:type].to_s\n p_class = params[:p_class]\n description = params[:description] || id.to_s.titleize\n model = params[:model]\n default = params[:default]\n if model and not default and model.respond_to? id\n default = model.send(id)\n end\n errors = params[:errors]\n if !errors and model.respond_to? :errors\n errors = model.errors\n else\n errors = {}\n end\n error = errors[id]\n \n p_class = \"#{p_class} error\" if error\n\n unless type\n case default\n when true\n type = 'checkbox'\n when false\n type = 'checkbox'\n else\n type = 'text'\n end\n end\n\n f = \"<p #{p_class.nil? ? '' : 'class=\"' + attr_h(p_class) + '\"'}>\"\n if type == 'checkbox' or type == 'hidden'\n elsif type == 'textarea'\n f << \"<label class=\\\"textarea\\\" for=\\\"#{id}\\\">#{description}</label><br />\"\n else\n f << \"<label for=\\\"#{id}\\\">#{description}</label>\"\n end\n\n case type\n when 'textarea'\n f << \"<textarea name=\\\"#{id}\\\" id=\\\"#{id}\\\">#{Rack::Utils::escape_html default}</textarea>\"\n when 'checkbox'\n f << \"<input type=\\\"checkbox\\\" name=\\\"#{id}\\\" id=\\\"#{id}\\\" #{default ? 'checked=\"checked\"' : ''} />\"\n else\n f << \"<input name=\\\"#{id}\\\" id=\\\"#{id}\\\" type=\\\"#{type}\\\" value=\\\"#{attr_h(default)}\\\" />\"\n end\n\n if type == 'checkbox'\n f << \"<label class=\\\"checkbox\\\" for=\\\"#{id}\\\">#{description}</label>\"\n end\n\n f << \"</p>\\n\"\n end", "def edit\n @prompt = \"save\"\n %[<textarea name='settings' class='form' style='width: 100%; height: 30%;'>#{self.yaml.value || BASIC}</textarea><textarea name='editor' class='form' style='width: 100%; height: 70%;'>#{self.md.value || INDEX}</textarea>];\n end", "def builder\n form\n end", "def bioportal_form_complete options,html_options={}\n options[:value]||=\"name\"\n result = \"\"\n result += javascript_include_tag(\"bioportal_form_complete.js\") unless options[:no_javascript_include]\n\n html_options[:class]=\"bp_form_complete-#{options[:ontology_ids].join(',')}-#{options[:value]}\"\n name = options[:name]\n result += text_field_tag name,nil,html_options\n return result\n end", "def long_form!\n options[:form] = 'long'\n self\n end", "def get_field_edit_html\n '<HTML NOT IMPLEMENT YET>'\n end", "def casein_text_field form, model, attribute, options = {}\n\t casein_form_tag_wrapper form.text_field(attribute, options.merge({:class => 'caseinTextField'})), form, model, attribute, options\n\tend", "def onSubmit(request, response, form, errors)\r\n\treturn form\r\n end", "def ui_text_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Texts::TextField.new(content, options, html_options, &block).render\n end", "def form_class\n # logic to generate the clas on the form, easy to test\n end", "def decorate_form(form, onclick)\r\n\r\n fields = onclick.attr \"onclick\"\r\n fields.to_s =~ /\\{([^}]+)\\}/\r\n fields = $1\r\n fields = fields.split(\",\").map do |e|\r\n arr = e.gsub(\"'\", \"\").split \":\"\r\n arr.push \"\" unless arr.length == 2\r\n arr[0].strip!\r\n arr[1].strip!\r\n arr\r\n end\r\n fields.each do |field|\r\n form_field = form.field_with :name=>field[0]\r\n if form_field.nil?\r\n form.add_field! field[0]\r\n form_field = form.field_with :name=>field[0]\r\n end\r\n form_field.value= field[1]\r\n end\r\n return form\r\n rescue Exception => e\r\n puts e\r\n end", "def decorate_form(form, onclick)\r\n\r\n fields = onclick.attr \"onclick\"\r\n fields.to_s =~ /\\{([^}]+)\\}/\r\n fields = $1\r\n fields = fields.split(\",\").map do |e|\r\n arr = e.gsub(\"'\", \"\").split \":\"\r\n arr.push \"\" unless arr.length == 2\r\n arr[0].strip!\r\n arr[1].strip!\r\n arr\r\n end\r\n fields.each do |field|\r\n form_field = form.field_with :name=>field[0]\r\n if form_field.nil?\r\n form.add_field! field[0]\r\n form_field = form.field_with :name=>field[0]\r\n end\r\n form_field.value= field[1]\r\n end\r\n return form\r\n rescue Exception => e\r\n puts e\r\n end", "def form_field\n case self.column_type\n when \"text\"\n %{<%= :#{self.model_name}.text_area :#{self.column_name}, :label => true %>}\n when \"date\"\n %{<%= :#{self.model_name}.date_select :#{self.column_name}, :label => true %>}\n when \"date_time\"\n %{<%= :#{self.model_name}.date_time_select :#{self.column_name}, :label => true %>}\n else\n case self.column_name.downcase\n when /password/\n %{<%= :#{self.model_name}.password_field :#{self.column_name}, :label => true %>}\n else\n %{<%= :#{self.model_name}.text_field :#{self.column_name}, :label => true %>}\n end\n end\n end", "def standard\n form = self.mailbox\n form += @config[:tag_separator] + self.tag if self.tag\n form += \"(\" + self.comment + \")\" if self.comment\n form = form.gsub(/([\\\\\\\"])/, '\\\\\\1') # Escape \\ and \"\n if form =~ /[ \\\"\\(\\),:<>@\\[\\\\\\]]/ # Space and \"(),:;<>@[\\]\n form = %Q(\"#{form}\")\n end\n form\n end", "def build_input(value, index)\n options = build_field_options(value, index)\n\n # convert name from 'publication[title]' to 'publication[title_value]'\n options[:name] = options[:name].gsub(/\\[([^\\]]+)\\]/, '[\\1_value]')\n\n if options.delete(:type).to_s == 'textarea'\n @builder.text_area(attribute_name, options)\n else\n @builder.text_field(attribute_name, options)\n end\n end", "def form_type\n return '<form accept-charset=\"UTF-8\" action=\"/jobs\" class=\"new_job\" enctype=\"multipart/form-data\" id=\"job_form\" method=\"post\">'\n end", "def create_form\n code = \"{{message}}\\n\"\n code += \"<form ng-submit='action(#{@doc['name'].downcase})' ng-show='!message'>\\n\"\n @doc['fields'].each{ |field|\n if field['name'] == 'id' then\n code += \"\\t<span ng-show=\\\"location.indexOf('/#{@doc['name'].downcase}/edit') < 0 \\\">\\n\\t\"\n end\n code = code + \"\\t#{field['name'].capitalize}:<br/><input ng-model='#{@doc['name'].downcase}.#{field['name']}' name='#{field['name']}' type='text'/><br/>\\n\"\n \n if field['name'] == 'id' then\n code += \"\\t</span>\\n\"\n end\n }\n code = code + \"<input type='submit' value='Submit'/>\\n\"\n code = code + \"</form>\"\n return code\n end", "def ckeditor_textarea(object, field, options = {})\n options.symbolize_keys!\n \n var = options.delete(:object) if options.key?(:object)\n var ||= @template.instance_variable_get(\"@#{object}\")\n \n if var\n value = var.send(field.to_sym)\n value = value.nil? ? \"\" : value\n else\n value = \"\"\n \n begin\n klass = \"#{object}\".camelcase.constantize\n @template.instance_variable_set(\"@#{object}\", eval(\"#{klass}.new()\"))\n rescue NameError\n end\n end\n id = ckeditor_element_id(object, field)\n \n textarea_options = { :id => id }\n \n textarea_options[:cols] = options[:cols].nil? ? 70 : options[:cols].to_i\n textarea_options[:rows] = options[:rows].nil? ? 20 : options[:rows].to_i\n\n width = options[:width].nil? ? '100%' : options[:width]\n height = options[:height].nil? ? '100%' : options[:height]\n \n textarea_options[:class] = options[:class] unless options[:class].nil?\n \n ckeditor_options = {}\n \n ckeditor_options[:toolbar] = options[:toolbar] unless options[:toolbar].nil?\n ckeditor_options[:skin] = options[:skin] unless options[:skin].nil?\n ckeditor_options[:language] = options[:language] unless options[:language].nil?\n ckeditor_options[:width] = options[:width] unless options[:width].nil?\n ckeditor_options[:height] = options[:height] unless options[:height].nil?\n \n ckeditor_options[:swf_params] = options[:swf_params] unless options[:swf_params].nil?\n \n ckeditor_options[:filebrowserBrowseUrl] = PLUGIN_FILE_MANAGER_URI\n ckeditor_options[:filebrowserUploadUrl] = PLUGIN_FILE_MANAGER_UPLOAD_URI\n \n ckeditor_options[:filebrowserImageBrowseUrl] = PLUGIN_FILE_MANAGER_IMAGE_URI\n ckeditor_options[:filebrowserImageUploadUrl] = PLUGIN_FILE_MANAGER_IMAGE_UPLOAD_URI\n \n output_buffer = ActionView::SafeBuffer.new\n \n if options[:ajax]\n textarea_options.update(:name => id)\n \n output_buffer << tag(:input, { \"type\" => \"hidden\", \"name\" => \"#{object}[#{field}]\", \"id\" => \"#{id}_hidden\"})\n output_buffer << ActionView::Base::InstanceTag.new(object, field, self, var).to_text_area_tag(textarea_options)\n else\n textarea_options.update(:style => \"width:#{width};height:#{height}\")\n \n output_buffer << ActionView::Base::InstanceTag.new(object, field, self, var).to_text_area_tag(textarea_options)\n end\n \n output_buffer << javascript_tag(\"CKEDITOR.replace('#{object}[#{field}]', { \n #{ckeditor_applay_options(ckeditor_options)}\n });\\n\")\n \n output_buffer\n end", "def custom_field_text(field, text)\n frm.text_field(:name=>field).set(text)\n end", "def tinymce_fill_in(name, options = {})\n if %w[selenium selenium_dev sauce].include? settings.driver\n page.driver.browser.switch_to.frame(\"#{name}_ifr\")\n page.find(:css, '#tinymce').native.send_keys(options[:with])\n page.driver.browser.switch_to.default_content\n else\n page.execute_script(\"tinyMCE.get('#{name}').setContent('#{options[:with]}')\")\n end\n end", "def fieldset! *args\n case args.size\n when 2\n label_txt = args.first\n name = label_to_name(args.first)\n val = args.last\n when 3\n label_txt, name, val = args\n else\n raise ArgumentError, \"Argument size can only be 0, 2, or 3: #{args.inspect}\"\n end\n \n fieldset.textarea {\n label label_txt\n textarea( val || '', :name=>name )\n }\n end", "def long_text_field_enter(value)\n control = @field.all(:css, 'textarea[class=\"form-control\"]').first\n control.set \"#{value}\"\n end", "def render\n return ro_standard if @readonly\n set_initial_value\n#\n# @yaml['html'] ||= {}\n# value_send_as = 'p_' + @yaml['name']\n# @yaml['html']['value'] = @parent.params[value_send_as] if @parent.params[value_send_as]\n\n record = record_text_for(@yaml['name'])\n @html << @parent.text_area(record, @yaml['name'], @yaml['html'])\n self\nend", "def form_end\n ''\n end", "def text_area(name, value, options = {})\n options.merge!(:name => name)\n tag(:textarea, options) { value }\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def format_textarea\n copy_options_to_attributes([:cols, :rows])\n if val = @attr.delete(:value)\n tag(:textarea, @attr, [val])\n else\n tag(:textarea)\n end\n end", "def content_element_form(context={})\n \n app = context[:app]\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form = renderer.render('form', 'em') \n \n end" ]
[ "0.69717735", "0.6828864", "0.6736481", "0.6622064", "0.646594", "0.6458824", "0.6398401", "0.63951117", "0.6384517", "0.6329208", "0.62643474", "0.6250424", "0.6152034", "0.61251277", "0.6071548", "0.60506016", "0.6025205", "0.6015348", "0.5955236", "0.59534067", "0.589042", "0.5884805", "0.5877751", "0.58591884", "0.58568037", "0.583095", "0.583095", "0.58081", "0.58058935", "0.5804323", "0.58005637", "0.57856023", "0.5767924", "0.5761478", "0.573467", "0.5731989", "0.57283217", "0.5718314", "0.5717083", "0.57129323", "0.5698661", "0.5693344", "0.56887347", "0.5674818", "0.5674473", "0.56708246", "0.5644034", "0.56297463", "0.5618546", "0.56145024", "0.5612391", "0.5604778", "0.5585616", "0.55721694", "0.5561342", "0.5554597", "0.5548052", "0.5543876", "0.55389255", "0.55360085", "0.5531899", "0.5522286", "0.5501106", "0.54937774", "0.5492499", "0.54889554", "0.54889554", "0.5485745", "0.5482352", "0.54795134", "0.5477127", "0.54770887", "0.5470401", "0.54653", "0.54633236", "0.54552984", "0.5451856", "0.5448913", "0.54424495", "0.5439888", "0.54307246", "0.54307246", "0.5427174", "0.54268265", "0.5425775", "0.5423804", "0.5421693", "0.5418854", "0.54144025", "0.54114085", "0.5410917", "0.54070437", "0.53986317", "0.53942066", "0.5387246", "0.53795284", "0.53795284", "0.53795284", "0.53795284", "0.53750855", "0.5373117" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.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 user_params params.require(:user).permit(:name, :screct_pass, :password) 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
Create/Update a payment method via Samurai Transparent Redirect
def new params[:payment_method_token] ||= current_user.payment_method_token setup_for_transparent_redirect(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_card\n host_url = request.protocol + request.host_with_port \n begin\n result = ChargeBee::HostedPage.update_payment_method(\n { :customer => { :id => @customer_id },\n :redirect_url => host_url + \"/ssp/redirect_handler\",\n :cancel_url => host_url + \"/ssp/subscription\",\n :embed => \"false\" })\n redirect_to result.hosted_page.url\n rescue Exception => e\n redirect_to \"/500\"\n end\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n end", "def create\n order = current_user.orders.find(params[:order_id])\n @payment = Payment.new\n @payment.price = order.price\n @payment.order_id = order.id\n @payment.variable_symbol = order.id.to_s + rand(1..100).to_s.rjust(3, '0')\n url = get_link_url\n @payment.save!\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to url }\n format.json { render :show, status: :created, location: url }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = current_user.profile\n @payment = Payment.new(payment_params)\n @payment.profile = current_user.profile\n if @payment.save\n uri = URI('http://acm.ut.ac.ir/epayment/payments')\n parameters = {\n 'merchant' => \"4452A141\",\n 'amount' => @payment.amount,\n 'redirect' => \"http://acm.ut.ac.ir/events/payments/approve\"}\n response = transact(uri, parameters)\n puts response.body\n @payment.response = response.body\n parsed_response = JSON.parse(response.body)\n if parsed_response[\"status\"] != 1\n redirect_to payments_path, notice: \"در ارتباط با بانک خطایی رخ داده‌است.\"\n return\n end\n @payment.reference_key = parsed_response[\"reference\"]\n if @payment.save\n redirect_to parsed_response[\"bank\"]\n return\n else\n render :new\n end\n else\n render :new\n end\n\n end", "def update \n id = params[\"customer_id\"]\n # Calling the ChargeBee Update Payment Method Hosted Page API to update payment \n # method for a customer by passing the particular customers' customer id.\n # Note : To use this API return url for Update Card API's page must be set. \n \n host_url = request.protocol + request.host_with_port \n result = ChargeBee::HostedPage.update_payment_method({ \n :customer => { :id => id }, \n :embed=> false,\n :redirect_url => host_url + \"/update_payment_method/redirect_handler\",\n :cancel_url => host_url + \"/update_payment_method/profile?customer_id=#{URI.escape(id)}\"\n }) \n \n \n redirect_to result.hosted_page.url\n \n end", "def redirect\n \n if \"succeeded\" == params[\"state\"]\n # Acknowledge the update payment method hosted page id passed in return URL. \n # The response will have customer and their masked payment details.\n result = ChargeBee::HostedPage.acknowledge(params[\"id\"])\n hosted_page = result.hosted_page\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_payment_method/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end", "def payment_form \n unless params[:payment_method_token].blank?\n @payment_method = Samurai::PaymentMethod.find params[:payment_method_token]\n else\n @payment_method = Samurai::PaymentMethod.new :is_sensitive_data_valid => false\n end\n\n unless params[:reference_id].blank?\n @transaction = Samurai::Transaction.find params[:reference_id]\n end\n end", "def create\n @payment = @contract.payments.new(payment_params)\n\n if @payment.save\n render :show, status: :created, location: url_for([@contract, @payment])\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :hosted_payment_form => true)\n @sim_transaction.set_hosted_payment_receipt(AuthorizeNet::SIM::HostedReceiptPage.new(:link_method => AuthorizeNet::SIM::HostedReceiptPage::LinkMethod::GET, :link_text => 'Continue', :link_url => payments_thank_you_url(:only_path => false)))\n\n # @transaction = AuthorizeNet::AIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], :gateway=>:sandbox)\n # credit_card = AuthorizeNet::CreditCard.new('4111111111111111', '1120')\n # @response = @transaction.purchase('10.00', credit_card)\n\n # if @response.success?\n # puts \"Successfully made a purchase (authorization code: #{response.authorization_code})\"\n # else\n # raise \"Failed to make purchase.\"\n # end\n end", "def create\n @payment = Payment.new(payment_params)\n @payment.order_id = params[:order_id]\n respond_to do |format|\n if @payment.save\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount, _links: { next: {profile: \"http://#{my_address}:3000/order\", href: \"http://#{my_address}:3000/orders/#{@payment.order_id}\", enctype: 'application/json'}}}\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: response_json, status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def creator_payment\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n redirect_to button_user_path(@user)\n end\n @nav = \"signup\"\n end", "def create\n respond_to do |format|\n if @payment.save\n store_trip_in_session(@payment.trip_id)\n\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment_method = PaymentMethod.new(params.require(:payment_method).permit(:account_number_id, :customer_id, :expiration_month,\n :expiration_year, :image_id, :payment_type_id, :priority, \n :routing_number))\n\n respond_to do |format|\n if @payment_method.save\n format.html { redirect_to payment_methods_url,\n notice: 'PaymentMethod was successfully created.' }\n format.json { render json: @payment_method, status: :created, location: @payment_method }\n else\n prepFormVariables\n format.html { render action: \"new\" }\n format.json { render json: @payment_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_payment_method = Admin::AccountsPaymentMethod.new(params[:admin_accounts_payment_method])\n\n respond_to do |format|\n if @admin_payment_method.save\n format.html { redirect_to admin_accounts_payment_methods_url }\n format.json { render json: @admin_payment_method, status: :created, location: @admin_payment_method }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_payment_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def use_webtopay \n wp_extras = {\n callbackurl: confirm_order_url,\n cancelurl: confirm_order_url,\n accepturl: confirm_order_url,\n orderid: 20\n }\n\n @payment = WebToPay::Payment(payment_params.merge(wp_extras))\n redirect_to @payment.url\n end", "def create\n authorize PaymentMethod.new(payment_method_params)\n @payment_method = PaymentMethod.new(payment_method_params)\n\n respond_to do |format|\n if @payment_method.save\n format.html { redirect_to edit_user_path(@payment_method.user), notice: 'Payment method was successfully created.' }\n format.json { render :show, status: :created, location: @payment_method }\n else\n flash[:danger] = 'There was an issue adding your new payment method. Please try again or e-mail info@cloudhaus.org for assistance.'\n format.html { redirect_to edit_user_path(@payment_method.user) }\n format.json { render json: @payment_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pay_method = PayMethod.new(pay_method_params)\n\n respond_to do |format|\n if @pay_method.save\n format.html { redirect_to @pay_method, notice: 'Pay method was successfully created.' }\n format.json { render :show, status: :created, location: @pay_method }\n else\n format.html { render :new }\n format.json { render json: @pay_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_payment\n payment = ShopPayment.new({\n :order => @order,\n :gateway => gateway_name,\n :amount => @order.price,\n :card_type => card_type,\n :card_number=> card_number_secure\n })\n \n @order.update_attribute(:status, 'paid')\n \n @result[:payment] = payment.save\n end", "def create\n #PaypalCallback object sends the raw post request to paypal and expects to get VERIFIED back\n response = PaypalCallback.new(params, request.raw_post, ENV[\"PAYPAL_POST_URL\"])\n\n #check that the payment says completed & paypal verifies post content\n if response.completed? && response.valid?\n @transaction = Transaction.find(params[:invoice]) #invoice is a pass through variable that gets embedded in the encrpyted paypal form and we get it back here\n Payment.create(:params => params.to_unsafe_h, :transaction_id => @transaction.id, :amount => params['payment_gross'], :confirmed => true)\n else\n #TODO maybe send out some type of alert to an admin\n end\n head :ok\n end", "def make method\n if params.include?(:user)\n @payment_type_id = params[:user][:payment_type_id].to_i\n @form_url = @user.subscribed_to < Time.zone.now ? make_payment_path(I18n.locale) : make_authorization_path(I18n.locale)\n @method = @user.subscribed_to ? 'sale' : 'authorization'\n case @payment_type_id\n when 1\n self.paypal method\n when 2..3\n self.card method\n else\n redirect_to request.referer, alert: t(:bad_payment, :scope => 'payments.errors') and return\n end\n else\n redirect_to request.referer, alert: t(:no_payment, :scope => 'payments.errors')\n end\n end", "def create\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if ((can_access_invoice payment_params, @payment) && @payment.save)\n format.html { redirect_to preview_invoice_path(@payment.invoice), notice: 'Congratulations! Your payment was successfully processed.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { redirect_to preview_invoice_path(@payment.invoice), notice: 'We were unable to process your payment. Please try again.' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# @payment = Payment.new({\n\t\t# :intent => \"sale\",\n\t\t# :payer => {\n\t\t# :payment_method => \"credit_card\",\n\t\t# :funding_instruments => [{\n\t\t# :credit_card => {\n\t\t# \t:type => params[:payment][:card_type], #\"visa\",\n\t\t# :number => params[:payment][:card_number], #\"4242424242424242\",\n\t\t# :expire_month => params[:payment][\"card_expires_on(2i)\"], #\"1\",\n\t\t# :expire_year => params[:payment][\"card_expires_on(1i)\"], #\"2018\",\n\t\t# :cvv2 => params[:payment][:cvv2], #\"874\",\n\t\t# :first_name => params[:payment][:first_name], #\"Joe\",\n\t\t# :last_name => params[:payment][:last_name], #\"Shopper\",\n\t\t# :billing_address => {\n\t\t# :line1 => params[:payment][:address], #\"52 N Main ST\",\n\t\t# :city => params[:payment][:city], #\"Johnstown\",\n\t\t# :state => params[:payment][:state], #\"OH\",\n\t\t# :postal_code => params[:payment][:postal_code], #\"43210\",\n\t\t# :country_code => params[:payment][:country_code] #\"US\" \n\t\t# }}}]},\n\t\t# :transactions => [{\n\t\t# :amount => {\n\t\t# :total => \"10.00\",\n\t\t# :currency => \"USD\" },\n\t\t# :description => \"This is the payment transaction description.\" }]})\n\n\t\t# @payment.create\n\t\t# if @payment.id.nil?\n\t\t# \terror = @payment.error\n\t\t# \tredirect_to payment_index_url, :alert => error.name+\"\\n\"+error.details.to_s\n\t\t# else\n\t\t# \tparams[:payment][:transaction_id] = @payment.id\n\t\t# \tparams[:payment][:amount] = 10\n\t\t# \t@data = current_user.build_payment(payment_params)\n\t\t# \tif @data.save\n\t\t# \t\tredirect_to payment_index_url, :notice => \"Payment Done with payment id #{@payment.id}\"\n\t\t# \telse\n\t\t# \t\tredirect_to payment_index_url, :alert => \"Something went wrong.\"\n\t\t# \tend\n\t\t# end\n\tend", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => payments_relay_response_url(:only_path => false))\n end", "def payment\n @amount = 10.00\n @sim_transaction = AuthorizeNet::SIM::Transaction.new(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['api_transaction_key'], @amount, :relay_url => payments_relay_response_url(:only_path => false))\n end", "def create\n @company = Company.find(params[:payment][:company_id])\n @debt = Debt.find(params[:payment][:debt_id])\n @payment = Payment.new(payment_params)\n company = @company.id\n debt = @debt.id\n respond_to do |format|\n if @payment.save\n #format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n flash[:notice] = 'Pagamento realizado com sucesso !'\n flash.keep(:notice)\n render :js => \"window.location = '/companies/#{company}/debts/#{debt}'\" and return\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment_instruction\n end", "def create\n params[:payment][:amount].gsub!(/[$,]/, \"\")\n params[:payment][:amount] = (params[:payment][:amount].to_f * 100).to_i\n @payment = Payment.new(payment_params)\n\n if params[:booth_id]\n @payable = @booth = Booth.find(params[:booth_id])\n @payer = @booth.vendor\n else\n @payer = Vendor.find(params[:vendor_id])\n end\n\n @payment.payer = @payer\n @payment.payable = @payable\n\n if @payment.save\n if @payment.errors.empty?\n redirect_to(@payment.payable || @payment.payer, notice: \"Payment was successfully created.\")\n else\n redirect_to(@payment.payable || @payment.payer, alert: @payment.errors.full_messages.join(\".\\n\") + \".\")\n end\n else\n @editable = true\n render(:new)\n end\n end", "def update\n respond_to do |format|\n if @payment.update_attributes(params[:payment])\n store_trip_in_session(@payment.trip_id)\n\n format.html { redirect_to @payment, notice: 'Payment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user_payment_method.update(user_payment_method_params) \n render json: @user_payment_method, status: :ok, location: @user_payment_method\n else\n render json: @user_payment_method.errors, status: :unprocessable_entity\n end\n end", "def redirect_for_paytrail\n return unless params[:state] == \"payment\"\n @payment_method = Spree::PaymentMethod.where(:id => params[:order][:payments_attributes].first[:payment_method_id],\n :environment => Rails.env).first\n if @payment_method && @payment_method.kind_of?(Spree::Gateway::PaytrailPayments)\n @order.update_attributes(object_params)\n\n redirect_to main_app.paytrail_show_path(:order_id => @order.id, :payment_method_id => @payment_method.id)\n end\n end", "def update\n #puts \"params coming to update are:\"\n #puts params.to_s\n check_for_update(@auth_shopping_payment)\n \n @auth_shopping_payment.assign_attributes(@auth_shopping_payment_params)\n \n @auth_shopping_payment = add_owner_and_signed_in_resource(@auth_shopping_payment)\n \n ##note that params and not permitted_params is called, here because the gateway sends back all the params as a naked hash, and that is used directly to verify the authenticity, in the gateway functions.\n #puts \"these are the attributes assigned in the update action.\"\n #puts @auth_shopping_payment.attributes.to_s\n @auth_shopping_payment.payment_params = params\n #puts \"assigned params.\"\n save_response = @auth_shopping_payment.save\n \n ## if save successfull then otherwise, respond_with edit.\n respond_with @auth_shopping_payment, location: (save_response == true ? payment_path(@auth_shopping_payment) : edit_payment_path(@auth_shopping_payment))\n \n end", "def insert_payment_method\n authorize current_employer\n @customer = Customer.new(customer_params)\n pay_service = Services::Pay.new(current_employer, nil, @customer.stripe_card_token)\n\n if pay_service.is_customer_saved?\n redirect_to employers_payment_methods_path,\n notice: 'You have successfully added your payment information!'\n else\n redirect_to employers_payment_verify_path, alert: \"There was an error processing your card. Contact support.\"\n end\n end", "def new\n payment_type = nil \n if params.has_key? :payment_type\n payment_type = params[:payment_type]\n else\n payment_type = 'sign_up'\n end\n @payment = Payment.new\n\n respond_to do |format|\n format.html {\n case payment_type\n when 'sign_up'\n # really want to go to a form, that submits here, i save that info, populate the send\n # thing and send it off to payp.\n render(:action => 'sign_up.rhtml') && return \n when 'trip'\n render(:action => 'trip_sign_up.rhtml') && return \n else\n end\n }\n format.xml { render :xml => @payment }\n end\n end", "def new\n @payment = @application.update_payment session[:payment_type], params[:token]\n end", "def set_payment_method\n @payment_method = PaymentMethod.find_by(id: params[:id],site_id: @site.id)\n redirect_to admin_errors_url(error_template: '403') unless @payment_method\n end", "def create\n @invoice.attributes = params[:invoice]\n @credit_card = ActiveMerchant::Billing::CreditCard.new(params[:active_merchant_billing_credit_card])\n\n respond_to do |wants| \n wants.html do\n if (!@invoice.paying_with_credit_card? || @credit_card.valid?) && @invoice.save then \n \n @survey.billing_info_received!(current_association)\n\n redirect_to survey_path(@survey)\n else\n render :action => :new\n end\n end \n end\n end", "def create\n check_tutorial_params(property_and_casualty_params[:name]) and return\n \n @insurance_card = PropertyAndCasualty.new(property_and_casualty_params.merge(user_id: resource_owner.id, category: Category.fetch(Rails.application.config.x.InsuranceCategory.downcase)))\n authorize @insurance_card\n PolicyService.fill_property_and_casualty_policies(policy_params, @insurance_card)\n respond_to do |format|\n if validate_params && @insurance_card.save\n PolicyService.update_shares(@insurance_card.id, @insurance_card.share_with_ids, nil, resource_owner)\n PolicyService.update_properties(@insurance_card, property_params)\n @path = success_path(property_path(@insurance_card), property_and_casualty_shared_view_path(shared_user_id: resource_owner.id, id: @insurance_card.id))\n \n # If comes from Tutorials workflow, redirect to next step\n if params[:tutorial_name]\n tutorial_redirection(format, @insurance_card.as_json)\n else\n format.html { redirect_to @path, flash: { success: 'Insurance successfully created.' } }\n format.json { render :show, status: :created, location: @insurance_card }\n end\n else\n # If comes from Tutorials workflow, redirect to same Tutorial step\n tutorial_error_handle(\"Fill in Insurance Provider Name field to continue\") && return\n error_path(:new)\n format.html { render controller: @path[:controller], action: @path[:action], layout: @path[:layout] }\n format.json { render json: @insurance_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n payment = PagSeguro::Payment.new(notification_url: 'https://safe-dusk-38202.herokuapp.com/notification', payment_method: 'creditCard', reference: '1')\n\n\n ## Adicionando endereço do comprador\n address = PagSeguro::Address.new(postal_code: params[:zipcode], street: params[:street], number: params[:number], complement: '', district: params[:district], city: params[:city], state: params[:state])\n \n shipping = PagSeguro::Shipping.new\n shipping.address = address\n payment.shipping = shipping\n \n\n items = [PagSeguro::Item.new(id: @product.id, description: @product.description, amount: @product.price, quantity: 1)]\n payment.items = items\n\n # Criando uma referencia para a nossa ORDER\n \n payment.reference = @reference\n\n\n phone = PagSeguro::Phone.new(params[:phone_code], params[:phone_number])\n document = PagSeguro::Document.new(params[:cpf])\n sender = PagSeguro::Sender.new(email: params[:email], name: params[:name], hash_id: params[:sender_hash] )\n sender.phone = phone\n sender.document = document\n payment.sender = sender\n\n # payment.credit_card_token = params[:card_token]\n credit_card = PagSeguro::CreditCard.new(params[:card_token])\n credit_card.holder = PagSeguro::Holder.new(params[:card_name], params[:birthday].to_datetime())\n document = PagSeguro::Document.new(params[:cpf])\n credit_card.holder.document = document\n phone = PagSeguro::Phone.new(params[:phone_code], params[:phone_number])\n credit_card.holder.phone = phone\n \n credit_card.billing_address = address\n\n payment.credit_card = credit_card\n\n\n credit_card.installment = PagSeguro::Installment.new(1, @product.price)\n\n # payment.create\n transaction = payment.transaction\n\n\n\n # Cria uma Order para registro das transações\n \n create_order\n \n \n \n\n if payment.errors.any?\n puts \"=> ERRORS\"\n puts payment.errors.join(\"\\n\")\n render plain: \"Erro No Pagamento #{payment.errors.join(\"\\n\")}\"\n else\n\n redirect_to order_index_path\n\n end\n\n end", "def create\n authorize! :pay_with_sofort, @order\n @order.assign_attributes(confirmation_params)\n unless @order.valid?\n @order = @order.decorate\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/confirm'\n end\n # TODO: check if chosen paymentmethod is sofort. sofort payment must be available for this event\n transaction = ::Sofort::StartTransaction.new(@order)\n transaction.run do |sofort_checkout|\n return redirect_to sofort_checkout\n end\n # TODO: Handle case of Transaction not working\n # render 'something'\n end", "def valitation\n # Create a payment and send ID\n end", "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n # check_entry = CheckEntry.find_by_check_code(@payment.payment_check_code)\n # @payment.update_attributes(:check_entry_id => check_entry.id) if check_entry\n\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n p @payment.errors.to_yaml\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def purchase\n @payment_method = Samurai::PaymentMethod.create params[:payment_method]\n if @payment_method.nil?\n redirect_to server_to_server_payment_form_path and return\n end\n\n @transaction = Samurai::Processor.the_processor.purchase(\n @payment_method.token,\n 122.00, # The price for the Server-to-Server Battle Axe + Shipping\n {\n :descriptor => 'Server-to-Server Battle Axe',\n :customer_reference => Time.now.to_f,\n :billing_reference => Time.now.to_f\n }\n )\n\n unless @transaction.success\n redirect_to server_to_server_payment_form_path(:payment_method_token => @payment_method.token, :reference_id => @transaction.reference_id) and return\n end\n\n redirect_to server_to_server_receipt_path\n end", "def create\n @payment_method = PaymentMethod.new(payment_method_params)\n\n respond_to do |format|\n if @payment_method.save\n flash[:success] = 'Payment method was successfully created.'\n format.html { redirect_to admin_payment_method_url(@payment_method) }\n format.json { render :show, status: :created, location: @payment_method }\n else\n format.html { render :new }\n format.json { render json: @payment_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payement = Payement.new(payement_params)\n @payement.user_id = current_user.id\n\n if @payement.save\n redirect_to @payement.paypal_url(payement_url(@payement))\n else\n render :new \n end\n end", "def alipay_checkout_payment\n payment_method = PaymentMethod.find(params[:payment_method_id])\n #Rails.logger.debug \"@payment_method=#{@payment_method.inspect}\" \n Rails.logger.debug \"[DEBUG] alipay_full_service_url:\"+aplipay_full_service_url(@order, payment_method)\n # notice that load_order would call before_payment, if 'http==put' and 'order.state == payment', the payments will be deleted. \n # so we have to create payment again\n @order.payments.create(:amount => @order.total, :payment_method_id => payment_method.id)\n @order.payments.first.started_processing!\n\n #redirect_to_alipay_gateway(:subject => \"donatecn\", :body => \"donatecn\", :amount => @donate.amount, :out_trade_no => \"123\", :notify_url => pay_fu.alipay_transactions_notify_url)\n end", "def create_first_payment\n make_payment\n end", "def pay_now\n order = current_order || raise(ActiveRecord::RecordNotFound)\n session[:order_number] = current_order.number\n invoice = order.place_bitpay_order(notificationURL: api_bitpay_notification_url , redirectURL: DOMAIN+\"/confirm_order/reviewOrder\")\n @invoice_iframe_url = \"#{invoice['url']}\"\n render json: @invoice_iframe_url.to_json\n end", "def pay_slip\n \n end", "def create\n @payment = @application.authorize_payment payment_params, request.remote_ip\n if @payment.authorized?\n redirect_to payment_path(@payment), notice: 'Payment was successfully authorized.'\n else\n render :new\n end\n end", "def create\n @payment = Payment.new(payment_params)\n @order = Order.find(params[:order_id])\n @payment.order_id = @order.id\n @payment.total = @order.total\n @payment.state = \"Completed\"\n @payment.token = \"tkn\" #ONLY DURING TESTS\n @payment.payment_method_id = params[:payment][:payment_method_id]\n @order.state = \"Completed\"\n @order.save\n respond_to do |format|\n if @payment.save\n format.html { redirect_to root_path, notice: \"Payment was successfully created.\" }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(payment_params)\n @payment.client = @client\n respond_to do |format|\n if @payment.save\n format.html { redirect_to client_path(@client) , notice: 'Pagamento criado com sucesso.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n end\n end\n end", "def new\n # Launch mangopayhooks creation if no hooks created yet\n MangopayHookJob.perform_now\n\n # On passe @order en argument de la méthode authorize car on n'a pas de modèle payment.\n # la méthode authorize s'exécute dans le fichier (payment_policy.rb)\n authorize @order\n # On créée un card web payin\n\n begin\n log_error = nil\n\n mangopay_card_web_pay_in = MangoPay::PayIn::Card::Web.create(\n \"Tag\": @order.mangopay_order_tag,\n \"AuthorId\": current_user.account.mangopay_id,\n \"CreditedUserId\": current_user.account.mangopay_id,\n \"DebitedFunds\": { \"Currency\": \"EUR\", \"Amount\": @order.amount_cents },\n \"Fees\": { \"Currency\": \"EUR\", \"Amount\": 0 },\n \"ReturnUrl\": default_url_options_for_mangopay[:host] + \"/courses/\" +\n @order.slot.course.id.to_s,\n \"CreditedWalletId\": current_user.account.wallet.mangopay_id,\n \"CardType\": \"CB_VISA_MASTERCARD\",\n \"SecureMode\": \"DEFAULT\",\n \"Culture\": \"FR\",\n \"StatementDescription\": \"ASANASANO\"\n )\n\n # j'enregistre le json de réponse dans mon order\n @order.update(payment: mangopay_card_web_pay_in)\n @order.state = \"pending\"\n @order.mangopay_id = mangopay_card_web_pay_in[\"Id\"]\n @order.save!\n rescue MangoPay::ResponseError => ex\n log_error = ex.message\n rescue => ex\n log_error = ex.message\n ensure\n MangopayLog.create(event: \"card_web_pay_in_creation\",\n mangopay_answer: mangopay_card_web_pay_in,\n user_id: current_user.id.to_i,\n error_logs: log_error)\n end\n\n redirect_to mangopay_card_web_pay_in[\"RedirectURL\"] # ouvre la page pour saisie CB\n sleep(5.0)\n flash[:notice] = \"Bien reçu. Votre commande est en cours de traitement!.\"\n end", "def create\n @payment = Payment.new(payment_params)\n\n respond_to do |format|\n if @payment.save\n format.html { \n flash[:success] = t(:item_created, name: t('activerecord.models.payment'))\n redirect_to edit_payment_path(@payment) \n }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n payment.attributes = payment_params\n\n respond_to do |format|\n if payment.save\n format.html { redirect_to admin_payments_path, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: payment }\n else\n format.html { render :new }\n format.json { render json: payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payment_method = PaymentMethod.find(params[:id])\n\n respond_to do |format|\n if @payment_method.update_attributes(params.require(:payment_method).permit(:account_number_id, :customer_id, :expiration_month,\n :expiration_year, :image_id, :payment_type_id, :priority, \n :routing_number))\n format.html { redirect_to payment_methods_url,\n notice: 'PaymentMethod was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @payment_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def upgrade\n if current_user.latest_payment_method.paypal?\n redirect_url = current_user.upgrade_checkout_url\n render_json(redirect_url)\n else\n response = current_user.upgrade_payment_through_card\n if response[:success]\n render_json_for_card_success(response)\n else\n render_json_for_card_fail(response)\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @next_route, notice: \"Le payment a bien été mis à jour.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n format.html { render :edit }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def pay\n #definitin de l'url de base\n base_payment_url = 'http://197.159.2.146:7086/sprintpayapi/payment/orangemoney/request'\n #definition des headers\n\n headers: {\n 'Postman-Token': '9669f6e7-402b-4dc9-a370-472194583c32',\n 'cache-control': 'no-cache',\n 'Authorization': 'SP:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',\n 'DateTime': 'YYYYYYYYYYYYYYYYYYYY',\n 'Content-Type': 'application/json'\n }\n\n #defintion du bodies/main content\n setBody: {\n \"amount\": 1,\n \"currency\": \"EUR\",\n \"firstName\": \"AMADOU\",\n \"lastName\": \"BAKARI\",\n \"address1\": \"Yaounde\",\n \"address2\": \"Nkolfoulou\",\n \"city\": \"Yaounde\",\n \"state\": \"Centre\",\n \"country\": \"FR\",\n \"postal\": \"0332\",\n \"mobileNumber\": \"237690000999\",\n \"emailId\": \"amadoubakari@gmail.com\",\n \"spMerchandUrl\": \"http://sprint-pay.com/\"\n }\n\n #envoi du paiement\n response = httparty.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n\n self.class.post(\n base_payment_url,\n body: setBody,\n headers: headers\n )\n #puts response\n\n end", "def payment\n {\n :credit_card => credit_card\n }\n end", "def create\n @api_payment = Api::Payment.new(api_payment_params)\n\n respond_to do |format|\n if @api_payment.save\n format.html { redirect_to @api_payment, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @api_payment }\n else\n format.html { render :new }\n format.json { render json: @api_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def payment_method_continue\n # Store payment method in session\n session[:payment_type] = params[:payment_type].to_sym if params[:payment_type]\n\n if session[:payment_type] == :paypal\n payment = @application.unpaid_payment\n redirect_to payment.generate_paypal_url(request.remote_ip, new_payment_url, payment_method_url)\n elsif session[:payment_type] == :credit_card\n redirect_to new_payment_path\n else\n flash[:notice] = 'You must choose a payment method.'\n @payment = @application.unpaid_payment\n render :payment_method\n end\n end", "def payment_upgrade (params)\n\t\t\tdecodec = decode_Merchant_Parameters || Array.new\n payment = @order.payments.create!({:amount => @order.total,\n :payment_method => payment_method,\n :response_code => decodec.include?('Ds_Response')? decodec['Ds_Response'].to_s : nil,\n :avs_response => decodec.include?('Ds_AuthorisationCode')? decodec['Ds_AuthorisationCode'].to_s : nil})\n payment.started_processing!\n #@order.update(:considered_risky => 0) if no_risky\n end", "def create\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: \"Le payment a bien été crée.\" }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n super\n @compensation_payment = CompensationPayment.new(compensation_payment_params)\n respond_to do |format|\n if @compensation_payment.save\n format.html { redirect_to @compensation_payment, notice: 'Compensation payment was successfully created.' }\n format.json { render :show, status: :created, location: @compensation_payment }\n else\n format.html { render :new }\n format.json { render json: @compensation_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if @payment.save\n @account = Account.find_by(id: params[:payment][:account_id]) if params[:payment][:account_id].present?\n @payment.update(current_balance: @account.remaining_balance - @payment.amount)\n Order.create(user_id: current_user.id, company_id: current_user.company.id, name: @payment.account.party_name, status: params[:payment][:status], total_amount: @payment.amount)\n @account.update(total_credit: @account.total_credit + @payment.amount, remaining_balance: @account.remaining_balance - @payment.amount) if params[:payment][:account_id].present?\n format.html { redirect_to account_path(id: @account.id), notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.warn \"payment:\"\n Rails.logger.warn @payment.inspect\n respond_to do |format|\n if @payment.save\n format.html { redirect_to payments_url, :notice => 'Payment was successfully created.' }\n format.json { render :json => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(params.require(:payment).permit(:amount, :comment, :contract_id, :customer_id,\n :date_time, :finance_agreement_id, :invoice_id,\n :merchant_services_status, :payment_method_id, :status))\n ok = validatePayment?(@payment)\n\n respond_to do |format|\n if ok and @payment.save\n format.html { redirect_to payments_url,\n notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created,\n location: @payment }\n else\n prepFormVariables(@payment)\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, \n status: :unprocessable_entity }\n end\n end\n end", "def do_post_pre_auth_http(txn,merchant_id, merchant_key)\n # after a pre_auth you have to post the payment.\n sage_host = \"www.sagepayments.net\"\n sage_webservice_access_point = \"/cgi-bin/eftBankcard.dll?retail_transaction\"\n\n payload = {\n\n :M_id => merchant_id,\n :M_key => merchant_key,\n :T_amt => txn[:amount].to_i / 100.0 + txn[:tax].to_i / 100.0,\n :T_tax => txn[:tax].to_i / 100.0,\n :T_shipping => \"\",\n #:T_auth => txn[:auth_code],\n :T_reference => txn[:reference],\n :T_uti => txn[:ton],\n :T_device_id => @t_device_id,\n :T_application_id => @t_application_id,\n :T_code => '11'\n }\n resp = \"\"\n resp = do_webservice(sage_host, sage_webservice_access_point, payload)\n txn = create_credit_response_hash(resp)\n txn[:state] = case txn[:approval_indicator]\n when 'A' then :approved\n else :declined # TODO: Need some error checking here.\n end\n\n return txn\n end", "def create\n @video_adv = current_user.video_advs.create(video_adv_params)\n @video_adv.transactions.create(user_id: @video_adv.user_id, amount: params[:amount], currency: \"USD\", status: \"pending\")\n # base_url = (Rails.env == \"development\") ? 'http://localhost:3000' : 'http://www.etcty.com'\n\n # @response = EXPRESS_GATEWAY.setup_purchase((params[:amount].to_i*100),\n # return_url: base_url+complete_order_video_adv_path(@video_adv, locale: I18n.locale) ,\n # cancel_return_url: base_url,\n # currency: \"USD\"\n # )\n\n # redirect_to EXPRESS_GATEWAY.redirect_url_for(@response.token)\n\n redirect_to complete_order_video_adv_path(@video_adv, locale: I18n.locale)\n\n end", "def create\n @pay = Pay.new(params[:pay])\n\n respond_to do |format|\n if @pay.save\n format.html { redirect_to @pay, notice: 'Pay was successfully created. Happy!.' }\n format.json { render json: @pay, status: :created, location: @pay }\n #@user.rest = @user.rest - @pay.amount\n else\n format.html { render action: \"new\" }\n format.json { render json: @pay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @view_location = params[:view_location] || nil\n @payment = Payment.new(payment_params)\n @bill = Bill.find(@payment.bill.id)\n @payment.claim_type_id = @bill.claim_type_id\n @payment.patient_id = @bill.patient_id\n @payment.insurance_company_id = @bill.insurance_company_id\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to payments_url, notice: 'Payment was successfully created.' }\n format.json { render :show, status: :created, location: @payment }\n format.js\n else\n format.html { render :new }\n format.json\n format.js\n end\n end\n end", "def payment_made\n invoice = Invoice.find(params[:id])\n invoice.payment_received = true\n invoice.save!\n redirect_to root_path \n end", "def create\n @payment = Payment.new(payment_params)\n $payment = @payment\n respond_to do |format|\n if @payment.save\n format.html { redirect_to root_path, notice: 'Pago realizado con exito.' }\n format.json { render :show, status: :created, location: @payment }\n else\n format.html { render :new }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_from_mobile_form\n user = UserInterface.new user_id: api_payment_params[:user_id]\n AuthorizeNet.create_authortize_net_user user\n\n respond_to do |format|\n format.html { head :no_content }\n end\n end", "def pay\n @bill = Bill.find_by(id: params[:bill_id].to_i, home_id: params[:home_id].to_i)\n @payment = Payment.new(description: @bill.name, amount: @bill.amount,\n recipient_paypal_email: @bill.user.paypal)\n @recipient = @payment.recipient_paypal_email\n @payment.sender_paypal_email = current_user.paypal\n @payment.paid_at = Time.now.strftime(\"%A, %B %e, %Y %l:%M %P %Z\")\n @amount = @payment.amount\n request = HTTParty.post(\"https://svcs.sandbox.paypal.com/AdaptivePayments/Pay\",\n headers: {\"X-PAYPAL-SECURITY-USERID\" => \"maria.cassino-facilitator_api1.gmail.com\",\n \"X-PAYPAL-SECURITY-PASSWORD\" => \"U9FL2MK962DKPXMR\",\n \"X-PAYPAL-SECURITY-SIGNATURE\" => \"AFcWxV21C7fd0v3bYYYRCpSSRl31A2tjSJXfuAz3het2TLAiz2uCt1eN\",\n \"X-PAYPAL-REQUEST-DATA-FORMAT\" => \"JSON\",\n \"X-PAYPAL-RESPONSE-DATA-FORMAT\" => \"JSON\",\n \"X-PAYPAL-APPLICATION-ID\" => \"APP-80W284485P519543T\"\n },\n body: {actionType: \"PAY\",\n currencyCode: \"USD\",\n receiverList: {\n receiver:[\n {amount: @amount,\n email: @recipient}\n ]\n },\n returnUrl: \"http://www.example.com/success.html\",\n cancelUrl: \"http://www.example.com/failure.html\",\n requestEnvelope:{\n errorLanguage: \"en_US\",\n detailLevel: \"ReturnAll\"\n }}.to_json\n )\n @payment.save\n @bill.paid_by = current_user.id\n @bill.paid = true\n @bill.paid_at = Time.now.strftime(\"%A, %B %e, %Y %l:%M %P %Z\")\n @bill.save\n render :payment\n end", "def create\n @rental_payment_method = RentalPaymentMethod.new(rental_payment_method_params)\n @rental = @rental_payment_method.rental\n respond_to do |format|\n begin\n @rental_payment_method.save\n format.js\n rescue Exception => e\n logger.info \"#{e.message}\"\n end\n end\n end", "def create\n @partner_payment = PartnerPayment.new(partner_payment_params)\n session.delete(:return_to)\n session[:return_to] ||= request.referer\n\n respond_to do |format|\n if @partner_payment.save\n format.html { redirect_to session.delete(:return_to), notice: 'Partner payment was successfully Added.' }\n format.json { render :show, status: :created, location: @partner_payment }\n else\n format.html { render :new }\n format.json { render json: @partner_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bitcoin = Bitcoin.new(bitcoin_params)\n @bitcoin.user = current_user\n respond_to do |format|\n if @bitcoin.save\n format.html { redirect_to bitcoin_steps_path, notice: 'Add images and enter payment details' }\n format.json { render :show, status: :created, location: @bitcoin }\n else\n format.html { render :new }\n format.json { render json: @bitcoin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to([:admin,@payment], :notice => 'Payment was successfully created.') }\n format.xml { render :xml => @payment, :status => :created, :location => @payment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n update_params = payment_params.merge(ref_payment_id: ref_payment_id, status: payment_status)\n @payment = Payment.new(update_params)\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n else\n flash.now[:alert] = \"Error transaction declined\"\n format.html { render :new }\n end\n end\n end", "def create\n \n clinic_id = params[:payment].delete(:clinic_id)\n @payment = Payment.new(params[:payment])\n @payment.clinic_id = clinic_id\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:debt] && params[:debt].eql?('1')\n debt=true\n end\n @payment = Payment.new(params[:payment])\n encounter=params[:payment][:encounter_id]\n respond_to do |format|\n if @payment.save\n if session[:parts]\n if Payment.bind_particulars(@payment.id, session[:parts])\n #clear the parts from the variable\n session[:parts]=nil\n if encounter\n load_encounter_actions\n if debt\n format.html { redirect_to(payment_path(@payment), :notice => 'Debt was successfully Posted.') }\n end\n format.html { redirect_to(payment_path(@payment), :notice => 'Payment was successfully Posted.') }\n else\n format.html { redirect_to(@payment, :notice => 'Payment was successfully Posted.') }\n format.xml { render :xml => @payment, :status => :created, :location => @payment }\n end\n else\n render :action => \"new\"\n end\n else\n load_encounter_actions\n format.html { redirect_to(@payment, :notice => 'Payment was successfully Posted.') }\n end\n else\n format.html {\n session[:pay_load]=@payment\n redirect_to :action => \"new\",:payload=>0\n }\n format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n end", "def create\n @user_payment_method = UserPaymentMethod.new(user_payment_method_params)\n if @user_payment_method.save\n render json: @user_payment_method, status: :created, location: @user_payment_method\n else\n render json: @user_payment_method.errors, status: :unprocessable_entity\n end\n end", "def payment\n mp_payment = @order.current_payment\n\n if mp_payment.source.nil? or mp_payment.source.redirect_url.nil?\n response = create_preferences mp_payment\n if response\n point_key = provider.sandbox ? 'sandbox_init_point' : 'init_point'\n redirect_url = response[point_key]\n\n mp_payment.source = MercadoPagoSource.create!\n mp_payment.source.redirect_url = redirect_url\n mp_payment.save!\n else\n render json: {ok: false}\n return\n end\n end\n\n render json: {redirect_url: mp_payment.source.redirect_url, ok: true}\n end", "def create\n params_hash = {\n 'x_login' => @x_login,\n 'x_trans_key' => @x_trans_key,\n 'x_invoice' => invoice,\n 'x_amount' => amount,\n 'x_iduser' => iduser,\n 'x_bank' => bank,\n 'x_country' => country,\n 'x_sub_code' => sub_code,\n 'type' => response_type\n }\n\n message_to_control = \"#{invoice}D#{amount}P#{iduser}A\"\n\n sha256 = OpenSSL::Digest::SHA256.new\n control = OpenSSL::HMAC.hexdigest(sha256, [@secret_key].pack('A*'), [message_to_control].pack('A*'))\n control = control.upcase\n\n params_hash['control'] = control\n params_hash['x_currency'] = currency if currency\n params_hash['x_description'] = description if description\n params_hash['x_cpf'] = cpf if cpf\n params_hash['x_return'] = return_url if return_url\n params_hash['x_confirmation'] = confirmation_url if confirmation_url\n\n astro_curl(@astro_urls['create'], params_hash)\n end", "def charge_onetime(payment_method, payment_amount, payment_currency, merchant_account, attempt_token, return_url, browser_info, origin)\n # These parameters are only required for native 3ds2 transactions.\n # Please add it only when paymentMethod type is scheme ie cards\n\n # 'channel' => 'Web',\n # 'additionalData' => {\n # 'allow3DS2' => true\n # },\n # 'origin' => 'http://localhost:5000',\n # 'browserInfo' => browser_info,\n\n options = {\n 'amount' => { 'currency' => payment_currency, 'value' => payment_amount },\n 'metadata' => { 'attemptToken' => attempt_token },\n 'reference' => attempt_token,\n 'paymentMethod' => payment_method.to_enum.to_h,\n 'merchantAccount' => merchant_account,\n 'returnUrl' => return_url\n }\n\n if payment_method[:type].eql?('scheme')\n options.merge!(\n 'channel' => 'Web',\n 'additionalData' => {\n 'allow3DS2' => true\n },\n 'origin' => origin,\n 'browserInfo' => browser_info\n )\n end\n\n fetch_route = find_route(__method__.to_s)\n requested_path = fetch_route[:path]\n client.post(\n requested_path,\n fetch_route[:api],\n options\n )\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @payment = Payment.new(params[:payment])\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n campaign_id = params[:campaign_id]\n credit_card_id = params[:credit_card_id]\n amount = params[:amount]\n\n #testing\n campaign = Campaign.find_by_id(campaign_id)\n user_id = campaign.user_id\n wepay_payment_type = \"credit_card\"\n if(amount>1)\n if(campaign!=nil)\n #create the payment object\n payment = Payment.new({\n campaign_id: campaign_id,\n payer_id: user_id,\n wepay_payment_id: credit_card_id,\n wepay_payment_type: wepay_payment_type,\n amount: amount\n })\n if !payment.valid?\n render json: error(payment.errors.full_messages)\n end\n if payment.valid? && payment.create_checkout && payment.save\n campaign.update_amount_donated\n render json: {\"checkout_id\" => payment[\"wepay_checkout_id\"]}\n else\n render json: payment_invalid_error\n end\n end\n end\n end", "def set_payment_method\n @payment_method = PaymentMethod.find(params[:id])\n end", "def set_payment_method\n @payment_method = PaymentMethod.find(params[:id])\n end", "def adyen_payment\n load_object\n opts = all_opts(@order,params[:payment_method_id], 'payment')\n opts.merge!(address_options(@order))\n gateway = adyen_gateway\n\n #if Spree::Config[:auto_capture]\n # response = gateway.setup_purchase(opts[:money], opts)\n #else\n # response = gateway.setup_authorization(opts[:money], opts)\n #end\n\n unless response.success?\n gateway_error(response)\n redirect_to edit_order_checkout_url(@order, :step => \"payment\")\n return\n end\n\n redirect_to (gateway.redirect_url_for response.token, :review => payment_method.preferred_review)\n rescue ActiveMerchant::ConnectionError => e\n gateway_error I18n.t(:unable_to_connect_to_gateway)\n redirect_to :back\n end", "def create\n @rent_payment = RentPayment.new(rent_payment_params)\n\n respond_to do |format|\n if @rent_payment.save\n format.html { redirect_to @rent_payment, notice: 'Rent payment was successfully created.' }\n format.json { render :show, status: :created, location: @rent_payment }\n else\n format.html { render :new }\n format.json { render json: @rent_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to @chain, notice: 'Chain AND PAYMENT was successfully updated.' }\n format.json { render :show, status: :ok, location: @chain }\n else\n format.html { render :edit }\n format.json { render json: @chain.errors, status: :unprocessable_entity }\n end\n end\n # @payment.save\n end", "def place_settlement\n @invoice = Invoice.find(params[:invoice_id])\n\n #check settlment parms\n #create a new invoice_items describing the payment via cc or something\n @invoice.charge params[:amount], params[:payment_method], params[:note]\n\n flash[:notice] = \"Settlement Placed\"\n render \"settlement\"\n end", "def make_payment\n payment_id = params[:payment_id]\n user_id = params[:user_id]\n offer_id = params[:offer_id]\n response = Subscription.make_payment(payment_id, user_id, offer_id)\n render json: response\n end", "def payment\n @invoice = BitcoinInvoice.find_by_notification_key(params[:id])\n #if @invoice.status != BitcoinInvoice::NEW\n # redirect_to root_path, :alert => 'Cannot pay more than once!' and return\n #end\n end", "def update\n if @payment.update(payment_params)\n render :show, status: :ok, location: @payment\n else\n render json: @payment.errors, status: :unprocessable_entity\n end\n end", "def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\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" ]
[ "0.67622805", "0.65974426", "0.6524096", "0.64714646", "0.64684016", "0.6382394", "0.62416726", "0.6196449", "0.61962", "0.618633", "0.6182604", "0.61604583", "0.61436427", "0.6111525", "0.6106515", "0.60960484", "0.6043334", "0.6027591", "0.6023871", "0.60003936", "0.59746605", "0.59613955", "0.5955593", "0.5955593", "0.5952325", "0.5946645", "0.59465814", "0.5942456", "0.5934292", "0.59185714", "0.5917593", "0.5917377", "0.59080744", "0.59050155", "0.5902401", "0.589643", "0.5892465", "0.58654344", "0.5861575", "0.5855328", "0.58495855", "0.58475226", "0.5836531", "0.58327717", "0.58320355", "0.58286756", "0.5827081", "0.5821429", "0.5820234", "0.5813192", "0.57776463", "0.5773909", "0.57689583", "0.57675993", "0.5767435", "0.5760463", "0.5756602", "0.5754462", "0.57537395", "0.5750492", "0.57466745", "0.57422817", "0.57416123", "0.5740941", "0.5728267", "0.5724217", "0.57231677", "0.57180953", "0.5716159", "0.57103634", "0.5709377", "0.57080483", "0.5707143", "0.5702716", "0.5691929", "0.5687295", "0.56867456", "0.568396", "0.56737804", "0.5672718", "0.567217", "0.5671698", "0.56700945", "0.56663746", "0.5663075", "0.56612396", "0.5656775", "0.5656775", "0.5654745", "0.56531376", "0.56531376", "0.56494546", "0.56464636", "0.5641802", "0.564147", "0.5640234", "0.56393385", "0.5637575", "0.5636555", "0.56329846" ]
0.6167424
11
Purchase the article, and redirect to it
def purchase load_and_verify_payment_method(params) redirect_to new_article_order_path(@article, payment_method_params) and return unless @payment_method @order = current_user.orders.create :article=>@article @transaction = Samurai::Processor.the_processor.purchase( @payment_method.token, @article.amount, {:descriptor => @article.name, :customer_reference => current_user.id, :billing_reference => @order.id} ) if @transaction.failed? @order.destroy redirect_to new_article_order_path(@article, payment_method_params) and return end redirect_to article_path(@article), :notice=>'Thanks for purchase this article!' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purchase\r\n redirect_to \"http://www.1shoppingcart.com/app/javanof.asp?MerchantID=31593&ProductID=3257357\"\r\n end", "def link_form\n @purchase = Purchase.find_by_id params[:id]\n if !@purchase\n redirect_to '/admin/purchases'\n return\n end\n end", "def publish\n\t\t@article.publish!\n\t\tredirect_to @article\n\tend", "def order\n @purchase.order!\n redirect_to purchase_path(@purchase), :notice => t(:ordered)\n end", "def purchased # Thank You!\n @order = if params[:id].present?\n Effective::Order.find(params[:id])\n elsif current_user.present?\n Effective::Order.purchased_by(current_user).first\n end\n\n if @order.blank?\n redirect_to(effective_orders.my_purchases_orders_path) and return\n end\n\n EffectiveOrders.authorized?(self, :show, @order)\n\n redirect_to(effective_orders.order_path(@order)) unless @order.purchased?\n end", "def visit\n redirect_to @product.affiliate_link\n end", "def checkout\n response = @payment.setup_purchase(:ip => request.remote_ip,\n :description => \"Donation\",\n :return_url => confirm_paypal_url(@payment),\n :cancel_return_url => paymentform_url,\n :no_shipping => 1,\n :items => [{ :name => \"Donation to #{@cause.name}\",\n :number => 1,\n :quantity => 1,\n :amount => @payment.amount * 100 }])\n redirect_to @payment.redirect_url_for(response.token)\n end", "def purchase\n if user_signed_in?\n \n card = current_user.card\n #テーブルからpayjpの顧客IDを検索\n @user = User.find(@item.seller_id)\n unless @item.seller_id == @item.buyer_id\n redirect_to root_path\n else\n end\n \n if card.blank?\n #登録された情報がない場合にカード登録画面に移動\n redirect_to controller: \"card\", action: \"new\"\n else\n Payjp.api_key = ENV[\"PAYJP_PRIVATE_KEY\"]\n #保管した顧客IDでpayjpから情報取得\n customer = Payjp::Customer.retrieve(card[\"customer_id\"])\n #保管したカードIDでpayjpから情報取得、カード情報表示のためインスタンス変数に代入\n @default_card_information = customer.cards.retrieve(card.card_id)\n @card_brand = @default_card_information.brand\n @card_src = \"Visa.png\"\n end\n\n else\n redirect_to new_user_session_path\n end\n\n end", "def add_purchase(customer_id, product_id)\n item = DirectedEdge::Item.new(@database, \"customer#{customer_id}\")\n item.link_to(\"product#{product_id}\")\n item.save\n end", "def paypal_return\r\n user_id = params[:user_id]\r\n @user = User.find(user_id)\r\n session[:user_id] = @user[:id]\r\n session[:user_email] = @user[:email]\r\n #render :text => params \r\n if Purchase.exists?(params[:id])\r\n redirect_to(:action=>'order_confirmed/'+params[:id].to_s)\r\n else\r\n flash[:notice] = I18n.t 'event.purchase.pur_can'\r\n redirect_to(:controller => 'home', :action=>'index') \r\n end \r\n end", "def add_product\n product = Product.find(params[:product][:id])\n unless @invoice_service.add_product(product)\n redirect_to products_path\n return\n end\n\n redirect_to_origin(params[:origin][:code], product)\n end", "def accept\n license = License.accessible_by(@context).find(unsafe_params[:id])\n if unsafe_params[:redirect_to_uid].present?\n redirect_to_item = item_from_uid(unsafe_params[:redirect_to_uid])\n end\n\n if license.approval_required\n redirect_to request_approval_path(license)\n else\n if AcceptedLicense.find_or_create_by(license_id: license.id, user_id: @context.user_id)\n flash[:success] = \"License accepted\"\n else\n flash[:error] = \"Sorry, this license does not exist or is not accessible by you\"\n end\n if redirect_to_item.nil?\n redirect_to license_path(license)\n else\n redirect_to pathify(redirect_to_item)\n end\n end\n end", "def create_article\n Article.create_random_article\n redirect_to articles_url\n end", "def publish\n if @item.publish\n flash[:notice] = 'Your item is published!'\n else\n flash[:notice] = 'There was an error'\n end\n\n redirect_to @item\n end", "def purchase\n\t\t\n\t\tif self.inventory >= 1\n\t\t\t#reduce inventory by 1 then save to db\n\t\t\tself.inventory = self.inventory - 1\n\t\t\tself.save\n\t\t\t#successful purchase, return true\n\t\t\tself.show\n\t\t\treturn true\n\t\tend\n\t\t\n\t\t#unsuccessful purchase, return false\n\t\treturn false\n\tend", "def send_link\n @purchase = Purchase.find_by_id params[:id]\n if !@purchase\n redirect_to '/admin/purchases'\n return\n end\n @message = params[:message].blank? ? I18n.t('admin.purchases.links.empty_message') : params[:message]\n UserMailer.purchase_resume(params[:emails].split(','), @purchase, @message).deliver\n redirect_to '/admin/purchases'\n end", "def purchase_action\n # from cart\n if params[:product_id] == '0'\n @items = session[:cart]\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n @purchase.save\n @items.each do |item|\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: item['product'], quantity: item['quantity'])\n @purchase_products.save\n stock_minus(item['product'], item['quantity'])\n end\n # via product page\n else\n @purchase = Purchase.new(bill_address_id: params[:bill_address_id], ip: IPAddr.new(request.remote_ip).to_i)\n if @purchase.save\n @purchase_products = PurchaseProduct.new(purchase_id: @purchase.id, product_id: params[:product_id], quantity: session[:quantity])\n @purchase_products.save\n stock_minus(params[:product_id], session[:quantity])\n else\n render 'purchase_show'\n end\n end\n # Send email\n UserMailer.purchase_email(@purchase).deliver\n session[:purchased_item] = params[:product_id]\n redirect_to purchase_success_path\n end", "def create\n @article = Article.create!(article_params)\n \n \n \n #Save the article\n # @article.save\n \n #redirecting the user to the show action\n\n redirect_to @article\n \n \n end", "def success\n order = Spree::Order.find_by!(number: params[:order_id])\n\n redirect_to order_path(order)\n end", "def purchase\n # number of checks to see if coming out of context\n # no order_id\n unless params[:order_id]\n go_home()\n return\n end\n @order = Order.find_by_id(params[:order_id])\n # order doesn't exist\n unless @order\n go_home()\n return\n end\n # order is already authorized or paid\n if @order.state != Order::CREATED\n go_home()\n return\n end\n # order has zero quantity or zero amount\n if @order.quantity == 0 or @order.amount == 0\n go_home()\n return\n end\n # deal doesn't exist\n deal = @order.deal\n unless deal\n go_home()\n return\n end\n \n # check if deal has ended\n if deal.is_ended\n flash[:error] = \"This deal has ended. Checkout out some of our other deals!\"\n go_home()\n return\n end\n \n # check if deal hasn't started\n if !deal.is_started\n go_home()\n return\n end\n \n # check if order is timed out\n if @order.is_timed_out\n flash[:error] = \"Your order has timed out. Please restart your transaction.\"\n redirect_to :controller => self.controller_name, :action => 'order', :deal_id => @order.deal.id\n return\n end\n \n if params[:failure]\n flash.now[:error] = \"There was a problem approving your transaction. Please try again.\"\n end\n \n @sim_transaction = \n AuthorizeNet::SIM::Transaction.new(\n AUTHORIZE_NET_CONFIG['api_login_id'], \n AUTHORIZE_NET_CONFIG['api_transaction_key'], \n @order.amount.to_f,\n :transaction_type => AuthorizeNet::SIM::Transaction::Type::AUTHORIZE_ONLY,\n :relay_url => url_for(:controller => self.controller_name, :action => 'relay_response', :only_path => false))\n @timeout = OPTIONS[:order_timeout]\n @gateway_url = Rails.env.production? ? AuthorizeNet::SIM::Transaction::Gateway::LIVE : AuthorizeNet::SIM::Transaction::Gateway::TEST\n render \"payment/#{self.action_name}\"\n end", "def redirect_from_hop\n if session[:pay_post_made]\n if current_user and current_user.orders.order('created_at DESC').first\n order = current_user.orders.order('created_at DESC').first\n if order.paid?\n flash[:success] = \"You successfully purchased, \" # + fill in what user purchased\n else\n flash[:fail] = \"Uh oh, your purchase was not completed. Your credit card was not charged. Your cart will retain the items you original wanted to purchase.<br><br><b>Please verify that you entered your credit card information correctly and try again.</b> If the Problem persists please contact the administrator.\".html_safe\n end\n end\n session[:pay_post_made] = nil\n end\n #redirect to index of all payments\n redirect_to payments_path\n end", "def create\n @article = Article.new(params[:article])\n \n if @article.save\n redirect_to article_path(@article.id), :notice => \"Saved! Way to go.\"\n \n else\n render \"new\"\n end\n end", "def product_revenue\n p '#{request.referer}'\n redirect_to \"http://www.google.com\" ,status: 301\n end", "def page\n redirect_to :action => 'copyright'\n end", "def create\n @article = current_user.articles.build(article_params)\n\n if @article.save\n redirect_to session[:return_to] ? session.delete(:return_to) : root_path, notice: 'Article was successfully created.'\n else\n render :new\n end\n end", "def activate\n \n @event = Event.find(params[:act][:event_id])\n @event.purchase_type = 'p'\n @event.save\n\n current_user.decrement(:purchased_events)\n current_user.save\n\n redirect_to @event, notice: \"Thank you for activating the Event Page for #{@event.title}. You will now have permanent access to this page.\"\n\nend", "def redirect_to_subscription_path\n redirect_to action: :show, id: @subscription\n end", "def agreement\n redirect_to license_path unless session[:agreement]\n session[:agreement]=true\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 #UserMailer.ordered(\"google.com\", response.params.to_s, User.find(cart.user_id), cart).deliver\n cart.update_attribute(:purchased_at, Time.now) if response.success?\n response.success?\n end", "def return\n notify = ActiveMerchant::Billing::Integrations::Paypal::Notification.new(request.raw_post)\n @order = ::Order.find_by_number(notify.item_id)\n if notify.acknowledge\n begin\n redirect_to thank_you_order_url(@order)\n rescue => e\n redirect_to '/'\n end\n end\n end", "def place_order\n \n @job = Job.find(params[:job_id])\n fetch_decrypted(@job)\n \n if @logged_user.credits > 0\n render(:action => \"confirm_order\")\n return\n else\n #place order will have our paypal buttons\n render(:action => \"place_order\")\n return\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:alert] = \"Buying credits for fun?\"\n redirect_to :action => \"profile\"\n end", "def redirect\n @order.assign_attributes(order_params)\n if @order.valid?\n Gocardless::RedirectFlowService::Initialize.run(@order) do |redirect_url|\n return redirect_to redirect_url\n end\n else\n @address = @order.address\n @product = @order.product.decorate\n @order = @order.decorate\n render 'signup/orders/confirm'\n end\n end", "def create\n @purchasing_ad = PurchasingAd.new(params[:purchasing_ad])\n\n if @purchasing_ad.save\n redirect_to @purchasing_ad\n else\n render :new\n end\n\n end", "def create\n @article = Article.create(params[:article])\n redirect_to @article\n end", "def buyticket\n @ticket = Ticket.new(ticket_params)\n @event = Event.find(@ticket.event_id)\n if @ticket.valid?\n @ticket.save\n # this will have to change to credit card functionality later\n redirect_to events_url, notice: 'You successfully purchased your ticket to this event.'\n # redirect to my groups url (when logged in!)\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end", "def buy\n shipment = Shipment.find(params[:shipment_id])\n shipment.update_column(:affiliate_shipping_account, params[:affiliate_shipping_account] == \"true\")\n EasyPost.api_key = shipment.easy_post_api_key\n\n begin\n ep_shipment = EasyPost::Shipment.retrieve(params[:ep_shipment_id])\n easypost_purchase(shipment, params[:rate_id], ep_shipment)\n ShipmentItem.where(shipment_id: shipment.id, special_status: \"\").update_all(special_status: :shipped)\n rescue => e\n flash[:error] = e.message + params[:ep_shipment_id]\n return redirect_back(fallback_location: admin_root_path)\n end\n\n redirect_to admin_store_shipment_path(shipment)\n end", "def buy_product\n products = @seller.show_product_info \n product_buy = @view.buy_product(products)\n @total_price = @seller.save_buy_a_product(product_buy)\n @view.buy_status(@total_price)\n input = @view.menu(\"2\")\n seller_actions(input) \n end", "def create\n @article = Article.new(article_params)\n if @article.save\n redirect_to @article\n else\n render \"new\"\n end\n end", "def express\n response = ZephoPaypalExpress.setup_purchase(current_cart.build_order.price_in_cents,\n ip: request.remote_ip,\n return_url: new_order_url,\n cancel_return_url: products_url)\n \n redirect_to ZephoPaypalExpress.redirect_url_for(response.token)\n end", "def create\n @article = Article.new(params[:article])\n if @article.save\n redirect_to articles_list_path, :notice => 'A cikk sikeresen létrejött!'\n else\n render :action => \"new\"\n end\n end", "def create\n purchase = @order.purchases.first(:conditions => {\n :purchasable_id => params[:purchase][:purchasable_id],\n :purchasable_type => params[:purchase][:purchasable_type]\n })\n\n if purchase\n purchase.quantity += params[:purchase][:quantity].to_i\n purchase.save\n else\n @order.purchases << Purchase.new(params[:purchase])\n @order.save\n end\n\n if params[:redirect_to]\n flash[:success] = %{#{params[:purchase][:name]} has been added to your order. <a href=\"/order/purchases\">Proceed to checkout</a>.} unless params[:hide_flash]\n redirect_to params[:redirect_to]\n else\n redirect_to order_purchases_path\n end\n end", "def article(name)\n redirect R(PostController, name), :status => 301\n end", "def create\n @article = Article.new(article_params)\n\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end", "def create\n @article = Article.new(article_params)\n\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end", "def create\n @article = Article.new(article_params)\n\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end", "def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n flash[:notice] = 'Article was successfully created.'\n \n format.html { redirect_to article_url(@article) }\n format.xml do\n headers[\"Location\"] = article_url(@article)\n render :nothing => true, :status => \"201 Created\"\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors.to_xml }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n if @article.save\n translate_art\n redirect_to @article\n else\n render 'new'\n end\n end", "def on_subscription_success\n redirect_to(action: :index) \n end", "def inventory_transfer2\n flash[:success] = \"Successfully Transfered\"\n redirect_to inventories_path\n end", "def create\n @article = Article.new(article_params)\n\n if @article.save\n redirect_to @article\n else\n render :new\n end\n end", "def create\n @purchase = Purchase.new(params[:purchase])\n respond_to do |format|\n if @purchase.save\n flash[:notice] = 'Purchase was successfully created.'\n format.html { redirect_to(@purchase) }\n format.xml { render :xml => @purchase, :status => :created, :purchase => @purchase }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purchase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = Item.new(params[:item])\n @item.is_published = params[:should_publish] == \"publicar\" ? true : false\n @item.sale = @sale\n if @item.save\n flash[:notice] = \"El artículo ha sido guardado con éxito\"\n redirect_to :action => :index, :user_id => @user.id, :sale_id => @sale.id\n else\n flash[:error] = \"El artículo no ha podido ser guardado, repasa la informaci&oacute;n que falta\"\n render :new\n end\n end", "def purchase\n begin\n ActiveRecord::Base.transaction do\n @user.coin_credit -= @product.price\n requested_detail = @product.details.available.first\n requested_detail.available = false # makes the detail unavailable\n requested_detail.save!\n @user.save!\n @user.purchased_details << requested_detail # adds the detail to purchased_details of the user\n @purchased_detail = requested_detail\n end\n true\n rescue => e\n Rails.logger.error e\n @user.reload\n @user.errors.add(:base, :purchase_problem)\n false\n end\n end", "def create\n #This code just renders the article info onto the page as an example\n # render plain: params[:article]\n\n #Need to include so it will be whitelisted\n @article = Article.new(article_params)\n @article.user = current_user\n #Then you save the article\n if @article.save\n\n #This is your flash notice for successful article creation(using the ruby flash helper)\n flash[:notice] = \"Article was created successfully!\"\n\n #Then you redirect the user to the show page which is the article path(referenced in rails routes in console)\n #And the article variable is referencing to the newly created article's id or show page(/articles/id)\n #you can also use (redirect_to @article) for a shorted line of code\n redirect_to article_path(@article)\n else\n render 'new'\n end\n end", "def create\n Article.transaction do\n @article = Article.new(params[:article])\n respond_to do |format|\n if @article.save\n @article.deliver_to_listhost unless @article.no_mail == \"1\"\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to admin_articles_path }\n format.xml { render :xml => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @article.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def payment_return\n url = root_url\n if (params[:status] == \"1\")\n @publication = Publication.find(params[:id])\n url = publication_url(@publication)\n flash[:notice] = \"La publicacion ha sido creada correctamente.\"\n elsif (params[:status] == \"2\")\n url = publications_url\n flash[:notice] = \"El pago de la publiacción esta pendiente. Al completarse exitosamente el mismo, la publicación quedará creada correctamente.\"\n elsif (params[:status] == \"3\")\n url = publications_url\n flash[:error] = \"El pago de la publiacción no pudo completarse correctamente.\"\n elsif (params[:status] == \"4\")\n @publication = Publication.find(params[:id])\n url = publication_url(@publication)\n flash[:notice] = \"La publicación fue actualizada exitosamente.\"\n end\n redirect_to url\n end", "def redirect_to_finish_wizard(options = nil)\n redirect_to \"/adventures/#{@adventure.slug}\", notice: \"PENDING APPROVAL: <a href='/adventures/new'> Click to add another adventure </a> \"\n end", "def purchase_one\n product = Product.find(params[:id])\n company = Company.first\n if product[:inventory_count] > 0\n if product.decrement!(:inventory_count)\n total = company[:money] + product[:price]\n\n company.update_!(money: total)\n render json: {\n status: :ok,\n message: 'Successfully bought'\n }.to_json\n else\n render json: {\n status: :internal_server_error,\n message: 'Error purchasing product'\n }\n end\n else\n render json: {\n status: :ok,\n message: 'Item is no longer available'\n } \n end\n end", "def join_purchase\n @purchase_response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options)\n @purchase_response.success?\n end", "def complete\n handle_callback_params!\n redirect_to redirect_path(@payment.try(:order))\n end", "def create\n @article = Article.new(article_params)\n if @article.save\n redirect_to articles_path\n else\n render 'new'\n end\n end", "def redirect\n @item = Item.find_by_id(Base58.decode(params[:id]))\n redirect_to @item[:location]\n end", "def create\n @article = Article.new(article_params)\n \n\n # Notice that inside the create action we use render instead of redirect_to when save returns false. \n # The render method is used so that the @article object is passed back to the new template when it is rendered. \n # This rendering is done within the same request as the form submission, whereas the redirect_to will tell \n # the browser to issue another request.\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end", "def terms_of_service\n redirect_to document_path('terms-of-service'), :status => :moved_permanently\n end", "def buy_document\n #confirm paiement\n\n #recherche de l'enregistrement dans la BD\n pay = Convocation.find(params[:id])\n\n #debut de la mise a jour\n pay.status = \"paye\"\n #s = pay.save\n #verification\n if pay.save\n puts \"====== c'est bon, on a update ========\"\n flash[:notice] = \"A Paiement effectué\"\n redirect_to action: \"/access/a/l/administration\"\n else\n puts \"========= error =========\"\n #redirect_to action: 'administration', notice: \"Impossible d effectuer le paiement : #{s.errors.messages}\"\n end\n #render layout: 'administration'\n render layout: 'views/index'\n end", "def redirect_handler\n id = params['id']\n result = ChargeBee::HostedPage.retrieve(id)\n if result.hosted_page.state == \"succeeded\"\n redirect_to \"/ssp/subscription\"\n else \n redirect_to \"/400\"\n end\n end", "def create\n @purchase_preference = PurchasePreference.new(params[:purchase_preference])\n\n if @purchase_preference.save\n redirect_to(new_card_path) if true # buying\n else\n render action: \"new\"\n end\n\n respond_to do |format|\n if @purchase_preference.save\n format.html { redirect_to @purchase_preference, notice: 'Purchase preference was successfully created.' }\n format.json { render json: @purchase_preference, status: :created, location: @purchase_preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n authorize_action_for(@article)\n @article.destroy\n redirect_to session.delete(:return_to), notice: 'Article was successfully destroyed.'\n end", "def return\n flash[:success] = \"Thanks for supporting us! We will activate your plan upon payment confirmation! The time this takes depends on PayPal.\"\n redirect_to root_path\n end", "def create\n @purchase_item = PurchaseItem.find(params[:id])\n \n\n respond_to do |format|\n if @purchase_item.save\n format.html { redirect_to purchase_path(@purchase), notice: 'Purchase item was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params) # Takes the input from the form and\n\n if @article.save # if the article can be save\n redirect_to @article # Redicted to the article that was created\n else\n render 'new' # Otherwise redirect to the new post page, this handles a failure\n end\n end", "def create\n @article = Article.new(article_params)\n\n if @article.save\n redirect_to @article\n # As @article is a Hash, the redirection will be done to the _url (similar to using 'link_to' helper).\n # It is important to use redirect_to after mutating the database or application state. Otherwise,\n # if the user refreshes the page, the browser will make the same request, and the mutation will be repeated.\n else\n render :new # Renders the 'new' view\n end\n end", "def create\n @article = Article.new article_from_parameters\n if @article.save\n redirect_to @article\n else\n render 'new'\n end\n end", "def create\n @article= Article.new(article_params)\n if @article.save\n redirect_to @articles\n else\n render :new\n end\n end", "def redirect\n if @short.nil?\n redirect_to \"/\"\n else\n # raise\n @plain_url = Short.decrypt(@short)\n redirect_to @plain_url\n end\n end", "def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n flash[:notice] = 'Purchase was successfully created.'\n format.html { redirect_to(@purchase) }\n format.xml { render :xml => @purchase, :status => :created, :location => @purchase }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purchase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n unless @sale.concretada?\n redirect_to sales_path, alert: 'La Venta no ha sido concretada, esta accion no puede realizarse.' \n end\n end", "def purchase\n @payment_method = Samurai::PaymentMethod.create params[:payment_method]\n if @payment_method.nil?\n redirect_to server_to_server_payment_form_path and return\n end\n\n @transaction = Samurai::Processor.the_processor.purchase(\n @payment_method.token,\n 122.00, # The price for the Server-to-Server Battle Axe + Shipping\n {\n :descriptor => 'Server-to-Server Battle Axe',\n :customer_reference => Time.now.to_f,\n :billing_reference => Time.now.to_f\n }\n )\n\n unless @transaction.success\n redirect_to server_to_server_payment_form_path(:payment_method_token => @payment_method.token, :reference_id => @transaction.reference_id) and return\n end\n\n redirect_to server_to_server_receipt_path\n end", "def confirm_purchase(purchase)\r\n purchase.confirm\r\n end", "def show\n # Prevents unauthorized access by other users\n # if !current_user.purchases.where(:id => @purchase.id).any?\n # flash[:notice] = \"You don't have permission to view that page!\"\n # redirect_to current_user\n # return\n # end\n\n end", "def successful_purchase_response\n end", "def show\n redirect_to cart_items_url\n end", "def success\n authorize! :view_sofort_thankyou_page, @order\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/show' if @order.confirmed?\n transaction = ::Sofort::FinishTransaction.new(@order)\n transaction.run do\n @order.status = :paid\n @order.confirm\n return render 'signup/orders/show'\n end\n # customer opens success-page, but transaction is not complete\n flash.now[:notice] = t(:transaction_no_confirmation)\n render 'signup/orders/show'\n end", "def create\n @license = License.new(license_params)\n\n respond_to do |format|\n if @license.save\n format.html { redirect_to :controller => 'charges', :action => 'new', :license_id => @license.id}\n\n format.json { render :show, status: :created, location: @license }\n save_pdf\n else\n format.html { render :new }\n format.json { render json: @license.errors, status: :unprocessable_entity }\n end\n end\n end", "def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params.dig(:description)\n )\n end", "def after_create(article)\n expire_public_page\n end", "def create\n\t\t#render plain: params[:article].inspect\n\t\t@article = Article.new(article_params)\n\t\tif @article.save\n\t\t\tredirect_to @article # show method\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n # Create a new article in memory (RAM)\n @article = Article.new(article_params)\n # Saves it to the database making it permanent until deleted\n if @article.save\n # Redirects the article to \"show\" action for the @article\n redirect_to @article\n else\n render 'new'\n end\n end", "def buy\n @character = Character.find(params[:id])\n errors = findErrors(item_params)\n if errors.length < 1 && canAfford?(item_params[:cost].to_f, @character)\n @character.gp -= item_params[:cost].to_f\n @item = Item.new\n @item.cost = item_params[:cost]\n @item.name = item_params[:name]\n @item.save\n association = CharacterItem.new\n association.character_id = @character.id\n association.item_id = @item.id\n association.save\n @character.save\n redirect_to @character, notice: 'Item Was Purchased succesfully'\n else\n errors.length > 0 ? flash[:errors] = errors[0] : flash[:errors] = \"Whoops! this item costs #{item_params[:cost]} GP\n But you have #{@character.gp}\"\n @item = Item.new(item_params)\n render 'purchase_item/new'\n end\n end", "def create\n @product = Product.create( product_params )\n redirect_to '/products'\nend", "def create\n @product = Product.create( product_params )\n redirect_to '/products'\nend", "def create\n @page_title = \"Sell your product\"\n @product = Product.new(params[:product])\n @product.user = current_user\n\n if @product.valid?\n @product.force_save\n return product_success\n else\n flash[:error_stay] = @product.errors.full_messages\n @product.force_save\n redirect_to edit_product_path(@product)\n end\n end", "def destroy\n # Prevents unauthorized access by other users\n if current_user.id != @purchase.user_id\n flash[:notice] = \"You don't have permission to view that page!\"\n redirect_to current_user\n return\n end\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase.destroy\n\n head :no_content\n end", "def purchase\n response = process_purchase\n transactions.create!(:action => \"purchase\", :amount => package.reserved_upgrade_price, :response => response)\n if response.success?\n package.paid!\n UserMailer.package_summary(package).deliver\n end\n\n # First part is success (true/false), second error message\n [response.success?, response.params[\"message\"] ]\n end", "def confirm_delivery\n package = Packages.find_by_id(params[:pid])\n package.update(:finalDelivery => 1) \n redirect_to :controller => 'packages', :action => 'rating', :pid => params[:pid]\n end", "def check_product\n if @product.nil?\n redirect_to products_path, notice: \"Product not found!😢\"\n return\n end\n end", "def create\n @purchase = Purchase.new(purchase_params)\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n redirect_to \"/order_items\"\n end", "def submit_purchased!\n return false if was_submitted?\n\n wizard_steps[:checkout] = Time.zone.now\n submit!\n end" ]
[ "0.7462033", "0.6610919", "0.6511793", "0.6447817", "0.6308654", "0.6249633", "0.6147074", "0.6108893", "0.6039982", "0.59578794", "0.5948272", "0.59429306", "0.5930706", "0.5916562", "0.5914955", "0.59072477", "0.5904656", "0.5895368", "0.5848823", "0.5847925", "0.584238", "0.5838103", "0.58255047", "0.58196944", "0.58075666", "0.5789749", "0.57891923", "0.57781535", "0.57747746", "0.577153", "0.5737949", "0.57323873", "0.5730712", "0.571476", "0.5706386", "0.57035315", "0.5695387", "0.5692984", "0.56886566", "0.568376", "0.5675595", "0.5672706", "0.5669774", "0.56596327", "0.56596327", "0.5656836", "0.5647272", "0.5637397", "0.561859", "0.5610564", "0.56035703", "0.55981696", "0.55848134", "0.55836827", "0.5578792", "0.5577455", "0.5577358", "0.55765057", "0.55747837", "0.5571569", "0.5570466", "0.5569013", "0.5568479", "0.5567986", "0.55574584", "0.55560124", "0.5555903", "0.55553454", "0.55529433", "0.5542542", "0.55370975", "0.5529448", "0.5527853", "0.5518476", "0.5514446", "0.551418", "0.55108756", "0.55089116", "0.5502148", "0.5495537", "0.54895955", "0.5476996", "0.5468016", "0.5464866", "0.5458794", "0.5456763", "0.5454768", "0.54494345", "0.54486394", "0.54448235", "0.54448235", "0.54389876", "0.54309016", "0.5428903", "0.54240155", "0.5420351", "0.5416539", "0.54139084", "0.5409944", "0.5407149" ]
0.7350066
1
Define an empty process
def process(*) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @processes = []\n end", "def initialize(process); end", "def initialize(process)\n self.process = process\n end", "def initialize(pid) \r\n @pid = pid\r\n @h = Ragweed::Wrap32::open_process(pid)\r\n @a = arena()\r\n end", "def process\n # no-op by default\n end", "def start!\n process.start\n end", "def process\n # no-op\n end", "def create_process(args)\n name, priority = get_name(args), get_priority(args)\n\n if !priority.between?(1, 2) or process_exists?(name) or name == :init\n @has_error = true\n else\n p_node = spawn_child_process(name, priority)\n move_to_ready_list(p_node)\n end\n\n scheduler\n end", "def process\n pid = spawn(@args.command, %i[out err] => '/dev/null')\n Process.detach pid\n metadata[@args.command] = pid\n end", "def manual_process!\r\n allocate_to!('MANUAL')\r\n process!\r\n end", "def initialize(process)\n\t\t\t\tsuper(IO.popen(process, Writeable))\n\t\t\tend", "def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n if @options.delete(:pgroup_kill)\n @pgroup_kill = true\n @options[:pgroup] = true\n end\n @options.delete(:chdir) if @options[:chdir].nil?\n exec! if !@options.delete(:noexec)\n end", "def default_start_program\n _init_command('start')\n end", "def process(process_name, &block)\n process_proxy = ProcessMethods.new(process_name.to_s, self)\n \n # Assigns all attributes from application scope and assigns to process\n assign_global_attributes(process_proxy)\n \n Blockenspiel.invoke(block, process_proxy)\n # Takes everything which we set in the DSL and loads it into @attributes\n process_proxy.assign_process_attributes!\n \n process_proxy.create_child_process_template\n \n assign_default_pid_file(process_proxy, process_name.to_s)\n \n # Validate process\n process_proxy.validate!\n \n # Assign group to process\n process = process_proxy.to_process(process_name.to_s)\n \n self.app.add_process(process)\n end", "def check_process_not_running(name)\n procs = get_procs_by_name(name)\n procs.should be_empty\n end", "def pid\n nil\n end", "def start_none\n unless options[:ontop]\n Daemonize.daemonize(output_logfile, @group.app_name)\n else\n Daemonize.simulate(output_logfile)\n end\n\n @pid.pid = Process.pid\n\n # We need this to remove the pid-file if the applications exits by itself.\n # Note that <tt>at_text</tt> will only be run if the applications exits by calling\n # <tt>exit</tt>, and not if it calls <tt>exit!</tt> (so please don't call <tt>exit!</tt>\n # in your application!\n #\n at_exit do\n begin; @pid.cleanup; rescue ::Exception; end\n\n # If the option <tt>:backtrace</tt> is used and the application did exit by itself\n # create a exception log.\n if options[:backtrace] && !options[:ontop] && !$daemons_sigterm\n begin; exception_log; rescue ::Exception; end\n end\n\n end\n\n # This part is needed to remove the pid-file if the application is killed by\n # daemons or manually by the user.\n # Note that the applications is not supposed to overwrite the signal handler for\n # 'TERM'.\n #\n trap(SIGNAL) do\n begin; @pid.cleanup; rescue ::Exception; end\n $daemons_sigterm = true\n\n if options[:hard_exit]\n exit!\n else\n exit\n end\n end\n end", "def create_process(workers_count)\n pid = start_threads(workers_count)\n @pids[pid] = {}\n end", "def manage_processes\n puts \"in manage process\"\nend", "def pid=(_arg0); end", "def initialize(name: nil)\n\t\t\t\tsuper()\n\t\t\t\t\n\t\t\t\t@name = name\n\t\t\t\t@status = nil\n\t\t\t\t@pid = nil\n\t\t\t\t\n\t\t\t\t@pid = yield(self)\n\t\t\t\t\n\t\t\t\t# The parent process won't be writing to the channel:\n\t\t\t\tself.close_write\n\t\t\tend", "def set_processes count\n @processes = count\n end", "def initialise_process\n self.state = \"Initiated\"\n self.save!\n self.init_process\n end", "def initialize(index, master_pid)\n @index = index\n @master_pid = master_pid\n @times_run = 0\n\n ProcessManager.set_program_name(description)\n end", "def make_pid_file\n @commands_and_opts.push OPTIONAL_OPTS[:make_pid_file]\n self\n end", "def check_if_process_group_empty\n signal_process_group 0\n end", "def pid(*) end", "def pid; ::Process.pid end", "def clear\n @names = {}\n @processes = []\n end", "def on_begin_process()\n # subclasses may override this method \n end", "def spawn\n raise \"not yet implemented\"\n end", "def add_process(name, options, block)\n @processes << [name, options, block]\n nil\n end", "def setup\n %w{ echo_server deaf_server stubborn_server simple_server }.each do |server|\n begin\n Process.kill 9, possible_pid(server)\n rescue Errno::ESRCH\n # good, no process to kill\n end\n begin\n File.unlink pid_file(server)\n rescue Errno::ENOENT\n # good, no pidfile to clear\n end\n end\n end", "def initialize(cmd, *args)\n @cmd = cmd\n @args = *args\n @process_status = nil\n @executed = false\n end", "def attach(pid)\n MemoryIO::Process.new(pid)\n end", "def pid() end", "def pid() end", "def pid() end", "def initialize(opts = {})\n value = opts[:value] || 1\n task = (opts[:task] && opts[:task].to_i) || ipc_space || mach_task_self\n sync_policy = opts[:sync_policy] || :fifo\n\n port = if opts[:port]\n opts[:port].to_i\n else\n mem = new_memory_pointer(:semaphore_t)\n semaphore_create(task, mem, sync_policy, value)\n mem.get_uint(0)\n end\n\n super(:port => port, :ipc_space => task)\n end", "def fork\n nil\n end", "def initialize(arg)\n super(arg)\n if(!@@has_setup)\n path = File.expand_path('../../../mockcourse/mockcourse', __FILE__)\n port = get_open_port\n path = \"#{path} #{port} > /dev/null 2>&1 &\"\n @@pid = Process.spawn(path, :pgroup => true)\n tries = 5\n while tries > 0 and @@client.nil?\n tries -= 1\n sleep(1) # wait for Mockcourse to start\n begin\n @@client = Concourse.connect(port:port)\n rescue Exception => ex\n if tries == 0\n raise ex\n else\n next\n end\n end\n end\n @@pid = get_mockcourse_pid\n ObjectSpace.define_finalizer(self, self.class.finalize(@@pid))\n @@has_setup = true\n end\n end", "def create_process_def(process_def)\n doValidation(process_def)\n #@jtodoIMP handle when pass with ot without /\n post(process_def, self.create_process_uri)\n end", "def create_processes_for_snapshot(snapshot)\n [1 .. rand(10)+10].each do\n Sherlock::Models::Process.create!(\n :snapshot => snapshot,\n :timestamp => snapshot.timestamp,\n :user => %w(nobody root httpd postfix).sample,\n :pid => rand(1000) + 1000,\n :cpu_usage => rand(50),\n :memory_usage => rand(25),\n :virtual_memory_size => rand(1000) + 1000,\n :residential_set_size => rand(1000) + 1000,\n :tty => %w(? tty0 tty1 tty2).sample,\n :state => %w(S Ss Z R+).sample,\n :started_at => (Time.now - (rand(100) + 1).minutes).strftime('%H:%M'),\n :cpu_time => (Time.now - (rand(100) + 1).minutes).strftime('%H:%M'),\n :command => %w(syslogd ntpd autofsd httpd cupsd).sample\n )\n end\nend", "def process\n @process ||= Bumbleworks::Process.new(@fei.wfid)\n end", "def initialize(process)\n @process = process\n @credentials = credentials_from_process(@process)\n @async_refresh = false\n\n super\n end", "def _pid\n @@_pid ||= Process.pid\n end", "def create_process(*args, start: true, wait: true, attach: true, cwd: nil, environment: {})\n process = ChildProcess.build(*args)\n process.io.inherit! if attach\n\n # Set the working directory\n process.cwd = cwd unless cwd.nil?\n\n # Set any passed environment variables\n environment.each do |env, value|\n process.environment[env.to_s] = value\n end\n\n # Start the process if requested\n if start\n process.start\n process.wait if wait\n end\n\n process\nend", "def fork # :nodoc\n @cant_fork = true\n nil # important due #work\n end", "def process!\n end", "def on_process(&block); end", "def process\n end", "def initialize(options = {})\n @daemonize = options[:daemonize].nil? ? true : options[:daemonize]\n @pid_file = options[:pid_file].nil? ? nil : File.absolute_path(options[:pid_file])\n end", "def start\n @process = ChildProcess.build(*parameters)\n process.start\n end", "def start\n parse_options\n\n if @daemon\n require \"facets/daemonize\"\n\n daemonize()\n\n # Save a process sentinel file.\n FileUtils.touch(File.join(\".temp\",\"d#{Process.pid}.pid\"))\n end\n setup_drb()\n end", "def pid_needed?\n pid.blank?\n end", "def start!(&block)\n if running?\n fail InsidiousError.new(\"Process is already running with PID #{pid}\")\n exit 2\n else\n if @pid_file.nil? && daemon?\n fail InsidiousError.new('No PID file is set but daemonize is set to true')\n exit 1\n end\n\n run_daemon!(&block)\n end\n end", "def check_process\n super\n end", "def initialize(id, *command)\n if command.empty?\n raise ArgumentError, \"Command may not be empty!\"\n end\n\n @id = id\n @command = command\n @pid = nil\n @stdout = nil\n @stderr = nil\n @wout = nil\n @werr = nil\n end", "def subprocess\n\tif not pid = Process.fork\n\t\tyield\n\t\texit!\n\tend\n\tpid\nend", "def spawn_process(args = nil)\n #Used for printing debug-stuff.\n @main = true\n\n if args && args[:exec]\n cmd = \"#{args[:exec]}\"\n else\n if RbConfig::CONFIG[\"bindir\"]\n cmd = \"#{RbConfig::CONFIG[\"bindir\"]}/ruby\"\n else\n cmd = \"ruby\"\n end\n end\n\n cmd << \" \\\"#{File.realpath(File.dirname(__FILE__))}/../scripts/ruby_process_script.rb\\\" --pid=#{@my_pid}\"\n cmd << \" --debug\" if @args[:debug]\n cmd << \" \\\"--title=#{@args[:title]}\\\"\" unless @args[:title].to_s.strip.empty?\n\n #Start process and set IO variables.\n require \"open3\"\n @io_out, @io_in, @io_err = Open3.popen3(cmd)\n @io_out = Tsafe::Proxy.new(obj: @io_out)\n @io_out.sync = true\n @io_in.sync = true\n @io_err.sync = true\n\n started = false\n @io_in.each_line do |str|\n if str == \"ruby_process_started\\n\"\n started = true\n break\n end\n\n debug \"Ruby-process-debug from stdout before started: '#{str}'\\n\" if @debug\n end\n\n raise \"Ruby-sub-process couldnt start: '#{@io_err.read}'.\" unless started\n self.listen\n\n #Start by getting the PID of the process.\n begin\n @pid = self.static(:Process, :pid).__rp_marshal\n raise \"Unexpected PID: '#{@pid}'.\" if !@pid.is_a?(Fixnum) && !@pid.is_a?(Integer)\n rescue => e\n self.destroy\n raise e\n end\n\n if block_given?\n begin\n yield(self)\n ensure\n self.destroy\n end\n\n return self\n else\n return self\n end\n end", "def initialize_worker\n nil\n end", "def procession\n @procession ||= fetch_procession\n end", "def nilBinding; ProcFactory.new.create.binding end", "def start\n if File.file?(trait[:pidfile])\n pid = File.read(trait[:pidfile], 20).strip\n abort(\"Oy! already running? (pid=#{pid})\")\n end\n\n puts \"Starting Oy!.\"\n\n fork do\n Process.setsid\n exit if fork\n\n File.open(trait[:pidfile], 'w') {|file| file << Process.pid}\n at_exit {FileUtils.rm(trait[:pidfile]) if File.exist?(trait[:pidfile])}\n\n Dir.chdir(HOME_DIR)\n File.umask(0000)\n\n STDIN.reopen('/dev/null')\n STDOUT.reopen('/dev/null', 'a')\n STDERR.reopen(STDOUT)\n\n run\n end\n end", "def start\n create('start')\n end", "def start(name, &block)\n\t\t\t\tProcess.fork(name: name, &block)\n\t\t\tend", "def register(name, command, options={})\n options[:env] ||= env\n options[:cwd] ||= File.dirname(command.split(\" \").first)\n process = Foreman::Process.new(command, options)\n @names[process] = name\n @processes << process\n end", "def should_start_new_process(process_type, event, current_processes)\n creation_policy = creation_policy_for process_type, event\n\n if :always == creation_policy\n true\n elsif :if_none_found == creation_policy\n !current_processes\n else\n false\n end\n end", "def start\n handle_old_pid_file\n start_control_loop\n end", "def initialize(*args)\n @env, @argv, options = extract_process_spawn_arguments(*args)\n @options = options.dup\n @input = @options.delete(:input)\n @timeout = @options.delete(:timeout)\n @max = @options.delete(:max)\n @prepend_stdout = @options.delete(:prepend_stdout) || \"\"\n @prepend_stderr = @options.delete(:prepend_stderr) || \"\"\n @options.delete(:chdir) if @options[:chdir].nil?\n\n exec!\n end", "def initialize(terminal)\n super do\n self.thread_variable_set(\"input\", nil)\n self.thread_variable_set(\"output_history\", [])\n self.thread_variable_set(\"latest_output\", [])\n self.thread_variable_set(\"terminal\", terminal)\n self.thread_variable_set(\"input_processed\", false)\n self.thread_variable_set(\"project_exe\", self.start_project)\n end\n end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def reserve_and_run_one_job; end", "def start\n pid = Process.spawn(\n executable_path, \"-daemon\",\n :out => '/dev/null', :err => '/dev/null')\n\n # Detach the spawned process\n Process.detach pid\n end", "def start\n noth\n end", "def default_stop_program\n _init_command('stop')\n end", "def initialize(max_processes=20)\n @mutex ||= Mutex.new\n @processes ||= [] # TODO: convert this to a hash by child thread?\n @max_processes = max_processes\n end", "def create_temp_proc()\n\tsysinfo = client.sys.config.sysinfo\n\twindir = client.fs.file.expand_path(\"%windir%\")\n\t# Select path of executable to run depending the architecture\n\tif sysinfo['Architecture'] =~ /x86/\n\t\tcmd = \"#{windir}\\\\System32\\\\notepad.exe\"\n\telse\n\t\tcmd = \"#{windir}\\\\Sysnative\\\\notepad.exe\"\n\tend\n\t# run hidden\n\tproc = client.sys.process.execute(cmd, nil, {'Hidden' => true })\n\treturn proc.pid\nend", "def running=(_arg0); end", "def initialize pid = nil\n @id = pid\n end", "def initialize(shell)\n\t\tsuper\n\n\t\tself.extensions = []\n\t\tself.bgjobs = []\n\t\tself.bgjob_id = 0\n\tend", "def start\n return if @status == :runned\n \n @pid = fork do\n Process::setsid\n STDIN.reopen('/dev/null', 'r')\n STDOUT.reopen('/dev/null', 'w')\n STDERR.reopen('/dev/null', 'w')\n exec @cmd\n end\n @status = :runned\n end", "def process_name\r\n @process_name ||= $0.dup\r\n end", "def clear_cache\n @process_pid.set(nil)\n end", "def command_start=(_arg0); end", "def command_start=(_arg0); end", "def command_start=(_arg0); end", "def start_proc()\n\tprint_good(\"Starting Notepad.exe to house Meterpreter Session.\")\n\tproc = client.sys.process.execute('notepad.exe', nil, {'Hidden' => true })\n\tprint_good(\"Process created with pid #{proc.pid}\")\n\treturn proc.pid\nend", "def process(program)\n Verneuil::Process.new(program, context)\n end", "def initialize(options = {})\n @seq = 0\n @bind_port = 0\n @bind_host = nil\n @data_size = 56\n\n @ping_id = (Thread.current.object_id ^ Process.pid) & 0xffff\n\n super(options)\n end", "def run\n drop_pid\n \n puts \"Starting rake process with process id #{@pid}:\" if @verbose\n \n at_exit do \n clear_pid\n end\n end", "def pid\n @pid ||= Process.pid\n end", "def pid\n @pid ||= Process.pid\n end", "def pid\n @pid ||= Process.pid\n end" ]
[ "0.6707049", "0.6685897", "0.64436495", "0.6033135", "0.5954204", "0.58781004", "0.5843107", "0.57428735", "0.57397515", "0.5702551", "0.5649816", "0.56327695", "0.5602616", "0.55662453", "0.54700893", "0.5456875", "0.54407895", "0.54248744", "0.5404583", "0.5395417", "0.5385543", "0.53823644", "0.5371346", "0.53537196", "0.5351376", "0.5342847", "0.5342044", "0.5333351", "0.532591", "0.5321096", "0.5317896", "0.52960217", "0.5295384", "0.5283266", "0.5271169", "0.52675873", "0.52675873", "0.52675873", "0.52638745", "0.52594393", "0.5254848", "0.524564", "0.52279145", "0.522146", "0.52121145", "0.52025783", "0.5197983", "0.5195938", "0.51933116", "0.5182284", "0.5172968", "0.5167515", "0.5158734", "0.5152437", "0.5145841", "0.51455814", "0.5145023", "0.51416737", "0.51413155", "0.51159054", "0.5112382", "0.50985116", "0.5097325", "0.5095517", "0.50944084", "0.509294", "0.50927186", "0.5086877", "0.50786954", "0.50722325", "0.5066981", "0.5057351", "0.5057351", "0.5057351", "0.5057351", "0.5057351", "0.5057351", "0.5057351", "0.5057351", "0.5056405", "0.5055027", "0.5054579", "0.5053992", "0.50537014", "0.5048339", "0.5045643", "0.5042017", "0.5039248", "0.5038024", "0.50334305", "0.5017302", "0.5010936", "0.5010936", "0.5010936", "0.50088024", "0.50062644", "0.50028914", "0.50026953", "0.500115", "0.500115", "0.49946138" ]
0.0
-1
Perform the process of importing the market data. Returns true if no errors are found, false otherwise.
def process market_data.each do |data| slug = data['slug'] coin = Coin.find_by_slug(slug) if coin.nil? add_error(slug, "Unknown coin: #{data['name']}") next end quote_time = DateTime.parse(data['quote']['USD']['last_updated']) next if coin.worths.where(quote: 'USD', quote_time: quote_time).any? worth = coin.worths.build( quote_time: quote_time, quote: 'USD', market_capitalization: data['quote']['USD']['market_cap'], quoted_value: data['quote']['USD']['price'] ) worth.save! end errors.any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errored_during_import?\n import_errors.present?\n end", "def import_failed?\n IMPORT_ERRORS.include? import_progress[:status]\n end", "def product_import_initial_values\n if @temp_file.blank?\n errors.add(:file_missing, \"file missing\")\n return false\n end\n\n begin\n file_content = read_import_csv(@temp_file)\n rescue Exception => e\n errors.add(:encoding_failed, \"<br />#{e.backtrace.join('<br />')}\")\n return false\n end\n\n begin\n data = CSV.parse(file_content)\n rescue Exception => e\n errors.add(:invalid_csv, \"<br />#{e.backtrace.join('<br />')}\")\n return false\n end\n\n if has_header?\n header_row = parse_header(data.first)\n errors.add(:has_header) unless valid_header?(header_row, import_kind)\n end\n end", "def importing?\n IMPORT_ONGOING.include? import_progress[:status]\n end", "def do_import\n if(reset)\n TaliaUtil::Util.full_reset\n puts \"Data Store has been completely reset\"\n end\n errors = []\n run_callback(:before_import)\n if(index_data)\n import_from_index(errors)\n else\n puts \"Importing from single data file.\"\n TaliaCore::ActiveSource.create_from_xml(xml_data, :progressor => progressor, :reader => importer, :base_file_uri => @true_root, :errors => errors, :duplicates => duplicates)\n end\n if(errors.size > 0)\n puts \"WARNING: #{errors.size} errors during import:\"\n errors.each { |e| print_error e }\n end\n run_callback(:after_import)\n end", "def imported?\n import_progress[:status] == IMPORT_COMPLETE\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 import\n if gateway.valid?\n gateway.items.map do |item|\n import_item(item)\n end\n else\n @errors = gateway.errors\n false\n end\n end", "def import\n if current_user.items.import(params[:file]) == false\n #False encountered means atleast one invalid item\n flash[:danger] = \"Error Encountered. No Items Imported. Please check CSV File.\"\n redirect_to spage3_path\n else \n #True means all valid items so save all of them\n current_user.items.import1(params[:file])\n flash[:success] = \"All Items Imported Successfully.\"\n redirect_to spage3_path\n end\n end", "def perform\n import = TransportPassengerImport.find self.id\n import.update_attributes(:status => 1)\n load_all_data\n @rollback = false\n @errors = Array.new\n ActiveRecord::Base.transaction do\n import_csv(import.attachment.to_file)\n raise ActiveRecord::Rollback if @rollback\n end\n if @errors.present?\n import.update_attributes(:status => 4, :last_message => @errors)\n else\n import.update_attributes(:status => 2, :last_message => nil)\n end\n rescue Exception => e\n import.update_attributes(:status => 3, :last_message => ['-', e.message])\n end", "def import_errors?\n self.import_errors == true\n end", "def import!\n log \"Importing #{csv_file.split('/').last.sub('.csv', '')}\"\n\n @errors_count = 0\n\n before_import()\n with_each_row { process_row }\n after_import()\n\n log \"Import complete (#{@errors_count} errors in #{@has_header_row ? @current_row_number-1 : @current_row_number} rows)\"\n end", "def import\n open do |io|\n case format\n when :yml, :yaml\n import_yaml(io)\n when :json\n import_json(io)\n when :csv\n import_csv(io)\n end\n end\n\n return true\n end", "def import_data\n file1 = Rails.root.join('app', 'assets', 'csv', 'impressions.csv')\n file2 = Rails.root.join('app', 'assets', 'csv', 'clicks.csv')\n file3 = Rails.root.join('app', 'assets', 'csv', 'conversions.csv')\n if file1.exist? && file2.exist? && file3.exist?\n Campaign.import(file1)\n Click.import(file2)\n Conversion.import(file3)\n redirect_to root_url, notice: 'Data imported!'\n else\n redirect_to root_url, alert: 'All three files need to be in the directory!'\n end\n end", "def transaction_import_process(send_transaction)\n readcsv\n check\n save\n send_to_acx if send_transaction\n end", "def import_data\n begin\n #Get products *before* import - \n @products_before_import = Product.all\n @products_before_import.each { |p| p.destroy }\n OptionType.all.each{ |p| p.destroy }\n\n columns = ImportProductSettings::COLUMN_MAPPINGS\n rows = FasterCSV.read(self.data_file.path, :col_sep => '|')\n \n \n log(\"Importing products for #{self.data_file_file_name}, path is #{self.data_file.path} began at #{Time.now}\")\n num_imported = 0\n\n rows[ImportProductSettings::INITIAL_ROWS_TO_SKIP..-1].each do |row|\n product_information = {}\n num_imported += 1\n #next if (row[columns['Fabricante']] =~ /FAST/).nil?\n \n #Easy ones first\n product_information[:sku] = row[columns['PN']]\n product_information[:name] = row[columns['Referencia']]\n # remove commas from prices, assume the point is the decimal separator\n product_information[:price] = format_price row[columns['Precio']] unless row[columns['Precio']].nil?\n product_information[:cost_price] = format_price row[columns['Coste']] unless row[columns['Coste']].nil?\n product_information[:available_on] = DateTime.now - 1.day #Yesterday to make SURE it shows up\n product_information[:description] = row[columns['Descripcion-es']] unless row[columns['Descripcion-es']].nil?\n product_information[:on_hand] = row[columns['Stock']] unless row[columns['Stock']].nil?\n\n log(\"Importing #{product_information[:sku]}, named #{product_information[:name]}, price #{product_information[:price]}\")\n\n #Create the product skeleton - should be valid\n product_obj = Product.new(product_information)\n unless product_obj.valid?\n log(\"A product could not be imported - here is the information we have:\\n #{ pp product_information}\", :error)\n next\n end\n \n #Save the object before creating asssociated objects\n product_obj.save\n\n # apply the properties if relevant\n find_and_assign_property_value('Volumen', row[columns['Volumen']], product_obj)\n\n #Now we have all but images and taxons loaded\n # Seccion + Fabricante\n associate_taxon('Productos', seccion(row[columns['Seccion']]), product_obj)\n associate_taxon('Marcas', row[columns['Fabricante']], product_obj)\n \n #Just images \n ipath = ImportProductSettings::PRODUCT_IMAGE_PATH \n imagefiles = Dir.new(ipath).entries.select{|f|f.include?(row[columns['PN']])}\n imagefiles.each{|f| find_and_attach_image(f, product_obj)} unless imagefiles.empty?\n log(\"#{imagefiles.size} found for #{product_information[:sku]}, named #{product_information[:name]}\")\n #find_and_attach_image(row[columns['Image Main']], product_obj)\n #find_and_attach_image(row[columns['Image 2']], product_obj)\n #find_and_attach_image(row[columns['Image 3']], product_obj)\n #find_and_attach_image(row[columns['Image 4']], product_obj)\n\n # now the variants (this works, but can be implemented more elegant :)\n variants_name = File.basename(self.data_file_file_name, \".csv\") + \"_variants.csv\"\n variantsfile = ImportProductSettings::VARIANTS_PATH + variants_name \n File.open(variantsfile).readlines.each do |l|\n mpn,pn,ot,val,stock,price = l.split('|').map{|e|e.gsub('\"','')}\n price = format_price price.chomp unless price.nil?\n #log \"check if variant #{product_obj.sku} belongs to #{mpn}\"\n if product_obj.sku == mpn then\n log \"variant #{pn} belongs to #{mpn}\"\n opt_type = product_obj.option_types.select{|o| o.name == ot}.first\n\t opt_type = product_obj.option_types.create(:name => ot, :presentation => ot.capitalize) if opt_type.nil?\n new_value = opt_type.option_values.create(:name => val, :presentation => val)\n\t ovariant = product_obj.variants.create(:sku => pn)\n ovariant.count_on_hand = stock\n ovariant.price = price unless price.nil?\n\t ovariant.option_values << new_value\n imagefiles = Dir.new(ipath).entries.select{|f|f.include?(pn)}\n unless imagefiles.empty?\n imagefiles.each{|f| find_and_attach_image(f, ovariant)} \n log(\"#{imagefiles.size} found for variants of #{product_information[:sku]},named #{product_information[:name]}\")\n end\n log(\" variant priced #{ovariant.price} with sku #{pn} saved for #{product_information[:sku]},named #{product_information[:name]}\")\n\t ovariant.save!\n end\n end\n \n log(\"product #{product_obj.sku} was imported at #{DateTime.now}\")\n end\n \n rescue Exception => exp\n log(\"An error occurred during import, please check file and try again. (#{exp.message})\\n#{exp.backtrace.join('\\n')}\", :error)\n return [:error, \"The file data could not be imported. Please check that the spreadsheet is a CSV file, and is correctly formatted.\"]\n end\n \n #All done!\n return [:notice, \"Product data was successfully imported by fer.\"]\n end", "def import(file = nil)\n # A Hash containthe returning messages (one message for each row)\n # The values are Arrays containing the importing results for each row\n msg = {success: [], info: []} \n\n # If file is nil or blank (nil != blank)\n if file.nil? or file == \"\"\n msg[:success] << false \n msg[:info] << \"File name is nil or blank!\" \n return msg\n end\n\n # If the file is non-existant ...\n if file.instance_of?(String) and !(File.file?(file)) \n msg[:success] << false \n msg[:info] << \"File doesn't exist!\" \n return msg\n end\n\n # ??File submitted through html file doesn't exist!\n # http://guides.rubyonrails.org/form_helpers.html#uploading-files\n # 5.1 What Gets Uploaded\n # The object in the params hash is an instance of a subclass of IO.\n # Depending on the size of the uploaded file it may in fact be a StringIO\n # or an instance of File backed by a temporary file.\n if file.instance_of?(StringIO)\n msg[:success] << true \n msg[:info] << \"File is an instance of StringIO!\" \n elsif file.instance_of?(File) \n msg[:success] << true \n msg[:info] << \"File is an instance of File!\" \n else # ActionDispatch::Http::UploadedFile by html form \n msg[:success] << true \n msg[:info] << \"Must be the ActionDispatch::Http::UploadedFile type?\" \\\n \" #{file.class}\" \n end\n\n # Gets the file path\n file_path = file\n file_path = file.path unless file.instance_of?(String)\n #puts \"file_path = #{file_path}\"\n\n # TODO: Checks to see if the headers are correct\n # Imports row after row\n # CSV::Row is part Array & part Hash\n CSV.foreach(file_path, headers: true) do |row|\n vhash = row.to_hash # temporary VLAN record hash\n\n # Find FK lan_id\n # Note: Do not use Symbol :lan_name, Or it will not be found. Very weird!\n # Hence, use String instead of Symbol as the Hash key where necessary\n lan_id = find_lan_id(vhash[\"lan_name\"])\n \n # Go to the next row if an invalid lan_id was found \n unless lan_id > 0\n msg[:success] << false \n msg[:info] << \"Cannot find FK lan_id\" \n next\n end\n\n # Remove lan_name field from the row as it's not a field of table vlans\n vhash.delete(\"lan_name\")\n # and appends the FK lan_id\n vhash[\"lan_id\"] = lan_id\n #puts vhash\n \n # TODO: Need to feedback the result to the user in the future release\n s1 = \"lan_id: \" << lan_id.to_s # a temporary string\n tv = Vlan.new(vhash) # temporary VLAN record\n if tv.invalid? # invalid? triggers the model validation\n msg[:success] << false\n s1 << \", invalid Vlan\"\n else\n msg[:success] << true\n s1 << \", saved\"\n tv.save\n end\n\n msg[:info] << s1\n end\n return msg\n end", "def import!(data)\n pointer = 0\n date_format_checked = false\n time_format_checked = false\n record_count = nil\n actual_record_count = 0\n \n Measurement.transaction do\n begin\n cells = []\n cells_count, pointer = CSV.parse_row(data, pointer, cells)\n unless date_format_checked\n date_format_checked = raise_if_unsupported_date_format(cells.first)\n next\n end\n unless time_format_checked\n time_format_checked = raise_if_unsupported_time_format(cells.first)\n next\n end\n unless record_count\n record_count = extract_measurements_count(cells.first) \n next\n end\n measurement = extract_measurement(cells)\n if measurement\n measurement.save! unless measurement == :not_a_measurement\n actual_record_count += 1\n end\n end while cells_count > 0\n \n if record_count || (actual_record_count > 0)\n unless record_count == actual_record_count\n raise Importers::ConflictingRecordCountError.new(record_count,\n actual_record_count)\n end\n end\n end\n \n self\n end", "def import_file_table\n @error = true\n scanned_data = ReadFile.scan(sale_params[:file_table], Sale.regex_read_file_table)\n if scanned_data\n begin\n sales_mapped = Sale.map_scanned_data scanned_data\n Sale.create(sales_mapped)\n @total_gross_income = Sale.calc_total_gross_income sales_mapped\n @error = false\n rescue\n end\n end\n end", "def valid_import?\n true\n end", "def imports_finished_with_failures?\n digital_object_imports.where(status: DigitalObjectImport::FAILED).exists? &&\n digital_object_imports.where(\n status: [DigitalObjectImport::QUEUED, DigitalObjectImport::IN_PROGRESS]\n ).blank?\n end", "def import(manifest) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity\n return false if @reimport_mono.blank?\n monograph = @reimport_mono\n rows = CSV.parse(manifest, headers: true, skip_blanks: true).delete_if { |row| row.to_hash.values.all?(&:blank?) }\n # The template CSV file contains an extra row after the\n # headers that has explanatory text about how to fill in\n # the table. We want to throw away that text.\n rows.delete(0)\n rows.each do |row|\n noid = row.field('NOID')\n row.each do |key, value|\n field = metadata_field(key)\n next if field.blank? || value.blank?\n if noid == monograph.id\n if metadata_monograph_field?(key)\n monograph.send(\"#{field[:metadata_name]}=\", metadata_field_value(field, value))\n monograph.save\n end\n elsif metadata_file_set_field?(key)\n file_set = FileSet.find(noid)\n if key == 'Representative Kind'\n set_representative_or_cover(monograph, file_set, value.strip.downcase)\n else\n file_set.send(\"#{field[:metadata_name]}=\", metadata_field_value(field, value))\n file_set.save\n end\n end\n end\n end\n true\n end", "def check_input_data(data_category, import_file, export_file)\n category = description_formatting(data_category.to_s).downcase\n\t\n import_file_checked = File.file?(import_file.to_s)\n\texport_file_checked = File.file?(export_file.to_s)\n\n import_file_format = file_format(import_file.to_s)\n export_file_format = file_format(export_file.to_s)\n\n\tif import_file_checked == false || export_file_checked == false\n \treturn error(3)\n\n elsif import_file_format == export_file_format\n return error(9)\n\n\telsif import_file_format != 'csv' && import_file_format != 'xml' && import_file_format != 'json'\n \treturn error(5)\n\n\telsif export_file_format != 'csv' && export_file_format != 'xml' && export_file_format != 'json'\n \treturn error(4)\n\tend\n\n\n\t### Filtering the conversion request based on Conversion Category ###\n if category == 'customer' \n \treturn error(6)\n\n elsif category == 'transaction'\n \treturn error(7)\n\n elsif category == 'product'\n \tproduct_category(import_file, export_file, import_file_format, export_file_format)\n \treturn 200 ### for testing purposes\n else\n\t\treturn error(2)\n end\nend", "def import_package_learners_from_csv\n assessment_id = params[:user][:package_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n\n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/packages/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n end", "def create\n @create_attempted = true\n\n\n if ready_to_create?\n # TODO: DRY\n if a = save_order\n\n sorted_processed_rows.each_value do |rp|\n a.each do |k|\n rp.objects[k].each do |o|\n o.save unless o.persisted?\n end\n end\n end\n\n else\n\n sorted_processed_rows.each_value do |rp|\n rp.objects.each_value do |objs|\n objs.each do |o|\n o.save\n end\n end\n end\n\n end\n else\n @errors << \"Import level #{import_level} has prevented creation.\" unless import_level_ok?\n @errors << 'CSV has not been processed.' unless processed?\n @errors << 'One of user_id, project_id or file has not been provided.' unless valid?\n end\n true\n end", "def import\n @imported = false\n\n if (!params[:attachment].blank?)\n flash.now[:notice] = \"File uploaded\"\n\n import_batch = ImportBatch.create\n\n CSV.parse(params[:attachment].read).each do |row|\n entry = Entry.new(\n :date => Date.strptime(row[0], '%m/%d/%Y'),\n :raw_name => row[2],\n :amount => row[7],\n :account_id => params[:account_id],\n :import_batch_id => import_batch.id)\n entry.save\n end\n end\n end", "def import\n \tbegin #This might fail if input is incorrect. So put it in the begin block\n \t\tProduct.import(params[:file]) #Refer to the import method defined in the product model\n \t\tredirect_to root_url, notice: \"Products imported successfully\" #Give a success flash message if import is successful.\n rescue #Catch the failure here by displaying the suitable error message.\n \tredirect_to root_url, notice: \"Please upload valid csv\" #Give a failure message if import is unsuccessful\n \tend\n end", "def import\n #throws error if importing csv file fails\n begin\n Category.import\n notice = \"Import Complete\"\n rescue\n notice = \"There was an error whilst importing!\"\n ensure\n redirect_to start_path, notice: notice\n end\n end", "def import_multiple_shared\n shared_packages = Package.shared.where(\"unit_id != #{current_unit.id}\").find(params[:selected_records])\n results = []\n shared_packages.each do |shared_package|\n package = Package.import_package(current_unit, shared_package)\n results << package.save\n end\n respond_to do |format|\n if results.include?(false)\n flash[:error] = \"Failed to import packages\"\n format.html { redirect_to shared_packages_path(current_unit) }\n else\n flash[:notice] = \"Successfully imported packages\"\n format.html { redirect_to shared_packages_path(current_unit) }\n end\n end\n end", "def import\n import_data(load_dataset_hash)\n end", "def import_master\n begin\n if request.post?\n raise \"Please attach an excel file for import master tables\" if params[:import_file].blank? \n status = \"\"\n set_original_path(params[:import_file]) \n data = Roo::Spreadsheet.open(@original_path) \n data.each_with_pagename do |name, sheet|\n table_name = name.downcase\n case table_name\n when \"bill_footer_setting\" \n status = FooterSetting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"bill_group\" \n status = BillGroup.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"combooffer\" \n status = ComboOffer.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"creditcard_master\" \n status = CreditCard.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"cust_detail\"\n status = Customer.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"item_groups\" \n status = ItemGroup.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"item_groups_kot_print\" \n status = ItemGroupsKotPrint.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"item_sub_group\" \n status = ItemSubGroup.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"items\" \n status = Item.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"table_master\"\n status = Table.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"settings\" \n status = Setting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"remarksmaster\"\n status = RemarkMaster.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"table_section\" \n status = TableSection.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"tax\"\n status = Tax.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"user_validation\" \n status = StaffSubMenuSetting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"usermainmenu\" \n status = StaffMenuSetting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"waiter\" \n status = Waiter.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"outlet_master\" \n status = Outlet.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"combopackage\" \n status = ComboPackage.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"user_master\" \n status = Staff.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"strtable\" \n status = Company.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"happyhour\" \n status = HappyHour.checked_attributes(sheet)\n raise status[1] if status [0] == false \n end \n end \n \n begin\n data.default_sheet = \"Outlet_Master\"\n status = Outlet.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false\n begin\n data.default_sheet = \"ComboPackage\"\n status = ComboPackage.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false \n begin\n data.default_sheet = \"Table_Section\"\n status = TableSection.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false \n begin\n data.default_sheet = \"User_Master\"\n status = Staff.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false\n \n data.each_with_pagename do |name, sheet|\n table_name = name.downcase\n case table_name\n when \"bill_footer_setting\"\n status = FooterSetting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"bill_group\" \n status = BillGroup.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"combooffer\"\n status = ComboOffer.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"creditcard_master\"\n status = CreditCard.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"cust_detail\"\n status = Customer.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"item_groups\"\n status = ItemGroup.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"item_groups_kot_print\"\n status = ItemGroupsKotPrint.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"item_sub_group\" \n status = ItemSubGroup.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"items\"\n status = Item.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"table_master\"\n status = Table.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"settings\"\n status = Setting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"remarksmaster\"\n status = RemarkMaster.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false\n when \"tax\"\n status = Tax.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"user_validation\" \n status = StaffSubMenuSetting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"usermainmenu\" \n status = StaffMenuSetting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"waiter\" \n status = Waiter.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"strtable\" \n status = Company.import(sheet, current_client) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"happyhour\" \n status = HappyHour.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n end \n end\n flash[:notice] = \"Master data is imported successfully.\"\n redirect_to client_path\n end\n rescue Exception => e\n flash.now[:info] = e.message\n render :import_master\n end\n end", "def import_data\n begin\n #Get products *before* import - \n @products_before_import = Product.all\n\n #Setup HTML decoder\n coder = HTMLEntities.new\n\n columns = ImportProductSettings::COLUMN_MAPPINGS\n log(\"Import - Columns setting: #{columns.inspect}\")\n \n rows = FasterCSV.read(self.data_file.path)\n log(\"Importing products for #{self.data_file_file_name} began at #{Time.now}\")\n nameless_product_count = 0\n \n rows[ImportProductSettings::INITIAL_ROWS_TO_SKIP..-1].each do |row|\n \n log(\"Import - Current row: #{row.inspect}\")\n \n if product_obj = Product.find(:first, :include => [:product_properties, :properties], :conditions => ['properties.name LIKE ? && product_properties.value LIKE ?', \"XmlImportId\", row[columns['Id']]])\n create_variant(product_obj, row, columns)\n else\n #Create the product skeleton - should be valid\n product_obj = Product.new()\n \n #Easy ones first\n if row[columns['Name']].blank?\n log(\"Product with no name: #{row[columns['Description']]}\")\n product_obj.name = \"No-name product #{nameless_product_count}\"\n nameless_product_count += 1\n else\n #Decode HTML for names and/or descriptions if necessary\n if ImportProductSettings::HTML_DECODE_NAMES\n product_obj.name = coder.decode(row[columns['Name']])\n else\n product_obj.name = row[columns['Name']]\n end\n end\n #product_obj.sku = row[columns['SKU']] || product_obj.name.gsub(' ', '_')\n product_obj.price = row[columns['Master Price']] || 0.0\n #product_obj.cost_price = row[columns['Cost Price']]\n product_obj.available_on = DateTime.now - 1.day #Yesterday to make SURE it shows up\n product_obj.weight = columns['Weight'] ? row[columns['Weight']] : 0.0\n product_obj.height = columns['Height'] ? row[columns['Height']] : 0.0\n product_obj.depth = columns['Depth'] ? row[columns['Depth']] : 0.0\n product_obj.width = columns['Width'] ? row[columns['Width']] : 0.0\n #Decode HTML for descriptions if needed\n if ImportProductSettings::HTML_DECODE_DESCRIPTIONS\n product_obj.description = coder.decode(row[columns['Description']])\n else\n product_obj.description = row[columns['Description']]\n end\n \n \n #Assign a default shipping category\n product_obj.shipping_category = ShippingCategory.find_or_create_by_name(ImportProductSettings::DEFAULT_SHIPPING_CATEGORY)\n product_obj.tax_category = TaxCategory.find_or_create_by_name(ImportProductSettings::DEFAULT_TAX_CATEGORY)\n\n unless product_obj.valid?\n log(\"A product could not be imported - here is the information we have:\\n #{ pp product_obj.attributes}\", :error)\n next\n end\n \n #Save the object before creating asssociated objects\n product_obj.save!\n \n xml_import_id_prop = Property.find_or_create_by_name_and_presentation(\"XmlImportId\", \"XmlImportId\")\n ProductProperty.create :property => xml_import_id_prop, :product => product_obj, :value => row[columns['Id']]\n \n brand_prop = Property.find_or_create_by_name_and_presentation(\"Brand\", \"Marque\")\n ProductProperty.create :property => brand_prop, :product => product_obj, :value => row[columns['Brand']]\n \n unless product_obj.master\n log(\"[ERROR] No variant set for: #{product_obj.name}\")\n end\n \n #Now we have all but images and taxons loaded\n associate_taxon('Category', row[columns['Category']], product_obj)\n associate_taxon('Gender', row[columns['Gender']], product_obj)\n \n #Save master variant, for some reason saving product with price set above\n #doesn't create the master variant\n log(\"Master Variant saved for #{product_obj.sku}\") if product_obj.master.save!\n \n create_variant(product_obj, row, columns)\n \n find_and_attach_image(row[columns['Image Main']], product_obj) if row[columns['Image Main']]\n find_and_attach_image(row[columns['Image 2']], product_obj) if row[columns['Image 2']]\n find_and_attach_image(row[columns['Image 3']], product_obj) if row[columns['Image 3']]\n\n #Return a success message\n log(\"[#{product_obj.sku}] #{product_obj.name}($#{product_obj.master.price}) successfully imported.\\n\") if product_obj.save\n end\n \n end\n \n if ImportProductSettings::DESTROY_ORIGINAL_PRODUCTS_AFTER_IMPORT\n @products_before_import.each { |p| p.destroy }\n end\n \n log(\"Importing products for #{self.data_file_file_name} completed at #{DateTime.now}\")\n \n rescue Exception => exp\n log(\"An error occurred during import, please check file and try again. (#{exp.message})\\n#{exp.backtrace.join('\\n')}\", :error)\n return [:error, \"The file data could not be imported. Please check that the spreadsheet is a CSV file, and is correctly formatted.\"]\n end\n \n #All done!\n return [:notice, \"Product data was successfully imported.\"]\n end", "def has_valid_metadata?\n @row_count = 0\n all_valid = true\n metadata_file_path = FileLocations.metadata_file_path(@source_dir)\n ::CSV.foreach(metadata_file_path, headers: true).each do |csv_row|\n next if csv_row.blank?\n # Each row of metadata listed in DESCRIPTION.csv should be valid\n row = strip_csv_row(csv_row)\n @row_count += 1\n all_valid = all_valid && has_valid_metadata_row?(row, @row_count)\n end\n # Should have 1 or more rows\n unless @row_count > 0\n @errors << \"Metadata file #{metadata_file_path} has no rows\"\n all_valid = false\n end\n all_valid\n end", "def fetch_parse?\n\n # If return true a new file has been fetched and parse_products should be rerun.\n # Otherwise the cache of the result of parse_products can be used\n end", "def imported?\n self.ar_record.present? and self.ar_record.wp_id.present?\n end", "def import!\n Version.transaction do\n Version.delete_all\n records.each do |record|\n begin\n import_record(record)\n rescue ActiveRecord::RecordNotFound\n Rails.logger.warn \"Unable to import #{record.primary_identifier} - no matching Book entry for DCL dcl:#{record.dcl_number}\"\n rescue ActiveRecord::RecordInvalid => e\n Rails.logger.warn \"Unable to import #{record.primary_identifier} - failed validations: #{e}\"\n end\n end\n end\n reindex!\n end", "def import_data\n @seller = Spree::Seller.find(params[:seller_id])\n @message = \"\"\n @msg = \"\"\n if params[:action_name] == 'Impozrt Images' && File.extname(params[:attachment].original_filename) != \".zip\"\n @message = \"Please Upload .zip folder for images\"\n elsif params[:action_name] != 'Import Images' && File.extname(params[:attachment].original_filename) != \".xls\"\n @message = \"Please Upload only excel file\"\n elsif @seller.present?\n unless @seller.is_active\n @message = \"The seller you have selected is not activated yet\"\n end\n end\n unless @message.empty?\n flash[:error] = @message\n redirect_to admin_products_path\n return\n end\n\n file_path = params[:attachment].path\n name = params[:attachment].original_filename\n directory = \"/tmp/data_import\"#{}\"#{DATASHIFT_PATH}\"\n\n # create the file path\n path = File.join(directory, name)\n\n # write the file\n FileUtils.mkdir_p(directory) unless File.directory?(directory)\n File.open(path, \"wb\") { |f| f.write(params[:attachment].read) }\n\n action_name = params[:action_name]\n case action_name\n when \"Import Products\"\n #ImportJob.delay.create_products(@seller, path, spree_current_user)\n ImportJob.create_products(@seller, path, spree_current_user)\n when \"Import Variants\"\n #ImportJob.delay.create_variants(@seller, path, spree_current_user)\n ImportJob.create_variants(@seller, path, spree_current_user)\n when \"Quantity Inflation\"\n @market_place = Spree::MarketPlace.find(params[:market_place_id])\n #ImportJob.delay.quantity_inflation(@seller, path, spree_current_user)\n ImportJob.quantity_inflation(@seller, @market_place, path, spree_current_user) \n when \"Import Images\"\n # Unzip uploaded zip file\n unless extract(path)\n @msg = \"Something went wrong while extracting file\"\n end\n\n # Get path of unziped xsl file and images folder\n img_file_path = path.gsub(\".zip\",\"\")+\"/upload_images.xls\"\n images_path = path.gsub(\".zip\",\"\")+\"/images/\"\n img_folder = path.gsub(\".zip\",\"\")\n\n # To remove first / from path\n img_file_path.slice!(0)\n images_path.slice!(0)\n img_folder.slice!(0)\n\n unless FileTest.exist?(img_file_path) && FileTest.exist?(images_path)\n @msg = \"File with name 'upload_images.xls' Or 'images' folder not found in uploaded .zip file Or Uploaded excel file is empty\"\n else\n ImportJob.create_images(@seller, img_file_path, images_path, spree_current_user)\n #ImportJob.delay.create_images(@seller, img_file_path, images_path, spree_current_user)\n end\n else\n @market_place = Spree::MarketPlace.find(params[:market_place_id])\n #ImportJob.delay.update_market_place_details(@seller, @market_place, path, spree_current_user)\n ImportJob.update_market_place_details(@seller, @market_place, path, spree_current_user)\n end\n # Remove tmp created folder\n dir_path = \"#{Rails.root}\"+\"#{directory}\"+\"/\"+\"#{(name.gsub('.zip', ''))}\"\n FileUtils.remove_dir(dir_path, force: true)\n if @msg.present?\n flash[:notice] = @msg\n else\n flash[:notice] = 'We are processing your data. We will email you final status after processing.'\n end\n redirect_to admin_products_path\n end", "def import_all\n EmailAccount.active.each do |email_account|\n log \"Importing #{email_account.username}\"\n email_account.loggers = self.loggers\n email_account.import_emails\n log \"Done importing #{email_account.username}\"\n end\n true\n end", "def import\n task = Task.create!(name: 'Preparing to import MARCXML records',\n service: Service::LOCAL_STORAGE,\n status: Task::Status::SUBMITTED)\n RecordSource.new.import_async(task)\n rescue => e\n handle_error(e)\n else\n flash['success'] = 'Import will begin momentarily.'\n ensure\n redirect_back fallback_location: tasks_path\n end", "def import_multiple_shared\n cloned_packages = Package.clone_packages(Package.shared.where(:id => params[:selected_records]), current_unit)\n save_results = cloned_packages.map(&:save)\n\n respond_to do |format|\n unless save_results.include?(false)\n flash[:notice] = \"Successfully imported packages\"\n else \n flash[:error] = \"Failed to import all or some packages\"\n end\n \n format.html { redirect_to shared_packages_path(current_unit) }\n end\n end", "def create_rows\n # Once rows are created from the json_date they cannot be recreated to avoid possible duplication.\n return false if import_rows.size > 0\n rows = JSON.parse(json_data)\n logger.info \"Import File: creating #{rows.count} import rows.\"\n # account for title row\n row_count = 2\n import_errors = []\n added_rows = []\n rows.each do |row|\n # new_row = ImportRow.new(import_file_id: import_file_id, title: row[\"title\"], json_data: row.to_json)\n new_row = ImportRow.new(import_file: self, title: row[\"title\"], json_data: row.to_json)\n logger.info \"Create Rows: creating row #{row_count} with title #{new_row.title}.\"\n if new_row.valid?\n added_rows << new_row\n else\n logger.error \"Create Rows: error on row #{row_count}: #{new_row.errors.full_messages}.\"\n import_errors << { \"Row #{row_count}\": new_row.errors.full_messages.join(\",\") }\n end\n row_count += 1\n end\n import_errors = validate_rows(import_errors,added_rows)\n logger.error \"Create Rows: row creation aborted. #{import_errors.count} validation errors.\"\n if import_errors.empty?\n save_rows(added_rows)\n else\n import_errors << { \"Rows #{row_count-1}\": \"Import rows not created. #{import_errors.count} validation errors.\" }\n end\n #reload\n import_errors\n end", "def build_and_save_imported_result(row_hash, user, competition)\n result = ExternalResult.preliminary.create(\n competitor: CompetitorFinder.new(competition).find_by(bib_number: row_hash[:bib_number]),\n points: row_hash[:points],\n details: row_hash[:details],\n status: row_hash[:status],\n entered_at: Time.current,\n entered_by: user\n )\n if result.persisted?\n true\n else\n result.errors.full_messages.each do |message|\n @errors << message\n end\n false\n end\n rescue ActiveRecord::RecordNotFound\n @errors << \"Unable to find registrant (#{row_hash})\"\n false\n end", "def import!\n return unless imported? or updated?\n\n Outgoing::Workcamp.transaction do\n import_changes.each do |change|\n change.apply(self)\n change.destroy\n end\n\n self.state = nil\n save!\n end\n end", "def import!\n return unless imported? or updated?\n\n Outgoing::Workcamp.transaction do\n import_changes.each do |change|\n change.apply(self)\n change.destroy\n end\n\n self.state = nil\n save!\n end\n end", "def upload_file\n return { success: false } unless can_upload?\n data, errors = build_data_array\n if errors.any? # save errors to model id any\n { success: false, error_messages_text: errors.flatten.join(\"\\n\") }\n else\n if self.class.model_class.import(data, recursive: true, validate: false) # bulk insert\n { success: true }\n else\n { success: false }# unknown error happened\n end\n end\n end", "def import_job\n return nil if completed?\n logger.info '** SieImport start'\n parse_and_import = Services::ImportSie.new(self)\n logger.info '** SieImport start - 1'\n if parse_and_import.read_and_save(sie_type)\n logger.info \"** SieImport #{id} parse/import returned ok, marking complete\"\n complete\n else\n logger.info \"** SieImport #{id} parse/import did NOT return ok, not marking complete\"\n end\n end", "def import(args={})\n @column_matches = args[:column_matches] if args[:column_matches]\n @has_header = args[:has_header] if args[:has_header]\n ImportPeopleJob.perform_now(self)\n true\n end", "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 persists_state_via_data_import?\n false\n end", "def create_import\n begin\n @computers = ComputerService.import(params[:computer],current_unit)\n rescue NoMethodError\n end\n \n unless @computers.nil?\n @total = @computers.count\n # Save each computer. If it doesn't save, leave it out of the array\n @computers = @computers.collect {|e| e if e.save}.compact\n end\n \n respond_to do |format|\n if @computers.nil?\n flash[:error] = \"There was a problem while parsing the plist\"\n format.html { redirect_to import_new_computer_path }\n elsif @computers.count > 0\n flash[:notice] = \"#{@computers.count} of #{@total} computers imported into #{@computers.first.computer_group}\"\n format.html { redirect_to computers_path }\n else\n flash[:warning] = \"Zero computers were imported. Did the ARD list have any members?\"\n format.html { redirect_to computers_path }\n end\n end\n end", "def import_stock_daily\n JdeItemAvailability.checking_stock_daily\n end", "def has_listed_files?\n file_count = 0\n all_valid = true\n files_file_path = FileLocations.files_file_path(@source_dir)\n ::CSV.foreach(files_file_path, headers: true).each do |csv_row|\n next if csv_row.blank?\n # Each file listed in FILES.csv should be valid\n row = strip_csv_row(csv_row)\n file_count += 1\n all_valid = all_valid && has_valid_file?(row, file_count)\n end\n # FILES.csv should have atleast 1 row\n unless file_count > 0\n @errors << \"Metadata file #{files_file_path} has no rows\"\n all_valid = false\n end\n # There should be no unverified files\n all_valid\n end", "def import\n Rails.logger.info(\"Results::ResultsFile #{Time.zone.now} import\")\n\n Event.transaction do\n event.disable_notification!\n book = ::Spreadsheet.open(source.path)\n book.worksheets.each do |worksheet|\n race = nil\n create_rows(worksheet)\n\n rows.each do |row|\n Rails.logger.debug(\"Results::ResultsFile #{Time.zone.now} row #{row.spreadsheet_row.to_a.join(', ')}\") if debug?\n if race?(row)\n race = find_or_create_race(row)\n # This row is also a result. I.e., no separate race header row.\n if usac_results_format?\n create_result(row, race)\n end\n elsif result?(row)\n create_result(row, race)\n end\n end\n end\n event.enable_notification!\n CombinedTimeTrialResults.create_or_destroy_for!(event)\n end\n Rails.logger.info(\"Results::ResultsFile #{Time.zone.now} import done\")\n end", "def import\n @imported_count = 0\n\n # Reject if the file attribute is nil or empty.\n if file.blank?\n errors.add(:base, \"No file is specified\") and return\n end\n\n CSV.foreach(file.path, headers: true, header_converters: :symbol) do |row|\n # Crete a user in memory.\n user = User.assign_from_row(row)\n\n # Try to save it in the database.\n if user.save\n @imported_count += 1\n else\n # The magic variable $. keeps track of the last line read in a file.\n errors.add(:base, \"Line #{$.} - #{user.errors.full_messages.join(', ')}\")\n end\n end\n end", "def import(rows)\n case rows\n when Array\n import_array(rows)\n when String\n labels, table = infer_csv_contents(rows, :headers => false)\n import(table)\n else\n raise ArgumentError, \"Don't know how to import data from #{rows.class}\"\n end\n true\n end", "def csv_import\n if can?(:>, \"4\")\n name = params[:kit_bom_bulk_operation][:file].original_filename\n file_status = Kitting::KitBomBulkOperation.find_by_file_path( name )\n repeat = 0\n until file_status.nil? do\n repeat = 1 if repeat == 0\n file_status = Kitting::KitBomBulkOperation.find_by_file_path(\"#{name}(#{repeat})\")\n repeat +=1\n end\n @part_cup_count_upload = current_customer.kit_bom_bulk_operations.create(:operation_type => \"PART CUP COUNT\",:file_path => name,:status => \"UPLOADING\")\n directory = APP_CONFIG[\"csv_import_path\"]\n file_path = repeat == 0 ? name : \"#{name}(#{repeat-1})\"\n if @part_cup_count_upload.update_attributes(:file_path => file_path,:status => \"UPLOADED\")\n path = File.join(directory, file_path)\n @file_status = File.open(path, \"wb\") { |f| f.write(params[:kit_bom_bulk_operation][:file].read) }\n if File.exists?(File.join(directory,@part_cup_count_upload.file_path))\n # Check if Header present and is in correct format\n csv_text = File.read(File.join(directory,@part_cup_count_upload.file_path))\n header = CSV.parse_line(csv_text)\n if header == [\"PART NUMBER\", \"LARGE CUP COUNT\", \"MEDIUM CUP COUNT\", \"SMALL CUP COUNT\"]\n flash[:success] = \"File Uploaded and will be processed Shortly.\"\n redirect_to upload_parts_path\n else\n flash[:error] = \"INVALID HEADERS/DOWNLOAD SAMPLE CSV FOR HEADER FORMAT.\"\n FileUtils.rm_rf File.join(directory,@part_cup_count_upload.file_path)\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n flash[:error] = \"INVALID FILE FORMAT.\"\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n flash[:error] = \"INVALID FILE FORMAT.\"\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end", "def import(file)\n spreadsheet = ModelCommon.open_spreadsheet(file)\n return '<p class = \"alert alert-error\">Try to do the following instructions:<br/>\n 1. Please save as the file to excel format.<br/>\n 2. Make sure MOAS data in the first sheet.<br/>\n 3. Header is in the first row.</p>' if spreadsheet.nil?\n\n header = downcase_array_key spreadsheet.row(1)\n\n # verify header, raise error if not map\n no_failed_hearders = MOASHeader.verify_header(header, @language)\n\n return ('<p class = \"alert alert-error\">Below is the missing header titles list. Please update header title(s) of the excel file || contact your administrator<br/>' << no_failed_hearders.to_s << '</p>') if no_failed_hearders != true\n return ('<p class = \"alert alert-error\">No data in excel file. Please re-check!</p>') if spreadsheet.last_row <= 1\n\n # begin transaction\n begin\n connection = Connection.new\n connection.open_connection_in_config\n connection.con.autocommit false\n\n # 1. DELETE ALL RECORDS\n connection.execute_sql_statement \"delete from #{@table}\"\n pstmt = connection.con.prepare(\"insert into #{@table}(golivedate,appstatus,sku,shorttitle,longtitle,gender,agefrommonths,agetomonths,skill,curriculum,longdesc,platformcompatibility,specialmsg,teaches,licenselegal,licnonlic,license,language,pricetier,category,us,ca,uk,ie,au,row,fr_fr,fr_ca,fr_row) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\")\n (2..spreadsheet.last_row).each do |i|\n row = Hash[[header, spreadsheet.row(i)].transpose]\n\n # 2. INSERT DATA TO DATABASE\n insert_data pstmt, row\n end\n\n # 3. UPDATE DATA FOR LOCALE\n update_locale connection\n connection.con.commit # commit transaction\n\n return '<p class = \"alert alert-success\">MOAS file is imported successfully!</p>'\n rescue => e\n connection.con.rollback # rollback transaction\n return '<p class = \"alert alert-error\">PLEASE SELECT CORRECT TABLE. <br/>' << e.message << '</p>'\n ensure\n connection.close_connection if connection\n end # end begin transaction\n end", "def checkpoints_from_csv(fname)\n begin\n lines = CSV.read(fname)\n header = lines.shift\n # check header\n if header == Checkpoint::CsvColumns\n # import data\n lines.each do |line|\n checkpoints.create(\n location: Location.find_by_name_and_image_id(line[0], Image.id_from_filename(line[1])),\n part_id: Part.find_or_create_by_number(number: line[2], kind: line[3], description: line[4]).id)\n end\n else\n puts \"ERROR: Expecting ''#{Item::CsvColumns.join(',')}' on '#{fname}'. Skipping import of Checkpoints.\"\n false\n end\n rescue Errno::EISDIR\n puts \"ERROR: '#{fname}' is a directory. Checkpoints not imported.\"\n rescue Errno::EACCES\n puts \"ERROR: Permission denied on '#{fname}'. Checkpoints not imported.\"\n rescue Errno::ENOENT\n puts \"ERROR: '#{fname}' not found. Checkpoints not imported.\"\n end\n end", "def import\n begin\n movements = Roo::Excelx.new(params[:file].path, file_warning: :ignore)\n export_file_path = [Rails.root, \"public\", \"cartola_correcta.xls\"].join(\"/\")\n\n if File.file?(export_file_path)\n movements_old = Roo::Spreadsheet.open(export_file_path, extension: :xls)\n if movements.last_row < movements_old.last_row\n especial_movement(movements,movements_old)\n else\n validate_movement(movements,movements_old)\n end\n else\n create_movement(movements)\n end\n return render json: {status: true}\n rescue Exception => e\n puts e\n return false\n end\n end", "def import_efforts\n authorize @event\n file_url = FileStore.public_upload('imports', params[:file], current_user.id)\n if file_url\n if Rails.env.production?\n ImportEffortsJob.perform_later(file_url, @event, current_user.id, params.slice(:time_format, :with_times, :with_status))\n render json: {message: 'Import in progress.'}\n else\n ImportEffortsJob.perform_now(file_url, @event, current_user.id, params.slice(:time_format, :with_times, :with_status))\n render json: {message: 'Import complete.'}\n end\n else\n render json: {errors: ['Import file too large.']}, status: :bad_request\n end\n end", "def import\n url = \"#{self.url}/import?auth=#{self.authtoken}\"\n status, response = rest_post( url, nil )\n if ok?( status )\n return status, response['new_count'], response['update_count'], response['duplicate_count'], response['error_count']\n end\n return status, 0, 0, 0, 0\n end", "def import(semester_to_import)\n if not semester_to_import\n errors.add(:semester_to_import,\"Was given a nil semester to import.\")\n return false\n end\n\n failure = false\n error_message = nil\n #raise ActiveRecord::Rollback\n\n ActiveRecord::Base.transaction do\n ptainstructors = Ptainstructor.find_all_by_semester_id(semester_to_import.id)\n teachers = Teacher.find_all_by_semester_id(semester_to_import.id)\n students = Student.find_all_by_semester_id(semester_to_import.id)\n courses = Course.find_all_by_semester_id(semester_to_import.id)\n\n ptainstructors_cloned = Hash.new\n teachers_cloned = Hash.new\n courses.each do |oldcourse|\n newcourse = oldcourse.dup\n oldteacher = Teacher.find_by_id(oldcourse.teacher_id)\n oldptainstructor = Ptainstructor.find_by_id(oldcourse.ptainstructor_id)\n raise ActiveRecord::Rollback unless duplicate_teacher_for_course(newcourse, oldteacher,teachers_cloned)\n raise ActiveRecord::Rollback unless duplicate_ptainstructor_for_course(newcourse,oldptainstructor,ptainstructors_cloned)\n newcourse.semester_id = self.id\n raise ActiveRecord::Rollback unless newcourse.save\n end\n\n ptainstructors.each do |ptainstructor|\n if ptainstructors_cloned[ptainstructor.id];next;end\n raise ActiveRecord::Rollback unless duplicate_ptainstructor(ptainstructor)\n end\n\n teachers.each do |teacher|\n if teachers_cloned[teacher.id];next;end\n raise ActiveRecord::Rollback unless duplicate_teacher(teacher,teachers_cloned)\n end\n\n students.each do |student|\n raise ActiveRecord::Rollback unless duplicate_student(student,teachers_cloned)\n end\n end\n end", "def apply_imports\n if session[:imports]\n begin\n session[:imports].apply\n rescue => bang\n add_flash(_(\"Error during 'apply': %{error}\") % {:error => bang}, :error)\n @sb[:show_button] = true\n else\n add_flash(_(\"Records were successfully imported\"))\n @sb[:show_button] = false\n session[:imports] = @sb[:imports] = nil\n end\n else\n add_flash(_(\"Use the Choose file button to locate CSV file\"), :error)\n @sb[:show_button] = true\n end\n flash_to_session\n redirect_to(:action => 'explorer', :no_refresh => true)\n end", "def process_loaded_data(_result)\n true\n end", "def import_learners_from_csv\n assessment_id = params[:user][:assessment_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n \n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/assessments/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n end", "def create_import\n begin\n @computers = ComputerService.import(params[:computer],current_unit)\n rescue NoMethodError\n e = \"Please select a plist file\"\n rescue => e\n end\n \n unless @computers.nil?\n @total = @computers.count\n # Save each computer. If it doesn't save, leave it out of the array\n @computers = @computers.collect {|e| e if e.save}.compact\n end\n \n respond_to do |format|\n if @computers.nil?\n flash[:error] = \"There was a problem while parsing the plist: #{e}\"\n format.html { redirect_to import_new_computer_path(current_unit) }\n elsif @computers.count > 0\n flash[:notice] = \"#{@computers.count} of #{@total} computers imported into #{@computers.first.computer_group}\"\n format.html { redirect_to computers_path(current_unit) }\n else\n flash[:warning] = \"Zero computers were imported. Did the ARD list have any members?\"\n format.html { redirect_to computers_path(current_unit) }\n end\n end\n end", "def import_data path, file_type\n if file_type == :csv\n csv_parse(path).each { |params| Product.new(params).save }\n elsif file_type == :xls\n #xls_parse(path)\n end\nend", "def import\n MoviesImportService.new(csv_file, current_user).call\n redirect_to metrics_movies_url, notice: 'Movies were successfully imported.'\n end", "def run\n start_time = Time.now\n\n setup\n\n importer_run.update_attributes( started_at: start_time,\n source_model: source_model.name,\n destination_model: destination_model.name,\n importer_version: VERSION )\n\n # get a total count of records to process, bail out if none are found\n count = base_query(false).count\n\n logger.info \"\"\n if count == 0\n logger.info \"no #{source_model.name.pluralize} to import, exiting\"\n return\n end\n\n logger.info \"Starting import from #{source_model.table_name} into #{destination_model.name}...\"\n\n # step through the records in batches\n (0..count).step(batch_size) do |offset|\n thread_pool.schedule do\n with_connections do\n batch_elapsed_time = Benchmark.realtime do\n logger.info \"Importing from #{source_model.table_name} into #{destination_model.name} (#{offset / batch_size + 1}/#{count / batch_size + 1})\"\n\n # wipe the slate from the last batch\n prepare_for_new_batch\n\n benchmarks[:source_db] << Benchmark.realtime do\n # grab this batch of records from source\n fetch_records(offset)\n end\n\n # bail if there aren't any\n next if records.empty?\n\n logger.info \" #{records.count} source records fetched in #{benchmarks[:source_db].last}s\"\n if source_order_by\n logger.info \" #{source_order_by}: from #{records.first.read_attribute(source_order_by)} to #{records.last.read_attribute(source_order_by)}\"\n end\n\n # process this batch of records\n process_batch(records)\n\n logger.info \" #{records.count} records processed in #{benchmarks[:processing].last}s\"\n\n insert_and_update_batch\n end\n logger.info \" batch processed in #{batch_elapsed_time}s\"\n end\n end\n end\n thread_pool.shutdown\n \n print_validation_errors\n\n logger.info \"-------------------------------------------------\"\n logger.info \"Processing: #{benchmarks[:processing].sum}s total, #{benchmarks[:processing].sum / count}s per record\"\n logger.info \"source Database: #{benchmarks[:source_db].sum}s total, #{benchmarks[:source_db].sum / count}s per record\"\n logger.info \"dest Database: #{benchmarks[:destination_db].sum}s total, #{benchmarks[:destination_db].sum / count}s per record\"\n logger.info \"Total: #{Time.now - start_time}s elapsed\"\n importer_run.update_attributes( completed_at: Time.now )\n rescue Exception => e\n importer_run.update_attributes( error_trace: \"#{e.class} - #{e.message}\\n#{e.backtrace.join(\"\\n\")}\" )\n raise e\n ensure\n importer_run.update_attributes( records_created: records_created,\n records_updated: records_updated,\n duration: ((Time.now - start_time) * 1000).round,\n validation_errors: validation_errors )\n end", "def import_inventory_file()\n @worksheet_products.each { |row|\n if(@inventory_row = build_inventory_hash(row))\n import_inventory()\n end\n }\n end", "def has_imported_group?(source_group_name, wait: QA::Support::WaitForRequests::DEFAULT_MAX_WAIT_TIME)\n within_element(:import_item, source_group: source_group_name) do\n has_element?(:import_status_indicator, text: \"Complete\", wait: wait)\n end\n end", "def import_categories\n market_place = Spree::MarketPlace.find_by_id(params[:market_place])\n case market_place.code\n when 'qoo10'\n smp = Spree::SellerMarketPlace.where(\"market_place_id=? AND api_key IS NOT NULL\", params[:market_place]).try(:first)\n @message = sync_all_category_qoo10(smp)\n when 'lazada', 'zalora'\n if !(File.extname(params[:file].original_filename) == \".csv\")\n redirect_to sync_category_admin_taxonomies_url, notice: \"Please upload a valid csv file\"\n return\n else\n @message = Spree::MarketPlaceCategoryList.import(params[:file],params[:market_place].to_i)\n end\n end\n \tredirect_to sync_category_admin_taxonomies_url, notice: @message\n end", "def process_and_upload_csv\n\n @has_data = get_data_from_db do |data|\n formatted_data = format_data(data)\n c_add formatted_data\n end\n\n if @has_data\n zip_folder\n upload_to_s3\n delete_local_files\n end\n\n end", "def handle_import\n set_csv\n if check_csv_ok?\n success, alert = Participant.import(@csv, params[:project_id])\n unless alert.empty?\n flash[:danger] = alert\n end\n unless success.empty?\n flash[:success] = \"Imported participants: <br/>\" + success\n end\n end\n end", "def valid?\n @failure = nil\n\n item.validate\n column_errors = collect_column_errors\n\n if column_errors.values.flatten.any?\n @failure = CSVImport::Failure.new(row, column_errors)\n end\n\n ! @failure\n end", "def successfully_imported_records\n imported_records.where(success: true)\n end", "def test_import\n Log.remove(ArtworkDataPlugin.log_name)\n \n query = 'SELECT * FROM artwork'\n sth = $dbh_pg.execute(query)\n\n while row = sth.fetch\n ArtworkDataPlugin.new('data', row)\n end\n \n ArtworkDataPlugin.flush_logs\n Log.test_regression(ArtworkDataPlugin.log_name)\n ArtworkDataPlugin.write_report\n IdStore.write_report\n end", "def submit_import\n book = OpenlibraryImportByIsbn.run(isbn: import_params[:isbn])\n\n unless book.valid?\n return redirect_to import_by_isbn_books_url, flash: { error: \"Import error\" }\n end\n\n redirect_to book.result\n end", "def start_importation!\n if can?(:import)\n importing!\n Courses::ImportJob.perform_later self\n end\n end", "def import\n scan_files\n # import non-imported files\n\tto_be_executed = Execution.where(:passerelle_id => @passerelle.id, :statut => \"nex\").order('created_at')\n\tto_be_executed.each{ |execution|\n\t\texecution.statut = \"ece\" #note : En Cours d'Execution\n\t\texecution.save!\n\t}\n\tto_be_executed.each{ |execution|\n\t\n\t\n\tbegin\n\t import_exe execution\n\t statut = \"ok\"\n\trescue Exception => e\n\t\t @rapport_import << \"Fail<\\br>\"\n\t\t @rapport_import << \"Error message => : #{e.message}<\\br>\"\n\t\t @rapport_import << \"Error backtrace => #{e.backtrace}<\\br>\"\n\t\t Logger.send(\"warn\",\"[Passerelle] Import FAIL !\")\n\t\t Logger.send(\"warn\",\"[Passerelle] Rapport : #{@rapport_import}\")\n\t\t statut = \"err\"\n\tend\n\t\t\n\t\texe_to_save = Execution.find execution.id\n\t\texe_to_save.statut = statut\n\t\texe_to_save.description = @result[:description]\n\t\texe_to_save.save!\n\t}\n @passerelle.updated_at = DateTime.now\n @passerelle.save!\n\t\n\tres = Hash.new\n\tres[\"updated\"] = true\n\t# res[\"message\"] = \"desc\"\n\t\n\treturn res\n end", "def import\n csv = CSV.parse(file, headers: true)\n ActiveRecord::Base.transaction do\n csv.each do |product|\n begin\n category = Category.find_or_create_by(title: product[1])\n product_obj = Product.find_or_create_by(pid: product[0])\n product_obj.update(name: product[2], price: product[3].to_i, category_id: category.id)\n rescue => e\n Rails.logger.error \"Error: Error in creating following products - #{product.inspect} - #{e.message} - #{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end", "def ready_to_create?\n valid? && processed? && import_level_ok?\n end", "def import\n begin\n Mapspace.import(params[:file])\n redirect_to mapspaces_path, notice: \"Mapspace Data Loaded.\"\n rescue\n redirect_to mapspaces_path, notice: \"Invalid CSV file format.\"\n end\n end", "def import(task = nil)\n raise 'Another import is in progress.' unless self.class.import_authorized?\n\n task_args = {\n name: 'Importing MARCXML records',\n service: Service::LOCAL_STORAGE,\n status: Task::Status::RUNNING\n }\n if task\n Rails.logger.info('RecordSource.import(): updating provided Task')\n task.update!(task_args)\n else\n Rails.logger.info('RecordSource.import(): creating new Task')\n task = Task.create!(task_args)\n end\n\n begin\n config = Configuration.instance\n client = Aws::S3::Client.new\n\n num_invalid_files = file_index = record_index = 0\n batch = []\n client.list_objects(\n bucket: config.book_bucket,\n prefix: config.book_key_prefix).each do |list_response|\n list_response.contents.each do |object|\n next unless object.key.downcase.end_with?('.xml')\n\n Rails.logger.debug(\"RecordSource.import(): getting object #{object.key}\")\n\n get_response = client.get_object(\n bucket: config.book_bucket,\n key: object.key)\n data = get_response.body.read\n\n begin\n doc = Nokogiri::XML(data, &:noblanks)\n doc.encoding = 'utf-8'\n\n doc.xpath('//marc:record', MARCXML_NAMESPACES).each do |record|\n Rails.logger.debug(\"RecordSource.import(): reading record #{record_index}\")\n\n batch << Book.params_from_marcxml_record(object.key, record)\n upsert_if_necessary(batch)\n\n record_index += 1\n if record_index % 100 == 0\n task.update(name: \"Importing MARCXML records: \"\\\n \"scanned #{record_index} records in #{file_index + 1} files \"\\\n \"(no progress available)\")\n print \"#{task.name.ljust(80)}\\r\"\n end\n end\n rescue => e\n # This is probably an undefined namespace prefix error, which means\n # it's either an invalid MARCXML file or, more likely, a non-\n # MARCXML XML file, which is fine.\n num_invalid_files += 1\n Rails.logger.info(\"#{object}: #{e}\")\n ensure\n file_index += 1\n end\n end\n end\n upsert(batch)\n rescue SystemExit, Interrupt => e\n task.update(name: 'Import aborted',\n status: Task::Status::FAILED)\n puts task.name\n raise e\n rescue => e\n task.update(name: \"Import failed: #{e}\",\n status: Task::Status::FAILED)\n puts task.name\n puts e.backtrace\n else\n task.update(name: sprintf('Importing MARCXML records: %d records added, '\\\n 'updated, or unchanged; %d skipped files',\n record_index, num_invalid_files),\n status: Task::Status::SUCCEEDED)\n puts task.name\n ensure\n Book.analyze_table\n end\n end", "def do_user_status_csv_import\n if params[:import].nil?\n flash[:message] = 'Please upload a csv file'\n redirect_to admin_user_status_csv_import_path\n return\n end\n file = CSV.parse(params[:import][:csv].read)\n @failures = []\n file.each do |row|\n user_id = row[0]\n # If the user id isn't actually a number, skip this row\n # because that means it is probably a header or a blank line\n # http://stackoverflow.com/questions/10577783/ruby-checking-if-a-string-can-be-converted-to-an-integer\n begin\n user_id = Integer user_id\n rescue\n next\n end\n\n begin\n user = User.find(user_id)\n user.exclude_from_reporting = row[1]\n user.relationship_manager = row[2]\n user.associated_program = row[3]\n user.active_status = row[4]\n user.save!\n rescue\n @failures << user_id\n end\n end\n end", "def import\n if params[:location_id]\n @location = Location.find(params[:location_id])\n elsif params[:resource_id]\n @parent_resource = Resource.find(params[:resource_id])\n @location = @parent_resource.location\n end\n\n command = ImportArchivesspaceEadCommand.new(\n params[:files], @parent_resource, @location, current_user,\n request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n redirect_back fallback_location: location_url(@location)\n else\n if command.object.length > 0\n flash['success'] = \"Imported #{command.object.length} resource(s).\"\n else\n flash['notice'] = 'Unable to detect an ArchivesSpace EAD XML file in '\\\n 'any of the uploaded files.'\n end\n redirect_back fallback_location: location_url(@location)\n end\n end", "def actively_importing?(repository)\n return false unless repository.importing? || repository.pre_importing?\n return false unless external_state_matches_migration_state?(repository)\n\n true\n end", "def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.products.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.products.url)\n end\n\n\n # Send file to fnz module using import api\n response = RestClient.post Fnz::HOST + '/api/v0/imports',\n app_key: Fnz::API_KEY,\n import: {\n object: 'Product',\n padma_id: self.import.account.name,\n upload: csv\n }\n if response.code == 201\n # If import was created successfully create a product importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Fnz::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end", "def import!(&block)\n start_time = Time.at(Time.now.to_i.floor)\n yield\n raise LoadError.new(\"No data found\") unless where(\"updated_at >= ?\", start_time).exists?\n where(\"updated_at < ?\", start_time).imported.update_all(status: STATUS_REMOVED)\n end", "def apply_imports\n assert_privileges(\"ops_settings\")\n\n if session[:imports]\n begin\n session[:imports].apply\n rescue => bang\n add_flash(_(\"Error during 'apply': %{error}\") % {:error => bang}, :error)\n @sb[:show_button] = true\n else\n add_flash(_(\"Records were successfully imported\"))\n @sb[:show_button] = false\n session[:imports] = @sb[:imports] = nil\n end\n else\n add_flash(_(\"Use the Choose file button to locate CSV file\"), :error)\n @sb[:show_button] = true\n end\n flash_to_session\n redirect_to(:action => 'explorer', :no_refresh => true)\n end", "def import()\n\n Enterprise.find_each do |enterprises|\n\n url = 'http://compras.dados.gov.br/contratos/v1/contratos.csv?cnpj_contratada='\n begin\n data = open(url+enterprises.cnpj).read\n csv = CSV.parse(data, :headers => true, :encoding => 'ISO-8859-1')\n\n csv.each_with_index do |row, i|\n payment = Payment.new\n payment.identifier = check_nil_ascii(row[0])\n payment.process_number = check_nil_ascii(row[10])\n payment.initial_value = check_value(row[16])\n payment.sign_date = check_date(row[12])\n payment.start_date = check_date(row[14])\n payment.end_date = check_date(row[15])\n payment.enterprise = enterprises\n enterprises.payments_sum = enterprises.payments_sum + payment.initial_value\n check_and_save(enterprises)\n check_and_save(payment)\n end\n rescue\n constante = constante + 1\n end\n end\n end", "def process\n uploaded_workbook = Spreadsheet.open self.path\n @records_matched = 0\n @records_updated = 0\n @records_failed = 0\n @failed_queries = 0\n @skipped_records = 0\n\n product_sheet = uploaded_workbook.worksheet(0)\n perform(product_sheet)\n\n if not uploaded_workbook.worksheet(1).nil?\n variant_sheet = uploaded_workbook.worksheet(1)\n perform(variant_sheet)\n end\nend", "def import_users\n @file = params[:upload]\n return render_error :upload unless @file && @file.try(:content_type)\n\n if @file.content_type =~ /^text\\/csv|^application\\/vnd.ms-excel/\n importer = Importing::Importer.new(@file.read)\n\n if importer.failed?\n # if failed\n Rails.logger.warn \"*** Import failed: #{importer.error.message}\\nBacktrace: #{importer.error.backtrace[0,5].join(\"\\n\")}\"\n render_error :import\n else\n # \"full_name\", \"abbreviation\", \"email\", \"status\", \"staff_number\", \"group\"\n @records = importer.results\n # puts @records.inspect\n\n @records.reject! { |c| c.blank? }\n\n count = 0\n\n require_headers = [\"full_name\", \"abbreviation\", \"email\", \"status\", \"staff_number\", \"group\"]\n\n headers = importer.headers\n\n if @records.length > 0\n headers = @records.first.keys\n end\n\n if headers.nil?\n render_error :header\n return\n end\n\n # headers.each do |e|\n # unless require_headers.index(e)\n # render_error :header\n # return\n # end\n # end\n\n result = true\n headers.each do |h|\n result = require_headers.include?(h.to_s)\n unless result\n render_error :header\n return\n end\n end\n\n @records.each do |user|\n next if user.blank?\n\n puts user.inspect\n\n created_user = User.new({\n full_name: user[:full_name],\n abbreviation: user[:abbreviation],\n email: user[:email],\n username: user[:abbreviation],\n password: \"1qazxsw2\",\n password_confirmation: \"1qazxsw2\",\n status: user[:status],\n staff_number: user[:staff_number],\n organization_id: current_user.organization_id\n })\n group_name = user[:group].downcase\n group_id = UserGroup.find_by_sql(\"Select * from user_groups where lower(name) ='#{group_name}'\")[0].id\n \n\n created_user.user_group_ids = group_id\n\n # created_user.skip_confirmation!\n count += 1 if created_user.save\n puts created_user.errors.inspect\n end\n \n flash[:notice] = \"There are #{count} users have been created.\"\n redirect_to organization_users_path(current_user.organization_id)\n end\n else\n render_error :content_type, :type => @file.content_type\n end\n end", "def import_csv_files(users_csv_filename, term_enrollment_csv_files)\n import_proxy = CanvasSisImportProxy.new\n if import_proxy.import_users(users_csv_filename)\n logger.warn(\"User import succeeded\")\n term_enrollment_csv_files.each do |term_id, csv_filename|\n if import_proxy.import_all_term_enrollments(term_id, csv_filename)\n logger.warn(\"Enrollment import succeeded\")\n end\n end\n end\n end", "def verify_required_data_files!\n unless File.exists?(\"#{@working_directory}/drupal-filesystem.tar.gz\") && File.exists?(\"#{@working_directory}/drupal-db.sql.gz\")\n raise StandardError.new(\"Cannot locate both 'drupal-filesystem.tar.gz' and 'drupal-db.sql.gz' in directory '#{@working_directory}'.\")\n end\n end", "def can_launch_ingest?\n case study_file.file_type\n when /Matrix/\n # expression matrices currently cannot be ingested in parallel due to constraints around validating cell names\n # this block ensures that all other matrices have all cell names ingested and at least one gene entry, which\n # ensures the matrix has validated\n other_matrix_files = study.expression_matrices.where(:id.ne => study_file.id)\n # only check other matrix files of the same type, as this is what will be checked when validating\n similar_matrix_files = other_matrix_files.select {|matrix| matrix.is_raw_counts_file? == study_file.is_raw_counts_file?}\n similar_matrix_files.each do |matrix_file|\n if matrix_file.parsing?\n matrix_cells = study.expression_matrix_cells(matrix_file)\n matrix_genes = Gene.where(study_id: study.id, study_file_id: matrix_file.id)\n if !matrix_cells || matrix_genes.empty?\n # return false if matrix hasn't validated, unless the other matrix was uploaded after this file\n # this is to prevent multiple matrix files queueing up and blocking each other from initiating PAPI jobs\n # also, a timeout 24 hours is added to prevent all matrix files from queueing infinitely if one\n # fails to launch an ingest job for some reason\n if matrix_file.created_at < study_file.created_at && matrix_file.created_at > 24.hours.ago\n return false\n end\n end\n end\n end\n true\n else\n # no other file types currently are gated for launching ingest\n true\n end\n end", "def import\n att_file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n enr_file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n ili_file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n EnrollmentImporter.new(@enroll_file).import_csv unless @enroll_file.blank?\n AttendanceImporter.new(@attendance_file).import_csv unless @attendance_file.blank?\n IliImporter.new(@ili_file).import_csv unless @ili_file.blank?\n File.rename(@enroll_file, enr_file_name) unless @enroll_file.blank?\n File.rename(@attendance_file, att_file_name) unless @attendance_file.blank?\n File.rename(@ili_file, ili_file_name) unless @ili_file.blank?\n FileUtils.mv(enr_file_name, File.join(@dir, \"archive\")) unless @enroll_file.blank?\n FileUtils.mv(att_file_name, File.join(@dir, \"archive\")) unless @attendance_file.blank?\n FileUtils.mv(ili_file_name, File.join(@dir, \"archive\")) unless @ili_file.blank?\n end", "def validate_folio_xml_import(options)\n options['report_file'] ||= config.compute_glob_pattern(\n 'folio_import_dir/validation_report_file'\n )\n reset_validation_report(options, 'validate_folio_xml_import')\n file_specs = config.compute_validation_file_specs(\n primary: 'folio_import_dir/all_files', # for reporting only\n folio_xml_sources: options['input'] || 'folio_import_dir/xml_files',\n imported_at_files: 'folio_import_dir/at_files',\n imported_repositext_files: 'folio_import_dir/repositext_files',\n )\n validation_options = {\n 'folio_xml_parser_class' => config.kramdown_parser(:folio_xml),\n 'kramdown_converter_method_name' => config.kramdown_converter_method(:to_at),\n 'kramdown_parser_class' => config.kramdown_parser(:kramdown),\n 'kramdown_validation_parser_class' => config.kramdown_parser(:kramdown_validation)\n }.merge(options)\n if options['run_options'].include?('pre_import')\n Repositext::Validation::FolioXmlPreImport.new(file_specs, validation_options).run\n end\n if options['run_options'].include?('post_import')\n Repositext::Validation::FolioXmlPostImport.new(file_specs, validation_options).run\n end\n end", "def check_import(mode, address_names) #, address_emails\n\n err_msgs = []\n\n # Existing Addresss\n unless self.id.nil? or self.id == 0 or self.id == ''\n if mode == 'add'\n err_msgs << I18n.t('address.import.dont_specify_id')\n else\n begin\n org_address = Address.find(self.id)\n rescue\n end\n if org_address.nil?\n err_msgs << I18n.t('address.import.not_found')\n end\n end\n end\n\n # Requierd\n if self.name.nil? or self.name.empty?\n err_msgs << Address.human_attribute_name('name') + I18n.t('msg.is_required')\n end\n\n # Groups\n unless self.groups.nil? or self.groups.empty?\n\n if (/^|([0-9]+|)+$/ =~ self.groups) == 0\n\n self.get_groups_a.each do |group_id|\n group = Group.find_by_id(group_id)\n if group.nil?\n err_msgs << I18n.t('address.import.not_valid_groups') + ': '+group_id.to_s\n break\n end\n end\n else\n err_msgs << I18n.t('address.import.invalid_groups_format')\n end\n end\n\n # Teams\n unless self.teams.nil? or self.teams.empty?\n\n if (/^|([0-9]+|)+$/ =~ self.teams) == 0\n\n self.get_teams_a.each do |team_id|\n team = Team.find_by_id(team_id)\n if team.nil?\n err_msgs << I18n.t('address.import.not_valid_teams') + ': '+team_id.to_s\n break\n end\n end\n\n else\n err_msgs << I18n.t('address.import.invalid_teams_format')\n end\n end\n\n return err_msgs\n end", "def idml_import_consistent?(idml_import_at_file, content_at_file)\n idml_import_at_doc = Kramdown::Document.new(\n idml_import_at_file.contents,\n :input => 'KramdownRepositext'\n )\n content_at_doc = Kramdown::Document.new(\n content_at_file.contents,\n :input => 'KramdownRepositext'\n )\n\n idml_import_at_plain_text = idml_import_at_doc.to_plain_text\n content_at_plain_text = content_at_doc.to_plain_text\n\n # A.D., A.M., and B.C. are lower cased after record ids were merged\n # as part of the import command. We lower case them in both to\n # avoid getting validation errors from this.\n idml_import_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n idml_import_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n idml_import_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n content_at_plain_text.gsub!(/A\\.D\\./, 'a.d.')\n content_at_plain_text.gsub!(/A\\.M\\./, 'a.m.')\n content_at_plain_text.gsub!(/B\\.C\\./, 'b.c.')\n\n diffs = Suspension::StringComparer.compare(idml_import_at_plain_text, content_at_plain_text)\n\n if diffs.empty?\n Outcome.new(true, nil)\n else\n Outcome.new(\n false, nil, [],\n diffs.map { |diff|\n Reportable.error(\n {\n filename: content_at_file.filename,\n corr_filename: idml_import_at_file.filename,\n },\n ['Plain text diference between idml_import_at and content_at', diff]\n )\n }\n )\n end\n end", "def validate_import_mappings\n import_field_mappings.each do |field|\n if REQUIRED_FIELDS.include?(field.key) && field.value.all?(&:blank?)\n self.not_ready!\n return false\n end\n end\n self.ready!\n return true\n end" ]
[ "0.65212786", "0.6429779", "0.63465726", "0.63124794", "0.6290406", "0.62252414", "0.6194359", "0.6144693", "0.6131027", "0.6080742", "0.6058366", "0.5913003", "0.5905774", "0.58662623", "0.5775019", "0.5770703", "0.5743499", "0.5722491", "0.5658417", "0.5636622", "0.56263375", "0.5616107", "0.55880433", "0.5526427", "0.54764104", "0.5460884", "0.54395825", "0.54373604", "0.543078", "0.5425025", "0.54232484", "0.5415947", "0.541294", "0.53977305", "0.5379985", "0.53770757", "0.53711414", "0.5367602", "0.5356278", "0.5348825", "0.5330874", "0.53257304", "0.5313413", "0.5313413", "0.5306322", "0.5305573", "0.5300879", "0.52974916", "0.5294955", "0.52818704", "0.5276106", "0.5254048", "0.5243962", "0.5243378", "0.52333724", "0.52283186", "0.52178276", "0.5211729", "0.52015996", "0.51881963", "0.5177467", "0.51711756", "0.5168712", "0.51513094", "0.5143311", "0.5130966", "0.51158506", "0.5115339", "0.51129663", "0.511117", "0.5103902", "0.5102632", "0.5092075", "0.5091197", "0.50910926", "0.50832254", "0.5082091", "0.50797224", "0.5077317", "0.50734556", "0.5072998", "0.5057042", "0.5054982", "0.50509095", "0.50508356", "0.5042671", "0.5037494", "0.50373757", "0.50346947", "0.5032409", "0.5027934", "0.5025116", "0.5023352", "0.50204194", "0.5013332", "0.50058854", "0.50028986", "0.5002605", "0.49982128", "0.49939573", "0.49864724" ]
0.0
-1
GET /customers GET /customers.json
def index @customers = [] #take params from search on Index view, or if no search, assume todays date #send to model to apply SEARCH function, which retrieves matching records and requests only CONFIRMED records if params[:customer] @customers = Customer.search(params[:customer]) if @customers.any? params[:customer]= [] @customers else params[:customer]= [] @customers = 0 end else @customers = 0 params[:customer]= [] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customers\n ShopifyAPI::Customer.all\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n return data\n end", "def show\r\n @customer = Customer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @customer }\r\n end\r\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: CustomersDatatable.new(view_context) }\n end\n @customers = Customer.all\n end", "def customers\n Easybill::Api::Customers\n end", "def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end", "def index\n respond_to do |format|\n format.html { @customers = Customer.all }\n format.json { @customers = Customer.order(:name) }\n end\n end", "def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end", "def show\n @customers = Customer.all\n end", "def show\n @customers = Customer.all\n end", "def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end", "def list_customers(opts = {})\n operation('ListCustomers')\n .add(opts)\n\n run\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_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 show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end", "def index\n\t@customers = Customer.all()\n end", "def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def all(options = { page: 1, page_size: 10 })\n response = JSON.parse(@client.get('Customers', options).body)\n customers = response.key?('Items') ? response['Items'] : []\n customers.map { |attributes| Unleashed::Customer.new(@client, attributes) }\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def get_customer(opts = {})\n data, _status_code, _headers = get_customer_with_http_info(opts)\n data\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def show\n @customer = customers.find(params[:id])\n end", "def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def index\n @my_customers = MyCustomer.all\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def index\n @customers = Customer.where(user_id: current_user.id)\n end", "def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def all_customers\n if @customer_records_file.nil? || !File.exist?(@customer_records_file)\n raise ArgumentError, 'Customer records file must be provided'\n end\n\n File.open(@customer_records_file, 'r') do |f|\n f.each_line.map do |line|\n JSON.parse(line)\n end\n end\n end", "def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end", "def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end", "def index\n @users = User.fetch_all_customers\n end", "def index\n @customer_infos = CustomerInfo.all\n end", "def show\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potential_customer }\n end\n end", "def list_customers_with_http_info(authorization, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.list_customers ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.list_customers\" if authorization.nil?\n # resource path\n local_var_path = \"/v2/customers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\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 => 'ListCustomersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#list_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @customers = get_customers(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @customers }\n end\n end", "def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end", "def index\n @customers = current_user.customers.paginate(:per_page => 20, :page => params[:page], :order => 'name', :include => :transactions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customers }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end", "def customers\r\n @customers ||= CustomersController.new(configuration: @configuration)\r\n end", "def list\n display_customers\n end", "def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end", "def show\n @user = User.find(params[:user_id])\n @customer = @user.customers.find(params[:id])\n @album = Album.new\n @albums = @customer.albums\n @notes = @customer.notes.order(\"created_at DESC\")\n @note = Note.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end", "def show\n @customer = current_user.customers.find(params[:id], :include => :orders)\n @orders = @customer.orders.paginate(:per_page => current_user.profile.orders_per_page, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end", "def customerGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end" ]
[ "0.80477434", "0.7958279", "0.78736347", "0.7785999", "0.7759871", "0.7743631", "0.7737657", "0.7650475", "0.7650475", "0.7644552", "0.76392215", "0.7563173", "0.7439835", "0.74304175", "0.74225414", "0.7395726", "0.72824943", "0.72764957", "0.7261613", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.7246176", "0.7164159", "0.71540767", "0.71252036", "0.70998544", "0.7064369", "0.7044635", "0.704376", "0.7032128", "0.70233333", "0.701189", "0.701189", "0.7005285", "0.70026886", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6973055", "0.6963286", "0.69387186", "0.69202554", "0.68890417", "0.6884998", "0.68841976", "0.68797255", "0.68703926", "0.68688864", "0.6851613", "0.6848811", "0.68399435", "0.6809864", "0.6809864", "0.6806203", "0.6769007", "0.67645335", "0.6760816", "0.6709328", "0.6703903", "0.6700306", "0.6696879", "0.6674654", "0.66438556", "0.6619208", "0.66068345", "0.6605628", "0.6602157", "0.65904576", "0.65882844", "0.6588044", "0.65839577", "0.6561115", "0.6544067", "0.6523796", "0.6518941", "0.650751", "0.6504687", "0.65005046", "0.6484343", "0.64840835", "0.6483176", "0.64816195", "0.6471336", "0.64588046", "0.64588046", "0.64588046", "0.6435654", "0.6434578", "0.64324784" ]
0.0
-1
GET /customers/1 GET /customers/1.json
def show @customer = Customer.find(params[:id]) @bookings = Booking.where(:email => @customer[:email]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def customers\n ShopifyAPI::Customer.all\n end", "def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end", "def show\r\n @customer = Customer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @customer }\r\n end\r\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_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 index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end", "def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end", "def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = customers.find(params[:id])\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: CustomersDatatable.new(view_context) }\n end\n @customers = Customer.all\n end", "def index\n respond_to do |format|\n format.html { @customers = Customer.all }\n format.json { @customers = Customer.order(:name) }\n end\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end", "def show\n @customers = Customer.all\n end", "def show\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def show\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potential_customer }\n end\n end", "def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def index\n\t@customers = Customer.all()\n end", "def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def show\n @credit = Credit.find_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n end", "def show\n @customer = Customer.find(params[:id])\n end", "def index\n @my_customers = MyCustomer.all\n end", "def show\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_customer }\n end\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def show\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_bill }\n end\n end", "def index\n @customers = get_customers(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @customers }\n end\n end", "def show\n @customer = Customer.find(params[:id])\t\n end", "def customers\n Easybill::Api::Customers\n end", "def show\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @appointments = Appointment.where(:company_id => current_user.company.id, :customer_id => @customer.id).order('starts_at DESC').paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end", "def show_customer\n @customer = Customer.find(params[:id])\n end", "def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordinates_with_self.collect(&:id)).page params[:page]\n end", "def show\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_customer }\n end\n end", "def index\n @customer_infos = CustomerInfo.all\n end", "def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def index\n @customers = Customer.where(user_id: current_user.id)\n end", "def show\n @user = User.find(params[:user_id])\n @customer = @user.customers.find(params[:id])\n @album = Album.new\n @albums = @customer.albums\n @notes = @customer.notes.order(\"created_at DESC\")\n @note = Note.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end", "def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end", "def show\n @customer_asset = CustomerAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_asset }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.78568625", "0.78568625", "0.7680524", "0.76006114", "0.7533196", "0.7516672", "0.7499743", "0.7383202", "0.7336955", "0.7336955", "0.7336955", "0.7336955", "0.7336955", "0.7336955", "0.73160666", "0.7308929", "0.7281901", "0.71956944", "0.71879476", "0.7172753", "0.71692395", "0.71651024", "0.71575785", "0.7128045", "0.70640624", "0.70486444", "0.7040905", "0.70112205", "0.69684595", "0.69478357", "0.6923017", "0.6914811", "0.6899282", "0.68961483", "0.68751276", "0.68733865", "0.6847531", "0.6834625", "0.6787304", "0.6743695", "0.6743695", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.67166287", "0.67157066", "0.6701329", "0.66979706", "0.66899294", "0.664262", "0.6638948", "0.6638699", "0.66256464", "0.6612287", "0.6589643", "0.6586362", "0.6586362", "0.6585877", "0.65791094", "0.6562901", "0.6549532", "0.65362877", "0.6534878", "0.6534878", "0.6519208", "0.6502856", "0.65015984", "0.6494427", "0.649186", "0.648083", "0.6476878", "0.64692754", "0.6462475", "0.64510953", "0.64132655", "0.6413201", "0.6410462", "0.6410319", "0.6399712", "0.63972795", "0.638939", "0.6388907", "0.6388785", "0.63808906", "0.6345776", "0.6345376", "0.6339171", "0.6339171", "0.6339171", "0.6339171", "0.6339171", "0.6324645" ]
0.0
-1
POST /customers POST /customers.json
def subscribe @customer = Customer.new(customer_params) if Customer.where(:email => @customer.email).count == 1 redirect_to static_pages_hfsk_get_in_touch_path, notice: 'We already have you on the list!' else respond_to do |format| if @customer.save format.html { redirect_to static_pages_hfsk_get_in_touch_path, notice: "Thanks - You are now subscribed to Hang Fire news!" } format.json { render :show, status: :created, location: @customer } else @message = Message.new format.html { render 'static_pages/hfsk_get_in_touch' } format.json { render json: @customer.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n end", "def create_customer(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"customers\",options)\n if response['success']\n return response['results']['customer']\n else\n return response\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n ap errors(@customer.errors)\n render json: errors(@customer.errors), status: :unprocessable_entity\n end\n end", "def send_customer(customer)\n request(customer, \"customer\", :post, {method: \"add\"})\n end", "def create(payload)\n client.post(make_path('/customers'), payload)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully added.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :index }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to action: \"index\", notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(options = {})\n perform_post_with_object('/customers', options, Epages::Customer)\n end", "def create_customer(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(customer_info, password)\n post_wrapper('/V1/customers',\n { customer: customer_info,\n password: password }.to_json,\n admin_headers)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: \"Customer was successfully created.\" }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n \n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # whitelist params\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path }\n format.json { render :show, status: :ok, location: @customer }\n format.json { render :json => @objects.map(&:attributes) }\n else\n format.html { render :new, warning: \"Customer record was NOT saved.\"}\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def createCustomer(customer_properties)\n url_data = \"/api/customers/\"\n @json_customer_properties = customer_properties.to_json\n options = {\n :digest_auth => @auth_digest,\n :body => @json_customer_properties\n }\n url_request = \"#{url_data}\"\n postData(url_request, options)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, Customer\n @customer = Customer.new(customer_params)\n @customer.customer_admin = current_user\n\n if @customer.save\n render json: nil, status: :created\n else\n render json: @customer.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @customer = Customer.new(params[:customer])\r\n\r\n respond_to do |format|\r\n if @customer.save\r\n format.html { redirect_to '/auth/identity/register', :notice => 'Customer was successfully created.' }\r\n format.json { render :json => @customer, :status => :created, :location => @customer }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create_customer\n begin\n customer = Stripe::Customer.create\n # Create customer successful - return its id\n log_info(\"Customer created with ID #{customer[:id]}\")\n rescue Stripe::StripeError => e\n return_error 402, \"Error creating customer #{e.message}\"\n end\n status 201\n { customer_id: customer.id }.to_json\n end", "def create\n #@customer = Customer.new(params[:customer].merge(:user_id => current_user.id))\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to admin_customer_path(@customer), notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer.company = Company.find(current_user.company.id)\n\n respond_to do |format|\n if @customer.save\n format.html {\n flash[:notice] = I18n.t(:successfully_created, :model_name => Customer.model_name.human)\n redirect_to action: 'index'\n }\n format.json {\n render :json => {\n :listPartial => render_to_string(\n 'customers/_list',\n :formats => [:html],\n :layout => false,\n :locals => {\n :customers => Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n }\n ),\n status: :created,\n location: @customer\n }\n }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @customer = Customer.new(customer_params)\n @user = current_user\n respond_to do |format|\n if @customer.save\n @customer.update!(user_id: @user.id)\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.created\", :default => 'Customer was successfully created.') }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully created.\" }\n format.json { render action: \"show\", status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_customer = Customer::Customer.new(customer_customer_params)\n @customer_customer.admin = current_admin\n\n respond_to do |format|\n if @customer_customer.save\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer_customer }\n else\n format.html { render :new }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to [:admin, @customer], notice: t('messages.created', model:Customer.model_name.human) }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n @customer.user = current_user\n authorize @customer, :create?\n\n respond_to do |format|\n if @customer.save\n @customer.works.create!(trackable_url: \"#{customer_path(@customer)}\", action: :create, user: current_user, \n parameters: @customer.to_json(except: {customer: [:fullname_and_address_and_pesel_nip_and_birth_date]}, \n include: { \n user: {\n only: [:id, :name, :email] } \n }))\n\n flash_message :success, t('activerecord.messages.successfull.created', data: @customer.fullname)\n format.html { redirect_to @customer }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = current_user.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @cust = Cust.new(params[:cust])\n\n respond_to do |format|\n if @cust.save\n format.html { redirect_to @cust, notice: 'Cust was successfully created.' }\n format.json { render json: @cust, status: :created, location: @cust }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = current_user\n @customer = @user.customers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n #format.html { redirect_to new_work_servey_path(:customer_id => @customer.id), notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_using_post_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.create_customer_using_post ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomerApi.create_customer_using_post\"\n end\n # resource path\n local_var_path = '/customer'\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(['*/*'])\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(customer)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#create_customer_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_create_customer()\n # Parameters for the API call\n body = APIHelper.json_deserialize(\n '{\"given_name\":\"Amelia\",\"family_name\":\"Earhart\",\"email_address\":\"Amelia.Ear'\\\n 'hart@example.com\",\"address\":{\"address_line_1\":\"500 Electric Ave\",\"address_l'\\\n 'ine_2\":\"Suite 600\",\"locality\":\"New York\"},\"phone_number\":\"1-212-555-4240\",\"'\\\n 'reference_id\":\"YOUR_REFERENCE_ID\",\"note\":\"a customer\"}'\n )\n\n # Perform the API call through the SDK function\n result = @controller.create_customer(body: body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n end", "def create\n @customer = Customer.new(customer_params)\n @projects = Project.all\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def customer_create\n @customer = Person.new(person_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'データが新規作成されました。' }\n format.json { render :customer_show, status: :created, location: @customer }\n else\n format.html { redirect_to new_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomersApi.create_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers'\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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.create_customer\",\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: CustomersApi#create_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @customer = Customer.where(:fullname => params[:customer][:fullname], :phone => params[:customer][:phone]).first\n\n if @customer\n respond_to do |format|\n #format.html { redirect_to :back }\n format.json { render :json => @customer, :status => 200 }\n end\n else\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n #format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :json=> @customer, :status=> :created }\n else\n #format.html { render action: \"new\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end\n end", "def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n UserMailer.welcome_customer(@customer).deliver\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n # render json: {name:@customer.name,mobile:@customer.mobile,email:@customer.email,state_name:@customer.state.name,\n # city_name:@customer.city.name,state_id:@customer.state_id,city_id:@customer.city_id}\n render json: @customer.attributes.merge(state_name:@customer.state.name,city_name:@customer.city.name,customer_count:Customer.count);\n else\n render json:{error: @customer.errors.full_messages}\n end\n end", "def create\n @customer_add = CustomerAdd.new(customer_add_params)\n\n respond_to do |format|\n if @customer_add.save\n format.html { redirect_to @customer_add, notice: 'Customer add was successfully created.' }\n format.json { render :show, status: :created, location: @customer_add }\n else\n format.html { render :new }\n format.json { render json: @customer_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def create\n @customer = customer_scope.new(customer_params)\n @customer.company_type_name = :customer\n\n puts \">>>>> Customer params\"\n puts customer_params.inspect\n\n respond_to do |format|\n if @customer.save\n CompanyRegisterMailer.send_request(@customer.id).deliver\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n\n format.html {\n redirect = customer_path(@customer)\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = root_path() if params[:registration]\n redirect_to redirect, notice: I18n.t('customers.successfully_created')\n }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n session[:customer_id] = @customer.id\n format.html { redirect_to new_order_path, method: :get, notice: \"Your account was successfully created.\" }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body)\r\n begin\r\n @logger.info(\"create_customer called.\")\r\n\r\n # validate required parameters\r\n @logger.info(\"Validating required parameters for create_customer.\")\r\n validate_parameters({\r\n 'body' => body\r\n })\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for create_customer.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for create_customer.\")\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for create_customer.')\r\n _request = @http_client.post _query_url, headers: _headers, parameters: body.to_json\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'create_customer')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for create_customer.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return CustomerModel.from_hash(decoded)\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def add_customer_data(post, options)\n a = options[:address] || {} # shipping address\n \n phone = get_phone_number(a[:phone])\n \n c = {\n :firstname => options[:first_name],\n :lastname => options[:last_name],\n :email => options[:email],\n :zippostal => a[:zip],\n :city => a[:city],\n :address1 => a[:address1],\n :address2 => nil,\n :stateregioniso => a[:state],\n :countryiso => iso_code_for(a[:country]),\n \n :phone1phone => phone[:number],\n :phone1country => phone[:country],\n :phone1area => phone[:area],\n \n :phone2phone => nil,\n :phone2country => nil,\n :phone2area => nil,\n \n :birthday => options[:birth_day] || 01,\n :birthmonth => options[:birth_month] || 01,\n :birthyear => options[:birth_year] || 1980,\n :ipaddress => options[:ip],\n :accountid => options[:id]\n }\n\n post[:customer] = c\n post\n end", "def create\n @customer = User.new(customer_params)\n @customer.authority = 'customer'\n respond_to do |format|\n if @customer.save\n if !current_user\n log_in @customer, :customer\n end\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully created.'}\n format.json {render :show, status: :created, location: @customer}\n else\n format.html {render :new}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def create_customer_phone(customer_id, data)\n post(\"customers/#{customer_id}/phones\", { body: data })\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n # When we make a new CustomerDetail, also make a Customer to go with it, using the Email from CustomerDetail\n customer_info = customer_detail_params['customer_attributes']\n customer_info['email'] = customer_detail_params['email']\n @customer = Customer.create(customer_info)\n @customer_detail.customer = @customer\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to wines_url,\n notice: \"User #{@customer_detail.email} was successfully created. Please proceed to Login.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully created.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = customers.new(params[:customer])\n\n if @customer.save\n redirect_to customers_path, notice: '客户信息保存成功' \n else\n render action: \"new\" \n end\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customers\n ShopifyAPI::Customer.all\n end", "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('saved') }\n format.json { render action: 'show',\n status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = @representative.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente registrado exitosamente.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @customer_info = CustomerInfo.new(customer_info_params)\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully created.' }\n format.json { render :show, status: :created, location: @customer_info }\n else\n format.html { render :new }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def create\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to new_customer_path }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:user_id, :company_name, requests_attributes: [:id, :customer_id, :contact_firstname, :contact_lastname, :title, :email, :phone, :street_address, :city, :date, :zip_code])\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_params\n params.require(:customer).permit(:title, :first_name, :last_name, :email, :phone, :address, :city, :state, :zip, :country, :reservation_ids => [])\n end", "def search_customers(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers/search',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create_customer_using_post(customer, opts = {})\n data, _status_code, _headers = create_customer_using_post_with_http_info(customer, opts)\n data\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n UserMailer.activation_email(@customer.user).deliver_now\n format.html { redirect_to home_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:code, :name, :customer_category_id, :user_id, :notes,\n {customer_branches_attributes: [:_destroy, :id, :name, :address, :notes]},\n {customer_contacts_attributes: [:_destroy, :id, :name, :phones, :email, :notes]})\n end", "def create(options = {})\n post(\"customers/#{customer_id}/deliveries\", options)\n end", "def create\n @customer_account = CustomerAccount.new(customer_account_params)\n\n respond_to do |format|\n if @customer_account.save\n flash[:success] = \"Customer account was successfully created!\"\n format.html { redirect_to @customer_account }\n format.json { render :show, status: :created, location: @customer_account }\n else\n format.html { render :new }\n format.json { render json: @customer_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #render :text => params.inspect and return false\n params[:customer][:country] = params[:country]\n params[:customer][:status] = params[:status]\n @customer = Customer.new(params[:customer])\n \n # render :text => @customer.inspect and return false\n respond_to do |format|\n if @customer.save\n flash[:msg] = 'Customer was successfully created.'\n format.html { redirect_to :controller => 'customers', :action => 'index' }\n #format.json { render json: @customer, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:name, :phone_1, :phone_2, :email, :notes)\n end", "def customer_params\n params.require(:customer).permit(:name, :company_name, :address1, :address2, :postal_code)\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def create(attributes)\n id = attributes[:Guid].present? ? attributes[:Guid] : ''\n response = JSON.parse(@client.post(\"Customers/#{id}\", attributes).body)\n Unleashed::Customer.new(@client, response)\n end", "def customer_params\n params.require(:customer).permit(:first_name, :last_name, :phone, :query, :email,\n :street_address, :city, :acct_open_date, :agreement_status, :trans_type,\n :last_trans_date, :street_address2, :postal, :province, :notes)\n end" ]
[ "0.7583026", "0.7368963", "0.72758555", "0.7225672", "0.7224766", "0.7142322", "0.7116918", "0.7109281", "0.7102696", "0.70753646", "0.7068943", "0.7054525", "0.70359194", "0.70359194", "0.70350176", "0.703466", "0.70175", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7011197", "0.6992751", "0.6984326", "0.6953537", "0.69506246", "0.6950355", "0.693838", "0.69177485", "0.690329", "0.68956757", "0.6893036", "0.689211", "0.68855834", "0.6819733", "0.6735079", "0.67301786", "0.67179143", "0.6695761", "0.6675084", "0.66611797", "0.6654872", "0.6638326", "0.6629095", "0.6591667", "0.65913165", "0.65908194", "0.65799236", "0.65622944", "0.65583175", "0.6558022", "0.6556248", "0.6537413", "0.65248156", "0.6519175", "0.65181625", "0.6511338", "0.64996046", "0.6488794", "0.64813", "0.6452624", "0.64486706", "0.6442164", "0.6440251", "0.6437413", "0.6432282", "0.6407193", "0.6400671", "0.6399971", "0.6389764", "0.6381177", "0.6377061", "0.63661236", "0.63508", "0.6346849", "0.6346006", "0.63451076", "0.63423294", "0.6333185", "0.63303983", "0.63239366", "0.6321749", "0.63213986", "0.63082653", "0.6301424", "0.62783664", "0.62691015", "0.62592316", "0.6255516", "0.6247079", "0.6246658", "0.6242503", "0.62380147", "0.6217102", "0.6215618", "0.6212986", "0.6212601", "0.6211069", "0.62105036" ]
0.0
-1
POST /customers POST /customers.json
def create @customer = Customer.new(customer_params) respond_to do |format| if @customer.save format.html { redirect_to @customer, notice: 'Customer was successfully created.' } format.json { render :show, status: :created, location: @customer } else format.html { render 'new' } format.json { render json: @customer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n end", "def create_customer(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"customers\",options)\n if response['success']\n return response['results']['customer']\n else\n return response\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n ap errors(@customer.errors)\n render json: errors(@customer.errors), status: :unprocessable_entity\n end\n end", "def send_customer(customer)\n request(customer, \"customer\", :post, {method: \"add\"})\n end", "def create(payload)\n client.post(make_path('/customers'), payload)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully added.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :index }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to action: \"index\", notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(options = {})\n perform_post_with_object('/customers', options, Epages::Customer)\n end", "def create_customer(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(customer_info, password)\n post_wrapper('/V1/customers',\n { customer: customer_info,\n password: password }.to_json,\n admin_headers)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: \"Customer was successfully created.\" }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # whitelist params\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path }\n format.json { render :show, status: :ok, location: @customer }\n format.json { render :json => @objects.map(&:attributes) }\n else\n format.html { render :new, warning: \"Customer record was NOT saved.\"}\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def createCustomer(customer_properties)\n url_data = \"/api/customers/\"\n @json_customer_properties = customer_properties.to_json\n options = {\n :digest_auth => @auth_digest,\n :body => @json_customer_properties\n }\n url_request = \"#{url_data}\"\n postData(url_request, options)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, Customer\n @customer = Customer.new(customer_params)\n @customer.customer_admin = current_user\n\n if @customer.save\n render json: nil, status: :created\n else\n render json: @customer.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @customer = Customer.new(params[:customer])\r\n\r\n respond_to do |format|\r\n if @customer.save\r\n format.html { redirect_to '/auth/identity/register', :notice => 'Customer was successfully created.' }\r\n format.json { render :json => @customer, :status => :created, :location => @customer }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create_customer\n begin\n customer = Stripe::Customer.create\n # Create customer successful - return its id\n log_info(\"Customer created with ID #{customer[:id]}\")\n rescue Stripe::StripeError => e\n return_error 402, \"Error creating customer #{e.message}\"\n end\n status 201\n { customer_id: customer.id }.to_json\n end", "def create\n #@customer = Customer.new(params[:customer].merge(:user_id => current_user.id))\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to admin_customer_path(@customer), notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer.company = Company.find(current_user.company.id)\n\n respond_to do |format|\n if @customer.save\n format.html {\n flash[:notice] = I18n.t(:successfully_created, :model_name => Customer.model_name.human)\n redirect_to action: 'index'\n }\n format.json {\n render :json => {\n :listPartial => render_to_string(\n 'customers/_list',\n :formats => [:html],\n :layout => false,\n :locals => {\n :customers => Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n }\n ),\n status: :created,\n location: @customer\n }\n }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @customer = Customer.new(customer_params)\n @user = current_user\n respond_to do |format|\n if @customer.save\n @customer.update!(user_id: @user.id)\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.created\", :default => 'Customer was successfully created.') }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully created.\" }\n format.json { render action: \"show\", status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_customer = Customer::Customer.new(customer_customer_params)\n @customer_customer.admin = current_admin\n\n respond_to do |format|\n if @customer_customer.save\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer_customer }\n else\n format.html { render :new }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to [:admin, @customer], notice: t('messages.created', model:Customer.model_name.human) }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n @customer.user = current_user\n authorize @customer, :create?\n\n respond_to do |format|\n if @customer.save\n @customer.works.create!(trackable_url: \"#{customer_path(@customer)}\", action: :create, user: current_user, \n parameters: @customer.to_json(except: {customer: [:fullname_and_address_and_pesel_nip_and_birth_date]}, \n include: { \n user: {\n only: [:id, :name, :email] } \n }))\n\n flash_message :success, t('activerecord.messages.successfull.created', data: @customer.fullname)\n format.html { redirect_to @customer }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = current_user.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @cust = Cust.new(params[:cust])\n\n respond_to do |format|\n if @cust.save\n format.html { redirect_to @cust, notice: 'Cust was successfully created.' }\n format.json { render json: @cust, status: :created, location: @cust }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = current_user\n @customer = @user.customers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n #format.html { redirect_to new_work_servey_path(:customer_id => @customer.id), notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_using_post_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.create_customer_using_post ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomerApi.create_customer_using_post\"\n end\n # resource path\n local_var_path = '/customer'\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(['*/*'])\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(customer)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#create_customer_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_create_customer()\n # Parameters for the API call\n body = APIHelper.json_deserialize(\n '{\"given_name\":\"Amelia\",\"family_name\":\"Earhart\",\"email_address\":\"Amelia.Ear'\\\n 'hart@example.com\",\"address\":{\"address_line_1\":\"500 Electric Ave\",\"address_l'\\\n 'ine_2\":\"Suite 600\",\"locality\":\"New York\"},\"phone_number\":\"1-212-555-4240\",\"'\\\n 'reference_id\":\"YOUR_REFERENCE_ID\",\"note\":\"a customer\"}'\n )\n\n # Perform the API call through the SDK function\n result = @controller.create_customer(body: body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n end", "def create\n @customer = Customer.new(customer_params)\n @projects = Project.all\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def customer_create\n @customer = Person.new(person_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'データが新規作成されました。' }\n format.json { render :customer_show, status: :created, location: @customer }\n else\n format.html { redirect_to new_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomersApi.create_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers'\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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.create_customer\",\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: CustomersApi#create_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @customer = Customer.where(:fullname => params[:customer][:fullname], :phone => params[:customer][:phone]).first\n\n if @customer\n respond_to do |format|\n #format.html { redirect_to :back }\n format.json { render :json => @customer, :status => 200 }\n end\n else\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n #format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :json=> @customer, :status=> :created }\n else\n #format.html { render action: \"new\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end\n end", "def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n UserMailer.welcome_customer(@customer).deliver\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n # render json: {name:@customer.name,mobile:@customer.mobile,email:@customer.email,state_name:@customer.state.name,\n # city_name:@customer.city.name,state_id:@customer.state_id,city_id:@customer.city_id}\n render json: @customer.attributes.merge(state_name:@customer.state.name,city_name:@customer.city.name,customer_count:Customer.count);\n else\n render json:{error: @customer.errors.full_messages}\n end\n end", "def create\n @customer_add = CustomerAdd.new(customer_add_params)\n\n respond_to do |format|\n if @customer_add.save\n format.html { redirect_to @customer_add, notice: 'Customer add was successfully created.' }\n format.json { render :show, status: :created, location: @customer_add }\n else\n format.html { render :new }\n format.json { render json: @customer_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def create\n @customer = customer_scope.new(customer_params)\n @customer.company_type_name = :customer\n\n puts \">>>>> Customer params\"\n puts customer_params.inspect\n\n respond_to do |format|\n if @customer.save\n CompanyRegisterMailer.send_request(@customer.id).deliver\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n\n format.html {\n redirect = customer_path(@customer)\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = root_path() if params[:registration]\n redirect_to redirect, notice: I18n.t('customers.successfully_created')\n }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n session[:customer_id] = @customer.id\n format.html { redirect_to new_order_path, method: :get, notice: \"Your account was successfully created.\" }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body)\r\n begin\r\n @logger.info(\"create_customer called.\")\r\n\r\n # validate required parameters\r\n @logger.info(\"Validating required parameters for create_customer.\")\r\n validate_parameters({\r\n 'body' => body\r\n })\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for create_customer.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for create_customer.\")\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for create_customer.')\r\n _request = @http_client.post _query_url, headers: _headers, parameters: body.to_json\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'create_customer')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for create_customer.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return CustomerModel.from_hash(decoded)\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def add_customer_data(post, options)\n a = options[:address] || {} # shipping address\n \n phone = get_phone_number(a[:phone])\n \n c = {\n :firstname => options[:first_name],\n :lastname => options[:last_name],\n :email => options[:email],\n :zippostal => a[:zip],\n :city => a[:city],\n :address1 => a[:address1],\n :address2 => nil,\n :stateregioniso => a[:state],\n :countryiso => iso_code_for(a[:country]),\n \n :phone1phone => phone[:number],\n :phone1country => phone[:country],\n :phone1area => phone[:area],\n \n :phone2phone => nil,\n :phone2country => nil,\n :phone2area => nil,\n \n :birthday => options[:birth_day] || 01,\n :birthmonth => options[:birth_month] || 01,\n :birthyear => options[:birth_year] || 1980,\n :ipaddress => options[:ip],\n :accountid => options[:id]\n }\n\n post[:customer] = c\n post\n end", "def create\n @customer = User.new(customer_params)\n @customer.authority = 'customer'\n respond_to do |format|\n if @customer.save\n if !current_user\n log_in @customer, :customer\n end\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully created.'}\n format.json {render :show, status: :created, location: @customer}\n else\n format.html {render :new}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def create_customer_phone(customer_id, data)\n post(\"customers/#{customer_id}/phones\", { body: data })\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n # When we make a new CustomerDetail, also make a Customer to go with it, using the Email from CustomerDetail\n customer_info = customer_detail_params['customer_attributes']\n customer_info['email'] = customer_detail_params['email']\n @customer = Customer.create(customer_info)\n @customer_detail.customer = @customer\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to wines_url,\n notice: \"User #{@customer_detail.email} was successfully created. Please proceed to Login.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully created.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = customers.new(params[:customer])\n\n if @customer.save\n redirect_to customers_path, notice: '客户信息保存成功' \n else\n render action: \"new\" \n end\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customers\n ShopifyAPI::Customer.all\n end", "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('saved') }\n format.json { render action: 'show',\n status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = @representative.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente registrado exitosamente.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @customer_info = CustomerInfo.new(customer_info_params)\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully created.' }\n format.json { render :show, status: :created, location: @customer_info }\n else\n format.html { render :new }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def create\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to new_customer_path }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:user_id, :company_name, requests_attributes: [:id, :customer_id, :contact_firstname, :contact_lastname, :title, :email, :phone, :street_address, :city, :date, :zip_code])\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_params\n params.require(:customer).permit(:title, :first_name, :last_name, :email, :phone, :address, :city, :state, :zip, :country, :reservation_ids => [])\n end", "def search_customers(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers/search',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create_customer_using_post(customer, opts = {})\n data, _status_code, _headers = create_customer_using_post_with_http_info(customer, opts)\n data\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n UserMailer.activation_email(@customer.user).deliver_now\n format.html { redirect_to home_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:code, :name, :customer_category_id, :user_id, :notes,\n {customer_branches_attributes: [:_destroy, :id, :name, :address, :notes]},\n {customer_contacts_attributes: [:_destroy, :id, :name, :phones, :email, :notes]})\n end", "def create(options = {})\n post(\"customers/#{customer_id}/deliveries\", options)\n end", "def create\n @customer_account = CustomerAccount.new(customer_account_params)\n\n respond_to do |format|\n if @customer_account.save\n flash[:success] = \"Customer account was successfully created!\"\n format.html { redirect_to @customer_account }\n format.json { render :show, status: :created, location: @customer_account }\n else\n format.html { render :new }\n format.json { render json: @customer_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #render :text => params.inspect and return false\n params[:customer][:country] = params[:country]\n params[:customer][:status] = params[:status]\n @customer = Customer.new(params[:customer])\n \n # render :text => @customer.inspect and return false\n respond_to do |format|\n if @customer.save\n flash[:msg] = 'Customer was successfully created.'\n format.html { redirect_to :controller => 'customers', :action => 'index' }\n #format.json { render json: @customer, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:name, :phone_1, :phone_2, :email, :notes)\n end", "def customer_params\n params.require(:customer).permit(:name, :company_name, :address1, :address2, :postal_code)\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def create(attributes)\n id = attributes[:Guid].present? ? attributes[:Guid] : ''\n response = JSON.parse(@client.post(\"Customers/#{id}\", attributes).body)\n Unleashed::Customer.new(@client, response)\n end", "def customer_params\n params.require(:customer).permit(:first_name, :last_name, :phone, :query, :email,\n :street_address, :city, :acct_open_date, :agreement_status, :trans_type,\n :last_trans_date, :street_address2, :postal, :province, :notes)\n end" ]
[ "0.7583026", "0.7368963", "0.72758555", "0.7225672", "0.7224766", "0.7142322", "0.7116918", "0.7109281", "0.7102696", "0.70753646", "0.7068943", "0.7054525", "0.70359194", "0.70359194", "0.70350176", "0.703466", "0.70175", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.6992751", "0.6984326", "0.6953537", "0.69506246", "0.6950355", "0.693838", "0.69177485", "0.690329", "0.68956757", "0.6893036", "0.689211", "0.68855834", "0.6819733", "0.6735079", "0.67301786", "0.67179143", "0.6695761", "0.6675084", "0.66611797", "0.6654872", "0.6638326", "0.6629095", "0.6591667", "0.65913165", "0.65908194", "0.65799236", "0.65622944", "0.65583175", "0.6558022", "0.6556248", "0.6537413", "0.65248156", "0.6519175", "0.65181625", "0.6511338", "0.64996046", "0.6488794", "0.64813", "0.6452624", "0.64486706", "0.6442164", "0.6440251", "0.6437413", "0.6432282", "0.6407193", "0.6400671", "0.6399971", "0.6389764", "0.6381177", "0.6377061", "0.63661236", "0.63508", "0.6346849", "0.6346006", "0.63451076", "0.63423294", "0.6333185", "0.63303983", "0.63239366", "0.6321749", "0.63213986", "0.63082653", "0.6301424", "0.62783664", "0.62691015", "0.62592316", "0.6255516", "0.6247079", "0.6246658", "0.6242503", "0.62380147", "0.6217102", "0.6215618", "0.6212986", "0.6212601", "0.6211069", "0.62105036" ]
0.7011197
23
PATCH/PUT /customers/1 PATCH/PUT /customers/1.json
def update respond_to do |format| if @customer.update(customer_params) format.html { redirect_to @customer, notice: 'Customer was successfully updated.' } format.json { render :show, status: :ok, location: @customer } else format.html { render :edit } format.json { render json: @customer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #format.html { redirect_to customers_path }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n if @customer.update(customer_params)\n head :no_content\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to action:\"index\", notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully updated.'}\n format.json {render :show, status: :ok, location: @customer}\n else\n format.html {render :edit}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.json { render action: 'show', status: :created, location: @customer }#format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to customers_path, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n\n respond_to do |format|\n if @customer.update(customer_params)\n @@current_customer = @customer.id\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to [:admin, @customer], notice: t('messages.updated', model:Customer.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #@customer.progress!\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n if @cust.update_attributes(params[:cust])\n format.html { redirect_to @cust, notice: 'Cust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # it is impossible for a customer to update a referral, so no need to modify.\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to [@selector, @customer], :notice => 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_customer.update(customer_customer_params)\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_customer }\n else\n format.html { render :edit }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n \n if @customer.update(customer_params.keep_if{|p,q| q.class != ActionController::Parameters}) \n @customer.address.update(customer_params[:address_attributes])\n @customer.contact.update(customer_params[:contact_attributes])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :show }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @Customer = Customer.find params[:id]\n if @Customer.update_attributes (customer_params)\n render :json => { :success => true, :Customer => @Customer, :message => 'customer add ok ' }\n else\n render :json => {:success => false, :message => \"Existe un error\"}\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.updated\", :default => 'Customer was successfully updated.') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to customer_path(session[:customer_id]), notice: 'Your account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_customer.update(my_customer_params)\n format.html { redirect_to @my_customer, notice: 'My customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_customer }\n else\n format.html { render :edit }\n format.json { render json: @my_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado com sucesso!' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html {\n redirect_to @customer,\n notice: I18n.t(:successfully_updated, :model_name => Customer.model_name.human)\n }\n format.json { head :no_content }\n else\n @customer.errors.each do |name, error|\n flash[name] = error\n end\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_update\n respond_to do |format|\n if @customer.update(person_params)\n format.html { redirect_to customer_path, notice: 'データが更新されました。' }\n format.json { render :customer_show, status: :ok, location: @customer }\n else\n format.html { redirect_to edit_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer, id)\n request(customer, \"customer\", :post, {id: id, method: \"edit\"})\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Your Customer Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_set.update(customer_set_params)\n format.html { redirect_to @customer_set, notice: 'Customer set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n @customer = Customer.find(params[:id])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(@customer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = current_user.customers.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.xml { head :ok }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\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 @self_service_customer = SelfService::Customer.find(params[:id])\n\n respond_to do |format|\n if @self_service_customer.update_attributes(params[:self_service_customer])\n format.html { redirect_to(@self_service_customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @self_service_customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(@customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(:action => 'index', :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Personendaten wurden erfolgreich aktualisiert.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(params = {})\n req = WebPay::CustomerRequestUpdate.create(params)\n raw_response = @client._request(:post, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to customers_path, success: \"Customer record updated\"}\n else\n format.html { render :edit }\n end\n end\n end", "def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def update\n @customer.user = current_user\n authorize @customer, :update?\n\n respond_to do |format|\n if @customer.update(customer_params)\n @customer.works.create!(trackable_url: \"#{customer_path(@customer)}\", action: :update, user: current_user, \n parameters: @customer.to_json(except: {customer: [:fullname_and_address_and_pesel_nip_and_birth_date]}, \n include: { \n user: {\n only: [:id, :name, :email] } \n }))\n\n flash_message :success, t('activerecord.messages.successfull.updated', data: @customer.fullname)\n format.html { redirect_to @customer }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @cPhone = CustomerPhone.where('customer_id=? and phone_id=?', params[:customer_id], phone_params[:id]).first \n @phone = @cPhone.phone\n \n respond_to do |format|\n if @phone.update(phone_params)\n format.json { head :no_content }\n else\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = customer_scope.find(params[:id])\n\n respond_to do |format|\n if params[:company][:avatar] && @customer.update_attribute(:avatar, params[:company][:avatar])\n format.html { render action: \"edit\" }\n format.js #\n elsif @customer.update_attributes(customer_params)\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n format.html {\n redirect = customer_path(@customer)\n redirect = root_path if current_company.is_customer?\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = company_reseller_customer_path(current_company, @customer.parent_id, @customer) if session[:by_reseller] && @customer.parent && @customer.parent.is_partner?\n redirect = step3_homes_path if session['homes.step'] == 2\n redirect_to redirect, notice: I18n.t('commons.successfully_updated')\n }\n format.json { head :no_content }\n format.js #\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_detail.update(customer_detail_params)\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer_detail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer, options = {})\n id = epages_id(customer)\n perform_patch_with_object(\"/customers/#{id}\", options, Epages::Customer)\n end", "def update\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n if @address_customer.update_attributes(params[:address_customer])\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @customer_add.update(customer_add_params)\n format.html { redirect_to @customer_add, notice: 'Customer add was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_add }\n else\n format.html { render :edit }\n format.json { render json: @customer_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_info.update(customer_info_params)\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_info }\n else\n format.html { render :edit }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n if @potential_customer.update_attributes(params[:potential_customer])\n format.html { redirect_to @potential_customer, notice: 'Potential customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @potential_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado exitosamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n if @custo.update_attributes(params[:custo])\n format.html { redirect_to @custo, notice: 'Custo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @custo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t('views.flash_update_message') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n migrate_to_dropbox\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n @user = User.find(session[:user_id])\n @customer.modified_by = @user.name\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(customers_path, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n if @customer.update customer_params\n redirect_to @customer\n else\n render 'edit'\n end\n end", "def update\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n if @customer_bill.update_attributes(params[:customer_bill])\n format.html { redirect_to @customer_bill, notice: 'Customer bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def update_customer_with_http_info(id, update_customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.update_customer ...'\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 CustomersApi.update_customer\"\n end\n # verify the required parameter 'update_customer' is set\n if @api_client.config.client_side_validation && update_customer.nil?\n fail ArgumentError, \"Missing the required parameter 'update_customer' when calling CustomersApi.update_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(update_customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.update_customer\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#update_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n if @offer_customer.update_attributes(params[:offer_customer])\n format.html { redirect_to @offer_customer, notice: 'Offer customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n if @type_customer.update_attributes(params[:type_customer])\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\n end\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 @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n if @customers_address.update_attributes(params[:customers_address])\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n respond_to do |format|\n if @service.update_attributes(service_params)\n format.html { redirect_to @customer, success: 'Service was successfully updated.' }\n format.json { respond_with_bip(@service) }\n else\n format.html { render action: 'edit'}\n format.json { respond_with_bip(@service) }\n end\n end\n end", "def update\n respond_to do |format|\n if @customerservice.update(customerservice_params)\n format.html { redirect_to @customerservice, notice: 'Customerservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @customerservice }\n else\n format.html { render :edit }\n format.json { render json: @customerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = customers.find(params[:id])\n\n if @customer.update_attributes(params[:customer])\n redirect_to customers_path, notice: '客户信息更新成功' \n else\n render action: \"edit\" \n end\n end", "def update\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug (fname) {\"params=#{params.inspect}\"}\n\t\t@customer = Customer.find(params[:id])\n\t\t@types = Typesobject.get_types(:customer)\n\t\t@status = Statusobject.find_for(@customer)\n\t\t@customer.update_accessor(current_user)\n\t\tif commit_promote?\n\t\t\tctrl_promote(@customer)\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tif @customer.update_attributes(params[:customer])\n\t\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { redirect_to(@customer) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = t(:ctrl_object_notupdated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { render :action => :edit }\n\t\t\t\t\tformat.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend" ]
[ "0.6988014", "0.6921667", "0.6921389", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.67379916", "0.6729548", "0.669213", "0.669213", "0.669213", "0.6614732", "0.66107404", "0.6601309", "0.6599307", "0.6581087", "0.65642476", "0.65528435", "0.65495336", "0.65224195", "0.6521344", "0.6517462", "0.6504792", "0.6493295", "0.64776856", "0.6457318", "0.6456203", "0.64549035", "0.64447165", "0.6439166", "0.64264", "0.6406883", "0.6396675", "0.6395213", "0.6387667", "0.63603675", "0.6351255", "0.6351143", "0.6297615", "0.62898433", "0.62882054", "0.6285952", "0.6271253", "0.6269422", "0.6253447", "0.6251907", "0.62460697", "0.6244198", "0.6244198", "0.6213548", "0.61861336", "0.61684984", "0.61539996", "0.61523414", "0.6127079", "0.6125767", "0.6121538", "0.61150646", "0.61145186", "0.6112347", "0.6089436", "0.6088314", "0.6070272", "0.60669667", "0.6055655", "0.6049337", "0.60488063", "0.6045963", "0.60332125", "0.6032371", "0.6016146", "0.60120237", "0.6011633", "0.60063666", "0.60063666", "0.59956974", "0.5966501", "0.59659606", "0.5965954", "0.5965705" ]
0.6525123
38
DELETE /customers/1 DELETE /customers/1.json
def destroy @customer.destroy respond_to do |format| format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @customer = Customer.find(params[:id])\r\n @customer.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to customers_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n head :no_content\n end", "def destroy\n \n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_customers_url(current_user) }\n format.json do\n render json: {\n customer: @customer,\n status: :deleted\n }.to_json\n end\n end\n end", "def destroy\n @single_customer.destroy\n respond_to do |format|\n format.html { redirect_to single_customers_url, notice: 'Single customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cust = Cust.find(params[:id])\n @cust.destroy\n\n respond_to do |format|\n format.html { redirect_to custs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n # @customer.destroy\n # respond_to do |format|\n # format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @customer_customer.destroy\n respond_to do |format|\n format.html { redirect_to customer_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to admin_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_customer_by_id(customer_id)\n host = Swagger.configuration.host\n api_key = Swagger.configuration.private_api_key\n\n conn = Faraday.new\n resp = conn.delete do |req|\n req.url \"https://#{host}/api/customer/#{customer_id}\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = 'Basic ' + [\"#{api_key}:\"].pack('m').delete(\"\\r\\n\")\n end\n body = JSON.parse(resp.body)\n Swagger::Response.new(resp.status, body)\n return body\n end", "def delete_index\n @customer = Customer.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @customer.delete\n elsif params[:type]=='restore'\n @customer.restore\n @customer.update(deleted_at: nil)\n end\n\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def delete(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def customer_destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @my_customer.destroy\n respond_to do |format|\n format.html { redirect_to my_customers_url, notice: 'My customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n #format.html { redirect_to customers_index_path }\n format.json { head :ok }\n format.js { render :nothing => true }\n end\n end", "def destroy\n authorize @customer, :destroy?\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.destroy\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n else\n format.html { redirect_to customer_url(@customer), :notice => \"customer can't be destroyed\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end \n end\n end", "def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url,flash[:success] = \"Customer record successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Person wurde erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @self_service_customer = SelfService::Customer.find(params[:id])\n @self_service_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(self_service_customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @custo = Custo.find(params[:id])\n @custo.destroy\n\n respond_to do |format|\n format.html { redirect_to custos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer_add.destroy\n respond_to do |format|\n format.html { redirect_to customer_adds_url, notice: 'Customer add was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n @cust_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(@customer) }\n format.json { head :no_content }\n end\n end", "def delete_customer(customer_id:,\n version: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .query_param(new_parameter(version, key: 'version'))\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 destroy\n @address_customer = AddressCustomer.find(params[:id])\n @address_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to address_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_customer = TypeCustomer.find(params[:id])\n @type_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to type_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Cliente eliminado exitosamente.' }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: t(\"activerecord.controller_msg.customer.destroyed\", :default => 'Customer was successfully destroyed.') }\n format.json { head :no_content }\n end\n end", "def delete(customer_id)\n response, status = BeyondApi::Request.delete(@session, \"/customers/#{customer_id}\")\n\n handle_response(response, status, respond_with_true: true)\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 delete\n request(:delete)\n end", "def destroy\n @customer.destroy\n redirect_to customers_url\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n Customer.destroy params #[not sure what to put in the params]\n redirect_to customers_path\n end", "def destroy\n @customer_detail.destroy\n respond_to do |format|\n format.html { redirect_to customer_details_url, notice: \"Customer detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_detail.destroy\n respond_to do |format|\n format.html { redirect_to customer_details_url, notice: 'Customer detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n redirect_to(action: \"index\")\n end", "def destroy\n @shop_customer.destroy\n respond_to do |format|\n format.html { redirect_to shop_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n end\n end", "def delete_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.delete(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def destroy\n @customerservice.destroy\n respond_to do |format|\n format.html { redirect_to customerservices_url, notice: 'Customerservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\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 if params[:customers]\n customers.where(id: params[:customers].values).delete_all\n elsif params[:id]\n customers.find_by_id(params[:id]).try(:destroy)\n end\n redirect_to customers_url(search: params[:search])\n end", "def destroy\n @customer.destroy\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @customer_info.destroy\n respond_to do |format|\n format.html { redirect_to customer_infos_url, notice: 'Customer info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reach_out_to_customer.destroy\n respond_to do |format|\n format.html { redirect_to reach_out_to_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_set.destroy\n respond_to do |format|\n format.html { redirect_to customer_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n @sixmonth_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to sixmonth_customers_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7459997", "0.7459997", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.7435839", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7364333", "0.732843", "0.72985286", "0.72831863", "0.7236284", "0.71671945", "0.71460426", "0.71443635", "0.7143448", "0.7143448", "0.7135988", "0.71215165", "0.7119578", "0.7108053", "0.7100693", "0.7094806", "0.709428", "0.7090288", "0.7078817", "0.7078817", "0.7078817", "0.70757055", "0.7075676", "0.7058505", "0.7056407", "0.7037161", "0.7028059", "0.70055234", "0.69809604", "0.6980533", "0.69780326", "0.69721895", "0.6955825", "0.69444925", "0.69270974", "0.69230574", "0.6898595", "0.68974566", "0.68970734", "0.6892207", "0.68822056", "0.68665344", "0.6862874", "0.6862019", "0.6833437", "0.6830371", "0.6830244", "0.6823991", "0.6812947", "0.6811358", "0.6802542", "0.6769426", "0.67567897", "0.67558765", "0.67558765", "0.6755757", "0.67547226", "0.67405546", "0.67126524", "0.6710435", "0.6703614", "0.67006505", "0.67001665", "0.6699188" ]
0.7141246
45
Use callbacks to share common setup or constraints between actions.
def set_customer @customer = Customer.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 customer_params params.require(:customer).permit(:name, :phone, :email, :desc, :subscribed, :accessible, :child_friendly) 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
GET /billing_infos/1 GET /billing_infos/1.json
def show @billing_info = BillingInfo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @billing_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @billing_infos = BillingInfo.all\n end", "def index\n @billing_infos = BillingInfo.all\n end", "def billing\n request('billing', :get)\n end", "def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_info }\n end\n end", "def show\n @billing_address = BillingAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_address }\n end\n end", "def billing\n @data[:billing]\n end", "def get_billing_information(data)\n {\n :first_name => data[:first_name],\n :last_name => data[:last_name],\n :email_address => data[:email_address],\n\n :street_address => data[:address][:street_address],\n :secondary_address => data[:address][:secondary_address],\n :city => data[:address][:city],\n :state => data[:address][:state],\n :zip => data[:address][:zip_code],\n :country => data[:address][:country],\n :phone_number => data[:phone_number]\n }\n end", "def set_billing_info\n @billing_info = BillingInfo.find(params[:id])\n end", "def set_billing_info\n @billing_info = BillingInfo.find(params[:id])\n end", "def show\n @bill = Bill.find(params[:id])\n\n render json: @bill\n end", "def show\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_bill }\n end\n end", "def show\n @panel_billing = Panel::Billing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_billing }\n end\n end", "def show\n @payable_billing = PayableBilling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_info }\n end\n end", "def show\n @billing_entry = BillingEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @billing_entry }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill }\n end\n end", "def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully created.' }\n format.json { render json: @billing_info, status: :created, location: @billing_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show_info\n render json: TrackingInformationQuery.single(@tracking_information, @order), status: 200\n end", "def get_billing(req)\n render template_path()\n end", "def show\r\n @bill = Bill.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @bill }\r\n end\r\n end", "def show\n @banking_detail = BankingDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banking_detail }\n end\n end", "def show\n @breadcrumb = 'read'\n @billing_frequency = BillingFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_frequency }\n end\n end", "def show\n @breadcrumb = 'read'\n @bill = Bill.find(params[:id])\n @invoice = @bill.invoices.paginate(:page => params[:page], :per_page => per_page).order('id')\n # @items = @invoice.invoice_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @billing_periods = billing_periods_dropdown\n if !@bill.water_supply_contract.nil?\n @water_supply_contract = @bill.water_supply_contract\n @contracting_request = @water_supply_contract.contracting_request\n respond_to do |format|\n format.html { render \"ag2_gest/contracting_requests/bill\" }\n format.json { render json: @bill }\n end\n else\n @reading = @bill.reading\n @subscriber = @bill.subscriber\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill }\n end\n end\n end", "def billing_info_edit\n result = ChargeBee::Customer.retrieve(@customer_id)\n @customer = result.customer\n @billing_address = result.customer.billing_address\n @country_codes = get_country_codes\n end", "def show\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\t\t\n format.html # show.html.erb\n format.json { render json: @bill }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\t respond_to do |format|\n format.json { render json: @bill}\n format.html \n end\n end", "def new\n @billing_address = BillingAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_address }\n end\n end", "def account_billing_get(*args)\n params = Zoom::Params.new(Utils.extract_options!(args))\n params.require(:account_id)\n Utils.parse_response self.class.get(\"/accounts/#{params[:account_id]}/billing\", headers: request_headers)\n end", "def information\n @selected_plan = BillingPlan.find_by(stripe_plan_id: params['plan'], available: true)\n @stripe_customer = Stripe::Customer.retrieve(current_user.stripe_customer_id)\n end", "def show\n #@detail = Detail.find(params[:id])\n @plan = Plan.find(params[:plan_id])\n @detail = @plan.details.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detail }\n end\n end", "def show\n gon.show_url = '/orders/' + @order.id.to_s + '/bills/' + @bill.id.to_s\n gon.bill_id = @bill.id.to_s\n gon.order_id = @order.id\n\n @subtotal = @bill.subtotal.to_s\n @tax = @bill.tax.to_s\n @grand_total = @bill.grand_total.to_s\n @owed = @bill.owed().to_s\n @discount_percent = @bill.discount_percent\n @discount_subtraction = @bill.discount_subtraction.to_s\n @service_charge = @bill.service_charge_percent\n @change = @bill.change().to_s\n \n respond_to do |format|\n format.html\n format.json {\n render :json => { :order_id => @order.id, :bill_id => @bill.id, :subtotal => @subtotal,\n :tax => @tax ,:grand_total => @grand_total, :discount_percent => @discount_percent, :service_charge => @service_charge,\n :discount_subtraction => @discount_subtraction, :owed => @owed, :items => @items, :change => @change,\n :itemized_items => @itemized_items.as_json(methods: [:menu_name,:item_name,:price_string,:itemized_price]),\n :payments => @bill.payments.as_json(only: [:id, :payment_string, :name],methods: [:payment_string,:name])\n }\n }\n end\n\n end", "def show\n render json: @bill\n end", "def show\n @checkout = Checkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @checkout }\n end\n end", "def show\n @checkout = Checkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @checkout }\n end\n end", "def index\n @bill_detail_infos = BillDetailInfo.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill_cargo }\n end\n end", "def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase }\n end\n end", "def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase }\n end\n end", "def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase }\n end\n end", "def show\n # @invoice = Invoice.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def show\n @credit = Credit.find_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end", "def show\n @payment_gateway = PaymentGateway.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_gateway }\n end\n end", "def purchase billing, number\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PUT',\r\n query_url:query_url,\r\n body:\"{\\\"billing_method\\\": #{billing.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def show\n @bill = Bill.find(params[:id])\n if @bill.complete \n @taxinvoice = Taxinvoice.where(:ref_id => @bill.id)\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bill }\n format.json { render :json => @bill }\n end\n end", "def bpay_details\n response = JSON.parse(@client.get(\"items/#{send(:id)}/bpay_details\").body)\n response['items']['bpay_details']\n end", "def bpay_details\n response = JSON.parse(@client.get(\"items/#{send(:id)}/bpay_details\").body)\n response['items']['bpay_details']\n end", "def bpay_details\n response = JSON.parse(@client.get(\"items/#{send(:id)}/bpay_details\").body)\n response['items']['bpay_details']\n end", "def show\n @purchase = Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @purchase }\n end\n end", "def show\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def show\n @monthlybill = Monthlybill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthlybill }\n end\n end", "def create\n @billing_info = BillingInfo.new(billing_info_params)\n @billing_info.company_id = current_user.company_id\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to select_plan_path, notice: 'Gracias por ingresar su información de facturación, esta será validada a la brevedad.' }\n format.json { render action: 'show', status: :created, location: @billing_info }\n else\n format.html { redirect_to select_plan_path, notice: 'Hubo un problema en la validación de los datos, por favor revíselos.' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end", "def show\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_item }\n end\n end", "def account_billing_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BillingApi.account_billing ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling BillingApi.account_billing\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/billing'.sub('{' + 'accountId' + '}', account_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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20014')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BillingApi#account_billing\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_billing(req)\n @msg = req.session.delete('billing_flash_msg')\n # TODO: This card information could be stored locally. It is innocuous enough.\n # Or perhaps in memcache or something\n customer = Stripe::Customer.retrieve(@dealership.customer_id)\n @card = card_for(customer)\n render template_path()\n end", "def new\n @panel_billing = Panel::Billing.new\n @countries = Country.find(:all)\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_billing }\n end\n end", "def show\n @purchase_order_item = PurchaseOrderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_order_item }\n end\n end", "def show\n @borrow_request = BorrowRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrow_request }\n end\n end", "def update_billing_info\n billing_info = Recurly.js.fetch(params[:recurly_token])\n logger.info billing_info\n\n flash[:notice] = 'Billing information was successfully updated!'\n redirect_to app_url(subdomain: current_company.subdomain)\n end", "def show\n @voip_cost = VoipCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voip_cost }\n end\n end", "def show\n @obj = {\n id: @bank_account.id,\n account_number: @bank_account.account_number,\n account_type: @bank_account.account_type,\n bank: @bank_account.bank,\n statu_id: @bank_account.statu_id,\n user_id: @bank_account.user_id,\n active: @bank_account.active,\n approved: @bank_account.approved,\n certificate: @bank_account.certificate.attached? ? url_for(@bank_account.certificate) : nil,\n created_at: @bank_account.created_at,\n updated_at: @bank_account.updated_at\n }\n render json: @obj\n end", "def show\n @admin_accounting_bank_account = Admin::AccountingBankAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_accounting_bank_account }\n\n end\n end", "def show\n @member_payment = MemberPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member_payment }\n end\n end", "def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @invoice }\n end\n end", "def show\n @breadcrumb = 'read'\n @billable_item = BillableItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billable_item }\n end\n end", "def show\n @shop_purchase = Shop::Purchase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_purchase }\n end\n end", "def show\n @invoicedetail = Invoicedetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicedetail }\n end\n end", "def show\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_item_status }\n end\n end", "def show\n\n respond_to do |format|\n format.html\n format.json { render :json => @payment_request }\n end\n end", "def full_details\n @account = Account.find(params[:account_id])\n @subscription = @account.subscriptions.find(params[:id])\n @order = Order.find(@subscription.order_id)\n\n if @order.user_id\n @user = User.find(@order.user_id)\n end\n\n if @order.by_agent\n @agent = User.find(@order.by_agent)\n end\n\n if @order.price_plan_id\n @price_plan = Country.where(:\"price_plans._id\" => @order.price_plan_id).first.price_plans.find(@order.price_plan_id)\n end\n\n respond_to do |format|\n format.html {render(layout: 'management')}\n end\n end", "def show\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_requisition }\n end\n end", "def show\n find_payment\n render json: @payment\n end", "def getinfo\n @api.request 'getinfo'\n end", "def index\n @billing_plans = BillingPlan.all\n end", "def show\n @title = t('view.banks.show_title')\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to(@billing_info, :notice => 'BillingInfo was successfully created.') }\n format.xml { render :xml => @billing_info, :status => :created, :location => @billing_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billing_info.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def account_information\n response = get \"account\"\n data = JSON.parse response.body\n data[\"account\"][\"credits\"]\n end", "def show\n respond_to do |format|\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount}\n format.json { render json: response_json, status: 200 }\n end\n end", "def info\n @info ||= client.try(:get, transaction_url)||{}\n end", "def show\n @planitem = Planitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planitem }\n end\n end", "def billing_info_params\n params.require(:billing_info).permit(:bill_date, :CardInfo_id)\n end", "def account_billing_get(*args)\n # TODO: implement account_billing_get\n # options = Utils.extract_options!(args)\n raise Zoom::NotImplemented, 'account_billing_get is not yet implemented'\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def show\n @credito = Credito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credito }\n end\n end", "def show\n @ip = @customer.ips.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ip }\n end\n end", "def show\n @purchaseorder = Purchaseorder.find(params[:id])\n @purchaseorder_items = @purchaseorder.purchaseorder_items.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchaseorder }\n end\n end", "def update_billing_info\n Validation.validateParameters(params)\n billing_address = params['billing_address']\n begin \n ChargeBee::Customer.update_billing_info(@customer_id, \n :billing_address => billing_address)\n render json: {\n :forward => \"/ssp/subscription\"\n } \n rescue ChargeBee::InvalidRequestError => e\n ErrorHandler.handle_invalid_request_errors(e, self)\n rescue Exception => e\n ErrorHandler.handle_general_errors(e, self)\n end\n\n end", "def show\n @generator_info = GeneratorInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator_info }\n end\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def show\n @balance_bill = BalanceBill.includes(:patient, :provider, :balance_bill_payments, :balance_bill_sessions => :balance_bill_details).find(params[:id])\n @patient = @balance_bill.patient\n set_provider_session(@balance_bill.provider.id, @balance_bill.provider.provider_name)\n set_patient_session(@patient.id, @patient.patient_name)\n @title = \"View Balance Bill\"\n @display_sidebar = true\n session[:return_to] = balance_bill_path(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => {:balance_bill => @balance_bills } }\n end\n end", "def show\n @charging_order = ChargingOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @charging_order }\n end\n end", "def collect_billing_info\n return if self.class.to_s.match(/^Devise/) # Don't prevent logins, etc.\n return if request.path.match(/^\\/saas_admin/) # Admins don't need to pay\n return unless account = current_account # Nothing to do if there is no account\n return if !(sub = account.subscription) || sub.state.nil?\n return if sub.state == 'active' && sub.current? && !sub.needs_payment_info?\n return if sub.state == 'trial' && (!Saas::Config.require_payment_info_for_trials || !sub.needs_payment_info?)\n redirect_to billing_account_path\n end", "def billing\n user_agent = request.env['HTTP_USER_AGENT']\n billing_request_body = Billing.request_body(@session)\n parameter = Parameter.first\n\n request = Typhoeus::Request.new(parameter.billing_url, followlocation: true, body: billing_request_body, headers: {Accept: \"text/xml\", :'Content-length' => billing_request_body.bytesize, Authorization: \"Basic base64_encode('NGSER-MR2014:NGSER-MR2014')\", :'User-Agent' => user_agent})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n #response_body\n #@xml = Nokogiri.XML(Billing.response_body).xpath('//methodResponse//params//param//value//struct//member')\n @xml = Nokogiri.XML(result).xpath('//methodResponse//params//param//value//struct//member') rescue nil\n #render text: Billing.response_body.bytesize\n end", "def show\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bizcard }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n end", "def show\n render json: @purchase_list\n end" ]
[ "0.75080043", "0.75080043", "0.74623305", "0.7396445", "0.72180706", "0.68948686", "0.6824466", "0.6790777", "0.6790777", "0.6718435", "0.67106795", "0.6700457", "0.66852", "0.6640941", "0.66219884", "0.65196025", "0.65196025", "0.6509366", "0.6470568", "0.6448489", "0.6443944", "0.6437305", "0.6431144", "0.6428462", "0.6414719", "0.6398407", "0.6381619", "0.6380329", "0.6305249", "0.6294428", "0.6280628", "0.62795955", "0.62658983", "0.6254974", "0.6254974", "0.6241578", "0.6218361", "0.6180725", "0.6180725", "0.6180725", "0.6175592", "0.61704", "0.61646754", "0.6160848", "0.614164", "0.61255306", "0.61255306", "0.61255306", "0.61242753", "0.61174077", "0.6103047", "0.61009294", "0.608254", "0.6079156", "0.6078892", "0.60757077", "0.6071733", "0.60703415", "0.60646814", "0.60620433", "0.6059934", "0.605646", "0.60552305", "0.604915", "0.60473627", "0.6034224", "0.6031288", "0.60300314", "0.60273504", "0.6024548", "0.60160524", "0.60129595", "0.6010308", "0.6007042", "0.60019755", "0.5998041", "0.59962994", "0.5989414", "0.5987081", "0.5984571", "0.5984571", "0.59724885", "0.59680355", "0.59657955", "0.5965503", "0.5958863", "0.5956702", "0.5949398", "0.5947301", "0.5943469", "0.5941988", "0.5939746", "0.5939234", "0.59356874", "0.59338623", "0.59323096", "0.5932057", "0.5927918", "0.5919303", "0.59162366" ]
0.81548774
0
GET /billing_infos/new GET /billing_infos/new.json
def new @billing_info = BillingInfo.new respond_to do |format| format.html # new.html.erb format.json { render json: @billing_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully created.' }\n format.json { render json: @billing_info, status: :created, location: @billing_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_info }\n end\n end", "def new\n @billing_address = BillingAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_address }\n end\n end", "def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\n end\n end", "def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\n end\n end", "def new\r\n @bill = Bill.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @bill }\r\n end\r\n end", "def new\n @customer_bill = CustomerBill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_bill }\n end\n end", "def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end", "def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end", "def new\n @borrow_request = BorrowRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow_request }\n end\n end", "def new\n fetch_data\n @payment = Payment.new(:payment_date => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @breadcrumb = 'create'\n @bank = Bank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to(@billing_info, :notice => 'BillingInfo was successfully created.') }\n format.xml { render :xml => @billing_info, :status => :created, :location => @billing_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billing_info.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def new\n @banking_detail = BankingDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banking_detail }\n end\n end", "def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end", "def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end", "def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @billing_plan = BillingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_plan }\n end\n end", "def create\n @billing_info = BillingInfo.new(billing_info_params)\n @billing_info.company_id = current_user.company_id\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to select_plan_path, notice: 'Gracias por ingresar su información de facturación, esta será validada a la brevedad.' }\n format.json { render action: 'show', status: :created, location: @billing_info }\n else\n format.html { redirect_to select_plan_path, notice: 'Hubo un problema en la validación de los datos, por favor revíselos.' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @title = t('view.banks.new_title')\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def new\n @ip = @customer.ips.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end", "def new\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def new\n @billing_entry = BillingEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_entry }\n end\n end", "def new\n @panel_billing = Panel::Billing.new\n @countries = Country.find(:all)\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_billing }\n end\n end", "def new\n #@detail = Detail.new\n @plan = Plan.find(params[:plan_id])\n @detail = @plan.details.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detail }\n end\n end", "def new\n @payable = Payable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payable }\n end\n end", "def new\n @breadcrumb = 'create'\n @billing_frequency = BillingFrequency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_frequency }\n end\n end", "def new\n get_projects\n\n\n @breadcrumb = 'create'\n @billable_item = BillableItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billable_item }\n end\n end", "def create\n @bill_detail_info = BillDetailInfo.new(bill_detail_info_params)\n\n respond_to do |format|\n if @bill_detail_info.save\n format.html { redirect_to @bill_detail_info, notice: 'Bill detail info was successfully created.' }\n format.json { render :show, status: :created, location: @bill_detail_info }\n else\n format.html { render :new }\n format.json { render json: @bill_detail_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @member_payment = MemberPayment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member_payment }\n end\n end", "def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @purchaseorder = Purchaseorder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchaseorder }\n end\n end", "def new\n puts \"HAHAHAHAHHA\"\n @information_request = InformationRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @information_request }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @payment }\n end\n end", "def new\n @purchase_template = PurchaseTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_template }\n end\n end", "def new\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end", "def new\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @invoice }\n end\n end", "def new\n @charge = Charge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charge }\n end\n end", "def new\n @invoice = @last_invoice ? Invoice.new(@last_invoice.attributes.except('number')) : Invoice.new\n respond_to do |format|\n format.html {}\n format.json { render json: @last_invoice, status: :ok, location: @last_invoice }\n end\n\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment }\n end\n end", "def new\n @invoice = Invoice.new\n $details = Array.new\n @customers = Customer.all\n @retire_notes = Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def create\n @billing = Billing.new(billing_params)\n @billing.account = current_account\n respond_to do |format|\n if @billing.save\n format.html { redirect_to @billing, notice: 'Billing was successfully created.' }\n format.json { render :show, status: :created, location: @billing }\n else\n format.html { render :new }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @repurchase = Repurchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repurchase }\n end\n end", "def new\n @voip_cost = VoipCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voip_cost }\n end\n end", "def new\n @credit = Credit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end", "def new\n @credit = Credit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end", "def new\n @credit = Credit.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end", "def new\n @planned_order = PlannedOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @planned_order }\n end\n end", "def new\n @purchase_item = PurchaseItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_item }\n end\n end", "def new\n @bill_point = BillPoint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill_point }\n end\n end", "def new\n @origin = OriginAddr.new\n \n drop_breadcrumb('新增')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origin }\n end\n end", "def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @payment_gateway = PaymentGateway.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_gateway }\n end\n end", "def new\r\n @general_plan = GeneralPlan.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @general_plan }\r\n end\r\n end", "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def new\n @shipment = Shipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipment }\n end\n end", "def new\n @shipment = Shipment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipment }\n end\n end", "def new\n @purchase_requisition = PurchaseRequisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_requisition }\n end\n end", "def new\n @capital_account = CapitalAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @capital_account }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @internship = Internship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @internship }\n end\n end", "def new\n @invoicedetail = Invoicedetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoicedetail }\n end\n end", "def new\n @invoice = Invoice.find(cookies[:invoice_id])\n @bill = Bill.new\n run_docnumber\n default_cancel\n @bill.tax = @invoice.tax\n @bill.approve = false\n @bill.complete = false\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bill }\n format.json { render :json => @bill }\n end\n end", "def new\n @address_customer = AddressCustomer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address_customer }\n end\n end", "def new\n @credito = Credito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credito }\n end\n end", "def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end", "def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end", "def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end", "def new\n @invoice = Invoice.new\n @stores = Store.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def new\n @delivery_address = DeliveryAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_address }\n end\n end", "def new\n @shop_purchase = Shop::Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_purchase }\n end\n end", "def new \n set_tab :shopping_new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shopping }\n end\n \n end", "def new\n # customer creates a new shipping address\n end", "def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end", "def new\n @user = current_user\n @patient = @user.patients.find(params[:patient_id])\n @invoice = @patient.invoices.find(params[:invoice_id])\n @cost_types = CostType.all\n @cost_item = CostItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cost_item }\n end\n end", "def new\n @invoice_status = InvoiceStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_status }\n end\n end", "def new\n @purchase_item_status = PurchaseItemStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_item_status }\n end\n end", "def new\n @proof_cost = ProofCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proof_cost }\n end\n end", "def new\n @bill = Bill.find(params[:bill_id])\n @billed_call = @bill.billed_calls.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billed_call }\n end\n end", "def new\n @merchant = Merchant.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @merchant }\n end\n end", "def new\n @merchant = Merchant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @merchant }\n end\n end", "def new\n @payment_received = PaymentReceived.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_received }\n end\n end", "def new\n @shipping = scope.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping }\n end\n end", "def new\n @purchase_order_item = PurchaseOrderItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_order_item }\n end\n end", "def new\n @subscription_request = SubscriptionRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscription_request }\n end\n end", "def new\n @buy_in = BuyIn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @buy_in }\n end\n end", "def new\n @payment_notification = PaymentNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_notification }\n end\n end", "def new\n @purchase_receipt = PurchaseReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_receipt }\n end\n end", "def new\n @settlement = Settlement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @settlement }\n end\n end" ]
[ "0.7669924", "0.75603896", "0.7530572", "0.72412294", "0.72412294", "0.7150039", "0.712442", "0.70535386", "0.70535386", "0.7028865", "0.7011408", "0.7000077", "0.69844526", "0.69825524", "0.69704396", "0.69704396", "0.69704396", "0.6957729", "0.6957729", "0.6937579", "0.6932452", "0.69078547", "0.689047", "0.68834823", "0.6883278", "0.6879421", "0.68724114", "0.6867294", "0.68495613", "0.68164295", "0.68147594", "0.6811814", "0.6798861", "0.6797527", "0.67788315", "0.67757887", "0.6771037", "0.67384166", "0.6730316", "0.67295617", "0.6727531", "0.6715697", "0.6714633", "0.6714633", "0.6714633", "0.6710065", "0.67065084", "0.66982037", "0.669434", "0.669434", "0.669434", "0.669434", "0.669434", "0.6689904", "0.66897035", "0.66847336", "0.66847336", "0.66846955", "0.6684237", "0.66836053", "0.6682182", "0.6681305", "0.6676211", "0.6672009", "0.66529715", "0.66501594", "0.66492796", "0.66492796", "0.6643252", "0.66329217", "0.66326445", "0.66326445", "0.6628451", "0.6624942", "0.6619339", "0.661265", "0.66125435", "0.6606635", "0.6606635", "0.6604993", "0.66046995", "0.6595934", "0.65945387", "0.6593276", "0.65915513", "0.6591395", "0.65904456", "0.65791047", "0.6570164", "0.65676105", "0.6562076", "0.65545946", "0.65541077", "0.65521306", "0.6550526", "0.65492535", "0.65443784", "0.65440506", "0.65438664", "0.65393203" ]
0.8308673
0
POST /billing_infos POST /billing_infos.json
def create @billing_info = BillingInfo.new(params[:billing_info]) respond_to do |format| if @billing_info.save format.html { redirect_to @billing_info, notice: 'Billing info was successfully created.' } format.json { render json: @billing_info, status: :created, location: @billing_info } else format.html { render action: "new" } format.json { render json: @billing_info.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_info }\n end\n end", "def create\n @billing_info = BillingInfo.new(billing_info_params)\n @billing_info.company_id = current_user.company_id\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to select_plan_path, notice: 'Gracias por ingresar su información de facturación, esta será validada a la brevedad.' }\n format.json { render action: 'show', status: :created, location: @billing_info }\n else\n format.html { redirect_to select_plan_path, notice: 'Hubo un problema en la validación de los datos, por favor revíselos.' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def billing_info_params\n params.require(:billing_info).permit(:bill_date, :CardInfo_id)\n end", "def get_billing_information(data)\n {\n :first_name => data[:first_name],\n :last_name => data[:last_name],\n :email_address => data[:email_address],\n\n :street_address => data[:address][:street_address],\n :secondary_address => data[:address][:secondary_address],\n :city => data[:address][:city],\n :state => data[:address][:state],\n :zip => data[:address][:zip_code],\n :country => data[:address][:country],\n :phone_number => data[:phone_number]\n }\n end", "def create\n @bill_detail_info = BillDetailInfo.new(bill_detail_info_params)\n\n respond_to do |format|\n if @bill_detail_info.save\n format.html { redirect_to @bill_detail_info, notice: 'Bill detail info was successfully created.' }\n format.json { render :show, status: :created, location: @bill_detail_info }\n else\n format.html { render :new }\n format.json { render json: @bill_detail_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @billing_info = BillingInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_info }\n end\n end", "def create\n @billing = Billing.new(billing_params)\n @billing.account = current_account\n respond_to do |format|\n if @billing.save\n format.html { redirect_to @billing, notice: 'Billing was successfully created.' }\n format.json { render :show, status: :created, location: @billing }\n else\n format.html { render :new }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to(@billing_info, :notice => 'BillingInfo was successfully created.') }\n format.xml { render :xml => @billing_info, :status => :created, :location => @billing_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billing_info.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def index\n @billing_infos = BillingInfo.all\n end", "def index\n @billing_infos = BillingInfo.all\n end", "def billing_info_params\n params.require(:billing_info).permit(:active, :contact, :name, :rut, :address, :sector, :email, :phone, :accept, :company_id)\n end", "def set_billing_info\n @billing_info = BillingInfo.find(params[:id])\n end", "def set_billing_info\n @billing_info = BillingInfo.find(params[:id])\n end", "def update_billing_info\n Validation.validateParameters(params)\n billing_address = params['billing_address']\n begin \n ChargeBee::Customer.update_billing_info(@customer_id, \n :billing_address => billing_address)\n render json: {\n :forward => \"/ssp/subscription\"\n } \n rescue ChargeBee::InvalidRequestError => e\n ErrorHandler.handle_invalid_request_errors(e, self)\n rescue Exception => e\n ErrorHandler.handle_general_errors(e, self)\n end\n\n end", "def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_info }\n end\n end", "def billing\n request('billing', :get)\n end", "def billing\n @data[:billing]\n end", "def billing_params\n params.require(:billing).permit(:accounted_at, :client_id, :payment_method_id)\n end", "def billing_params\n params.require(:billing).permit(:firstname, :lastname, :address, :phone, :city, :state, :country, :email)\n end", "def create\n client = Client.find_by_id(billing_params[:client_id].to_i)\n if !client.billed? && client.ready_to_bill?\n @billing = BillingService.new(client).make_bill\n else\n @billing = \"Falha ao processar o pagamento. O cliente #{client.name} já foi cobrado ou não está dentro da data prevista para pagamento este mês\"\n end\n\n respond_to do |format|\n format.html { redirect_to billings_path, notice: @billing }\n end\n end", "def create\n @billing_address = BillingAddress.new(params[:billing_address])\n\n respond_to do |format|\n if @billing_address.save\n format.html { redirect_to @billing_address, notice: 'Billing address was successfully created.' }\n format.json { render json: @billing_address, status: :created, location: @billing_address }\n else\n format.html { render action: \"new\" }\n format.json { render json: @billing_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_billing_info\n billing_info = Recurly.js.fetch(params[:recurly_token])\n logger.info billing_info\n\n flash[:notice] = 'Billing information was successfully updated!'\n redirect_to app_url(subdomain: current_company.subdomain)\n end", "def create\n @billing_plan = BillingPlan.new(billing_plan_params)\n\n respond_to do |format|\n if @billing_plan.save\n format.html { redirect_to @billing_plan, notice: 'Billing plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @billing_plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @billing_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @billing_address = BillingAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_address }\n end\n end", "def validate_billing_info\n errors = {}\n\n if (posted['stripeToken'].nil? || posted['stripeToken'].empty?)\n errors['stripeToken'] = \"Your card wasn't accepted.\"\n end\n\n errors\n end", "def billing_params\n params.require(:billing).permit(:member_id, :time_in, :time_out, :price, :comment, :duration, :expiration, :number_park, :reports_attributes => [:id, :date, :time_in, :time_out, :duration, :price, :comment, :member_id, :billing_id] )\n end", "def create\n @billing_info = BillingInfo.new(bill_date: Date.today, CardInfo_id: session[:card_info_id])\n #respond_to do |format|\n if @billing_info.save\n session[:billing_info_id] = @billing_info.id \n end\n if params[:mode_of_collection][0].to_s == \"Courier\"\n redirect_to new_courier_path, notice: 'Billing info was successfully created.' \n #format.json { render action: 'show', status: :created, location: @billing_info }\n else\n session[:courier_id] = nil\n redirect_to new_order_path, notice: 'Your tickets will be available at Counter.'\n #format.html { render action: 'new' }\n #format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n #end\n end", "def billing_info_edit\n result = ChargeBee::Customer.retrieve(@customer_id)\n @customer = result.customer\n @billing_address = result.customer.billing_address\n @country_codes = get_country_codes\n end", "def create\n @bill = Bill.new(bill_params)\n\n if @bill.save\n render json: @bill, status: :created, location: @bill\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def create\n params[:panel_billing]['user_id'] = 4\n @panel_billing = Panel::Billing.new(params[:panel_billing])\n\n respond_to do |format|\n if @panel_billing.save\n format.html { redirect_to(@panel_billing, :notice => 'Billing was successfully created.') }\n format.json { render :json => @panel_billing, :status => :created, :location => @panel_billing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_billing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def build_payment_info\n {'ShipmentCharge' => build_shipment_charge }\n end", "def purchase billing, number\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PUT',\r\n query_url:query_url,\r\n body:\"{\\\"billing_method\\\": #{billing.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def information\n @selected_plan = BillingPlan.find_by(stripe_plan_id: params['plan'], available: true)\n @stripe_customer = Stripe::Customer.retrieve(current_user.stripe_customer_id)\n end", "def create\n @customer_bill = CustomerBill.new(params[:customer_bill])\n\n respond_to do |format|\n if @customer_bill.save\n format.html { redirect_to @customer_bill, notice: 'Customer bill was successfully created.' }\n format.json { render json: @customer_bill, status: :created, location: @customer_bill }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_order_billing_information(order, new_order, opts={})\n opts[:use_shipping_if_missing_info] ||= true # todo, actually use this value\n\n shipping_country = Country.find_by_iso(order.billing_country || order.shipping_country) || Country.find(Spree::Config[:default_country_id])\n state = State.find_by_name(order.billing_state || order.shipping_state) || # todo this is getting uglier by the minute\n State.find_by_abbr(order.billing_state || order.shipping_state) ||\n State.find_by_name_normalized(order.billing_state ? order.billing_state.gsub(/\\W/, '').downcase : order.shipping_state ? order.shipping_state.gsub(/\\W/, '').downcase : nil) \n\n # add billing information\n first, last = order.billing_name.split(/ /, 2)\n last = first unless last # some people just give a single name\n billing = Address.create(:firstname => first,\n :lastname => last,\n :phone => order.billing_phone_number,\n :email => order.billing_email,\n :country_id => shipping_country.id,\n :address1 => order.billing_address_one || order.shipping_address_one,\n :address2 => order.billing_address_two || order.shipping_address_two,\n :city => order.billing_city || order.shipping_city,\n :state_id => state.id,\n :zipcode => order.billing_zip || order.shipping_zip)\n \n\n # attr_at_xpath :billing_email, \"/BillingData/BuyerEmailAddress\"\n # new_order.bill_address = billing\n billing.addressable = new_order.creditcard_payment\n billing.save_without_validation\n end", "def create\n @billing_plan = BillingPlan.new(params[:billing_plan])\n\n respond_to do |format|\n if @billing_plan.save\n format.html { redirect_to(@billing_plan, :notice => 'Billing plan was successfully created.') }\n format.xml { render :xml => @billing_plan, :status => :created, :location => @billing_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billing_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer_info = CustomerInfo.new(customer_info_params)\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully created.' }\n format.json { render :show, status: :created, location: @customer_info }\n else\n format.html { render :new }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bill = Bill.new(bill_params)\n \n if @bill.save\n render json: { bill: @bill }, status: :ok\n else\n render json: { errors: @bill.errors, status: 501 }\n end\n end", "def info_params\n params.require(:info).permit(:Address1, :Address2, :AnyFlag, :AuthNo, :BillingAddress1, :BillingAddress2, :BillingCity, :BillingCompany, :BillingCountry, :BillingEmail, :BillingEmail2, :BillingFirstName, :BillingLastName, :BillingPhone, :BillingState, :BillingZipCode, :CardNumber, :CashRecvd, :CheckNumber, :City, :Cnt2, :Cnt1, :Cnt3, :Cnt4, :Cnt5, :Cnt6, :Cnt8, :Cnt9, :Cnt10, :Comment, :Company, :Conference, :Country, :CustPONo, :CustType, :Deleted, :DidAffil, :DidCCRpt, :DidEmail, :DidPrint, :DidShort, :DidVisa, :Done, :Email, :Email2, :ExpirDate, :FECustNum, :FirstName, :Flag1, :Flag2, :Flag8, :Flag9, :Flag10, :Flag10, :FreeUpgrade, :Gift, :GotEmail, :InvoiceNo, :InvTotal, :Kind, :LastName, :NoEmailContact, :NoEmailContact, :OldRIN, :OrderDate, :OrderTag, :Origin, :OtherAmount, :OtherDesc, :PackSlipCnt, :Phone, :RegisterTo, :SalesPerson, :SalesTax, :SalesTaxAdj, :ShipDate, :ShippingChg, :ShipType, :ShipVia, :ShopOrderNum, :SiteLicNum, :State, :Tagged, :TaxExempt, :TempCustNum, :Terms, :TotalSale, :TotalSale, :xDidAffil, :xDidPrint, :xDidVisa, :xxRecNum, :ZipCode)\n end", "def billing\n user_agent = request.env['HTTP_USER_AGENT']\n billing_request_body = Billing.request_body(@session)\n parameter = Parameter.first\n\n request = Typhoeus::Request.new(parameter.billing_url, followlocation: true, body: billing_request_body, headers: {Accept: \"text/xml\", :'Content-length' => billing_request_body.bytesize, Authorization: \"Basic base64_encode('NGSER-MR2014:NGSER-MR2014')\", :'User-Agent' => user_agent})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n #response_body\n #@xml = Nokogiri.XML(Billing.response_body).xpath('//methodResponse//params//param//value//struct//member')\n @xml = Nokogiri.XML(result).xpath('//methodResponse//params//param//value//struct//member') rescue nil\n #render text: Billing.response_body.bytesize\n end", "def post_billing(req)\n with_stripe_error_handlers do\n customer = Stripe::Customer.retrieve(@dealership.customer_id)\n customer.card = posted['stripeToken']\n customer.save\n req.session['billing_flash_msg'] = \"Card updated successfully.\"\n redirect \"/admin/#{@dealership.slug}/billing\"\n end\n end", "def create\n @payable_billing = PayableBilling.new(params[:payable_billing])\n\n respond_to do |format|\n if @payable_billing.save\n flash[:notice] = 'Pagamento criado.'\n format.html { redirect_to(@payable_billing) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def collect_billing_info\n return if self.class.to_s.match(/^Devise/) # Don't prevent logins, etc.\n return if request.path.match(/^\\/saas_admin/) # Admins don't need to pay\n return unless account = current_account # Nothing to do if there is no account\n return if !(sub = account.subscription) || sub.state.nil?\n return if sub.state == 'active' && sub.current? && !sub.needs_payment_info?\n return if sub.state == 'trial' && (!Saas::Config.require_payment_info_for_trials || !sub.needs_payment_info?)\n redirect_to billing_account_path\n end", "def billing_params_to_create\n params.require(:billing).permit(:student_id, :desired_due_day, :installments_count)\n end", "def create\n @shipping_information = ShippingInformation.new(shipping_information_params)\n @address = Address.all\n respond_to do |format|\n if @shipping_information.save\n format.html { redirect_to @shipping_information, notice: 'La información de envío se guardó correctamente.' }\n format.json { render :show, status: :created, location: @shipping_information }\n else\n format.html { render :new }\n format.json { render json: @shipping_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @billing_entry = BillingEntry.new(params[:billing_entry])\n\n respond_to do |format|\n if @billing_entry.save\n flash[:notice] = 'BillingEntry was successfully created.'\n format.html { redirect_to(@billing_entry) }\n format.xml { render :xml => @billing_entry, :status => :created, :location => @billing_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billing_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @billing_info = BillingInfo.find(params[:id])\n\n respond_to do |format|\n if @billing_info.update_attributes(params[:billing_info])\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def billing_person\n build_billing_person\n end", "def new\n @panel_billing = Panel::Billing.new\n @countries = Country.find(:all)\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_billing }\n end\n end", "def create\n @sender = params[:sender]\n @destination = params[:destination]\n @package = params[:package]\n @notification = params[:notification]\n @preferences = params[:preferences]\n @settlement_info = params[:settlement_info]\n @request = {\n sender: @sender,\n destination: @destination,\n package: @package,\n notification: @notification,\n preferences: @preferences,\n settlement_info: @settlement_info,\n group_id: '5241556',\n mailing_date: Date.today,\n contract_number: '0042956527',\n service_code: params[:service_code],\n mobo: {\n customer_number: params[:mobo],\n username: 'bc02d6bd3733555c',\n password: '111d1a0d29fc00aa47b66a',\n contract_number: '0042956527'\n }\n }\n puts \"**** #{@request}\"\n\n @response = CANADA_POST_SERVICE.create(\n sender: @sender,\n destination: @destination,\n package: @package,\n notification: @notification,\n preferences: @preferences,\n settlement_info: @settlement_info,\n group_id: '5241556',\n mailing_date: Date.today,\n contract_id: '0042956527',\n service_code: params[:service_code],\n mobo: {\n customer_number: params[:mobo],\n username: 'bc02d6bd3733555c',\n password: '111d1a0d29fc00aa47b66a',\n contract_number: '0042956527'\n }\n )\n puts \"Full Response: #{@response}\"\n unless @response[:create_shipping][:errors].present?\n Shipping.track_shipping(@response)\n end\n respond_to do |format|\n format.js {}\n end\n end", "def show\n @billing_address = BillingAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_address }\n end\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 update\n respond_to do |format|\n if @billing_info.update(billing_info_params)\n format.html { redirect_to select_plan_path, notice: 'Gracias por actualizar su información de facturación, esta será validada a la brevedad.' }\n format.json { head :no_content }\n else\n format.html { redirect_to select_plan_path, notice: 'Hubo un problema en la validación de los datos, por favor revíselos.' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @billing = Billing.new(billing_params)\n respond_to do |format|\n # format.html { render :new }\n # format.json { render json: @billing.errors, status: :unprocessable_entity }\n if @billing.save\n # @servo.on\n @servo.position = 0\n # format.html { render :show, :portal_terangkat => true, notice: 'Billing Berhasil Dibuat.' }\n format.html { redirect_to billings_path(:portal_terangkat => true), notice: 'Billing Berhasil Dibuat.' }\n # format.json { render :show, status: :created, location: @billing }\n # format.json { render :new }\n\n else\n # @servo.off\n @servo.position = 100\n format.html { render :new, :portal_terangkat => false }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_details(details)\n response = adyen_client.checkout.payments_api.payments_details(details)\n puts response.to_json\n response\n end", "def bill_params\n params.require(:bill).permit(:bill_no, :customer_id, :billable, :bill_date, :paid_date, :freight, :memo, :vendor_id)\n end", "def create\n @bill = Bill.new(bill_params)\n\n respond_to do |format|\n if @bill.save\n format.html { redirect_to @bill, notice: 'Bill was successfully created.' }\n format.json { render :show, status: :created, location: @bill }\n else\n format.html { render :new }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bill = Bill.new(bill_params)\n\n respond_to do |format|\n if @bill.save\n format.html { redirect_to @bill, notice: 'Bill was successfully created.' }\n format.json { render :show, status: :created, location: @bill }\n else\n format.html { render :new }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bill = Bill.new(bill_params)\n\n respond_to do |format|\n if @bill.save\n format.html { redirect_to @bill, notice: 'Bill was successfully created.' }\n format.json { render :show, status: :created, location: @bill }\n else\n format.html { render :new }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def before_POST(req)\n super\n @errors = validate_billing_info\n render template_path() if has_errors?\n end", "def check_billing_info(report, page)\n begin\n if(page.bill_name.downcase.include? \"digital automation\")\n report.billname = page.bill_name\n else\n report.billname = 'FAILED'\n end\n rescue => e\n report.billname = 'FAILED'\n end\n\n begin\n if(page.billing_address.include?(\"123 QATest Street\") && page.billing_address.include?('Anywhere') && page.billing_address.include?('CA') && page.billing_address.include?('90405'))\n report.billaddress = page.billing_address\n else\n report.billaddress = 'FAILED'\n end\n rescue => e\n report.billaddress = 'FAILED'\n end\n \n begin\n if(page.shipping_address.include?(\"123 QATest Street\") && page.shipping_address.include?('Anywhere') && page.shipping_address.include?('CA') && page.shipping_address.include?('90405'))\n report.shipaddress = page.shipping_address\n else\n report.shipaddress = 'FAILED'\n end\n rescue => e\n report.shipaddress = 'FAILED'\n end\n\n begin\n if(page.bill_email.include? @configuration['ConfEmailOverride'])\n report.billemail = page.bill_email\n else\n report.billemail = 'FAILED'\n end\n rescue => e\n report.billemail = 'FAILED'\n end\n end", "def new\n @customer_bill = CustomerBill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer_bill }\n end\n end", "def create\n @bill = Bill.new(bill_params)\n\n respond_to do |format|\n if @bill.save\n format.html { redirect_to @bill, notice: 'Bill was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bill }\n else\n format.html { render action: 'new' }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def shipping_information_params\n params.require(:shipping_information).permit(:phone, :additional_info, :address_id)\n end", "def update\n respond_to do |format|\n if @billing_info.update(billing_info_params)\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_bepaid_bill\n # Don't touch real web services during of test database initialization\n return if Rails.env.test?\n\n user = self\n\n bp = BePaid::BePaid.new Setting['bePaid_baseURL'], Setting['bePaid_ID'], Setting['bePaid_secret']\n\n amount = user.monthly_payment_amount\n\n #amount is (amoint in BYN)*100\n bill = {\n request: {\n amount: (amount * 100).to_i,\n currency: 'BYN',\n description: 'Членский взнос',\n email: 'jekhor@gmail.com',\n notification_url: 'https://hackerspace.by/admin/erip_transactions/bepaid_notify',\n ip: '127.0.0.1',\n order_id: '4444',\n customer: {\n first_name: 'Cool',\n last_name: 'Hacker',\n },\n payment_method: {\n type: 'erip',\n account_number: 444,\n permanent: 'true',\n editable_amount: 'true',\n service_no: Setting['bePaid_serviceNo'],\n }\n }\n }\n req = bill[:request]\n req[:email] = user.email\n req[:order_id] = user.id\n req[:customer][:first_name] = user.first_name\n req[:customer][:last_name] = user.last_name\n req[:payment_method][:account_number] = user.id\n\n begin\n res = bp.post_bill bill\n logger.debug JSON.pretty_generate res\n rescue => e\n logger.error e.message\n logger.error e.http_body if e.respond_to? :http_body\n user.errors.add :base, \"Не удалось создать счёт в bePaid, проверьте лог\"\n end\n end", "def billing_information_hash\n output = {}\n\n @state = \"\"\n case\n when cc_state_us_select.visible?\n @state = cc_state_us_select.first_selected_option.text\n when cc_state_ca_select.visible?\n @state = cc_state_ca_select.first_selected_option.text\n else\n @state = cc_state_select.value\n end\n output[\"Billing Street Address:\"] = cc_address_tb.value\n output[\"Billing City:\"] = cc_city_tb.value\n output[\"Billing State/Province:\"] = @state\n output[\"Billing Country:\"] = cc_country_select.first_selected_option.text\n output[\"Billing ZIP/Postal Code:\"] = cc_zip_tb.value\n output[\"Billing Email\"] = cc_email_tb.value\n output[\"Billing Phone:\"] = cc_phone_tb.value\n output\n end", "def new\n @billing_plan = BillingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_plan }\n end\n end", "def create\n @bank_detail = BankDetail.new(bank_detail_params)\n\n respond_to do |format|\n if @bank_detail.save\n format.html { redirect_to @bank_detail, notice: 'Bank detail was successfully created.' }\n format.json { render :show, status: :created, location: @bank_detail }\n else\n format.html { render :new }\n format.json { render json: @bank_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def information\n @selected_plan = BillingPlan.find_by(stripe_plan_id: params['plan'], available: true)\n @stripe_customer = Stripe::Customer.retrieve(current_user.stripe_customer_id)\n\n Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'viewed payment method page', {\n 'current billing plan': current_user.selected_billing_plan_id,\n 'content count': current_user.content_count\n }) if Rails.env.production?\n end", "def customer_info_params\n params.require(:customer_info).permit(:user_id, :real_name, :comment_info, :phone_number, :resturant_address, :identify_number)\n end", "def create\n @bill = Bill.new.extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end", "def new\n @billing_entry = BillingEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_entry }\n end\n end", "def create\n @banking_detail = BankingDetail.new(params[:banking_detail])\n\n respond_to do |format|\n if @banking_detail.save\n format.html { redirect_to @banking_detail, notice: 'Banking detail was successfully created.' }\n format.json { render json: @banking_detail, status: :created, location: @banking_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @banking_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def billing_plan_params\n params.require(:billing_plan).permit(:description, :days, :active)\n end", "def create\n @plan = Plan.new(plan_params)\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def purchase_options\n {\n :ip => ip_address,\n :billing_address => {\n :name => name,\n :address1 => address,\n :city => city,\n :state => state,\n :country => country,\n :zip => zip\n }\n }\n end", "def create\n @bill_entry = BillEntry.new(bill_entry_params)\n\n respond_to do |format|\n if @bill_entry.save\n format.html { redirect_to @bill_entry, notice: 'Bill entry was successfully created.' }\n format.json { render :show, status: :created, location: @bill_entry }\n else\n format.html { render :new }\n format.json { render json: @bill_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(params[:plan])\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def create\n begin\n purchase = Purchase.new(history_params)\n purchase.package = @package\n purchase.user = current_user\n\n # Get the credit card details submitted by the form\n token = stripe_token_params\n\n # Create the charge on Stripe's servers - this will charge the user's card\n Purchase.transaction do\n promo = ParamsHelper.parse_promo_code_query(params)\n total = @package.total\n if promo\n total = promo.discount_price(total)\n purchase.promo_code = promo\n purchase.discount = @package.total - total\n end\n begin\n charge = Stripe::Charge.create(\n :amount =>(total * 100).to_i(), # amount in cents\n :currency => \"cad\",\n :source => token[:id],\n :description => \"#{@package.quantity} bids purchased\"\n )\n purchase.transaction_id = charge.id\n purchase.total = total\n\n if purchase.save\n render json: purchase\n else\n # This should NEVER happen, if it does, it requires immediate investigation\n logger.fatal \"Trying to create purchase #{purchase.inspect} resulted in errors: #{purchase.errors.full_messages}\"\n errors = errors_to_hash(purchase)\n render json: errors, status: :unprocessable_entity\n end\n rescue Stripe::CardError => e\n logger.warn \"Card declined for purchase #{purchase.inspect}\"\n warn_exception(e)\n errors = [ \"Your credit card was declined by Stripe, please contact support\"]\n render json: errors, status: :unprocessable_entity\n end\n end\n rescue ActiveRecord::RecordNotFound\n render json: {:promo_code => \"Promotion code is invalid\"}, status: :bad_request\n end\n end", "def create\n @payment = Payment.new(payment_params)\n @payment.order_id = params[:order_id]\n respond_to do |format|\n if @payment.save\n response_json = {cardNo: @payment.cardNo, expires: @payment.expires, name: @payment.name, amount: @payment.amount, _links: { next: {profile: \"http://#{my_address}:3000/order\", href: \"http://#{my_address}:3000/orders/#{@payment.order_id}\", enctype: 'application/json'}}}\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: response_json, status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @freight_bill = FreightBill.new(freight_bill_params)\n\n respond_to do |format|\n if @freight_bill.save\n format.html { redirect_to @freight_bill, notice: 'Freight bill was successfully created.' }\n format.json { render :show, status: :created, location: @freight_bill }\n else\n format.html { render :new }\n format.json { render json: @freight_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @bill = Bill.new(params[:bill])\r\n\r\n respond_to do |format|\r\n if @bill.save\r\n format.html { redirect_to @bill, notice: 'Bill was successfully created.' }\r\n format.json { render json: @bill, status: :created, location: @bill }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @bill.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n \n if params[:user][:app] == \"instainvoice\"\n options = {:body => {:user => {\n :email => params[:user][:email], :password => params[:user][:password], \n :referrer => params[:user][:referrer], :source => \"InstaInvoice\"}\n }\n \n }\n resp = HTTParty.post(\"http://billing.breeasy.com/api/v1/users.json\", options)\n #raise resp.body.inspect\n retval = JSON.parse(resp.body)\n elsif params[:user][:app] == \"bfsb\"\n \n options = {:body => {:user => {:email => params[:user][:email], :password => params[:user][:password],\n :first_name => params[:user][:first_name], :last_name => params[:user][:last_name],\n :title => params[:user][:title],\n :username => params[:user][:username],:refferal_code => params[:user][:referral_code]}\n },\n :query => {:plan_id => params[:plan_id]}\n }\n resp = HTTParty.post(\"http://app.breeasy.com/api/v1/users.json\", options)\n retval = JSON.parse(resp.body)\n \n end\n # user = User.find 35\n \n respond_to do |format|\n format.json { render :json => retval } # note, no :location or :status options\n end\n end", "def payment_params\n params.require(:payment).permit(:customer_id, :visit_id, :method, :credit_card_no, :paid, :paid_at, billing_address_attributes: [ :street1, :street2, :city, :state, :zip, :name_on_card ])\n end", "def create\n @bill = Bill.new(params[:bill])\n\n respond_to do |format|\n if @bill.save\n BillFetcher.fetch @bill\n format.html { redirect_to @bill, notice: 'Bill was successfully created.' }\n format.json { render json: @bill, status: :created, location: @bill }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def bill_params\n params.require(:bill).permit(:name, :notice, :currency, :footer, :date, :due_date, :client_id, services_attributes: [:id, :bill_id, :name, :description, :amount, :currency, :quantity, :_destroy])\n end", "def billing\n authorize current_user.organization\n if request.get?\n load_receipts\n if current_user.organization.stripe_customer.present?\n @default_card = current_user.organization.default_card\n\n if @default_card.present?\n @masked_card_number = \"**** **** **** #{@default_card.last4}\"\n @button_label = \"Update Credit Card\"\n else\n @button_label = \"Add Credit Card\"\n end\n else\n @button_label = \"Add Credit Card\"\n end\n else\n #{\"stripeToken\"=>\"tok_1DMMCKBtjjIyBvbaLqcBqsD4\", \"stripeTokenType\"=>\"card\", \"stripeEmail\"=>\"user@gmail.com\", \"controller\"=>\"home\", \"action\"=>\"stripe\"}\n if current_user.organization.stripe_customer_id.blank?\n #You do not have to assign a source to create a customer.\n # However, if you set the customer up on a subscription, they will require a source to be available, and the charges will be made to the customer's default_source.\n # If a customer has only one source, it is automatically the default_source.\n customer = Stripe::Customer.create(\n source: params.fetch(:stripeToken),\n email: params.fetch(:stripeEmail)\n )\n organization = current_user.organization\n organization.stripe_customer_id = customer.id\n organization.save!\n else\n #you can also add a new card to an existing customer, using a token:\n customer = Stripe::Customer.retrieve(current_user.organization.stripe_customer_id)\n stripe_card = customer.sources.create(source: params.fetch(:stripeToken))\n\n #Once you have a card assigned to the customer, you can make it the default_source, using this:\n customer.default_source = customer.sources.retrieve(stripe_card.id)\n customer.save\n end\n\n # so that you can't simulate same POST request multiple times(stripeToken must be unique)\n redirect_to profile_billing_path\n end\n end", "def create\n @transactionbill = Transactionbill.new(transactionbill_params)\n\n respond_to do |format|\n if @transactionbill.save\n format.html { redirect_to @transactionbill, notice: 'Transactionbill was successfully created.' }\n format.json { render :show, status: :created, location: @transactionbill }\n else\n format.html { render :new }\n format.json { render json: @transactionbill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @billing.update(billing_params)\n format.html { redirect_to @billing, notice: \"Billing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @billing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_bill_detail = Admin::BillDetail.new(admin_bill_detail_params)\n @admin_bill_detail.user = current_user\n respond_to do |format|\n if @admin_bill_detail.save\n @admin_bill_details = Admin::BillDetail.paginate(:page => params[:page])\n format.html { redirect_to @admin_bill_detail, notice: t(:bill_details_created_success) }\n format.json { render :show, status: :created, location: @admin_bill_detail }\n format.js { render :layout => false }\n else\n format.html { render :new }\n format.json { render json: @admin_bill_detail.errors, status: :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n end", "def account_billing_with_http_info(account_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BillingApi.account_billing ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling BillingApi.account_billing\"\n end\n # resource path\n local_var_path = '/accounts/{accountId}/billing'.sub('{' + 'accountId' + '}', account_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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20014')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BillingApi#account_billing\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def purchase_bill_params\n params.require(:purchase_bill).permit(:date, :condition, :number, :total, :balance, :provider_id,\n :purchase_details_attributes => [:id, :quantity, :material_id, :price, :total, :_destroy],\n :installment_purchases_attributes => [:id, :amount, :balance, :due_date, :_destroy])\n end", "def billing\n user_agent = request.env['HTTP_USER_AGENT']\n #parameter = Parameter.first\n transaction_id = DateTime.now.to_i\n\n request = Typhoeus::Request.new(\"http://37.0.73.3:3778\", followlocation: true, params: {transaction_id: transaction_id, msisdn: @account.msisdn, price: \"50\"})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n return ((result.strip rescue nil) == \"1\" ? true : false)\n end", "def create\n @info_dispatch_order = InfoDispatchOrder.new(info_dispatch_order_params)\n\n respond_to do |format|\n if @info_dispatch_order.save\n format.html { redirect_to @info_dispatch_order, notice: 'Info dispatch order was successfully created.' }\n format.json { render :show, status: :created, location: @info_dispatch_order }\n else\n format.html { render :new }\n format.json { render json: @info_dispatch_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def show_info\n render json: TrackingInformationQuery.single(@tracking_information, @order), status: 200\n end", "def successful_purchase_response\n '\n {\n \"bill\": {\n \"id\": 7440626,\n \"code\": null,\n \"amount\": \"100.0\",\n \"installments\": 1,\n \"status\": \"paid\",\n \"seen_at\": null,\n \"billing_at\": null,\n \"due_at\": null,\n \"url\": \"https://sandbox-app.vindi.com.br/customer/bills/7440626?token=2099fc97-8a73-48b8-bb1d-c3e4d2db5b90\",\n \"created_at\": \"2022-06-07T18:38:20.000-03:00\",\n \"updated_at\": \"2022-06-07T18:38:21.000-03:00\",\n \"bill_items\": [\n {\n \"id\": 14136625,\n \"amount\": \"100.0\",\n \"quantity\": null,\n \"pricing_range_id\": null,\n \"description\": null,\n \"pricing_schema\": null,\n \"product\": {\n \"id\": 160701,\n \"name\": \"Produto VINDI\",\n \"code\": null\n },\n \"product_item\": null,\n \"discount\": null\n }\n ],\n \"charges\": [\n {\n \"id\": 7245405,\n \"amount\": \"100.0\",\n \"status\": \"paid\",\n \"due_at\": \"2022-06-07T23:59:59.000-03:00\",\n \"paid_at\": \"2022-06-07T18:38:21.000-03:00\",\n \"installments\": 1,\n \"attempt_count\": 1,\n \"next_attempt\": null,\n \"print_url\": null,\n \"created_at\": \"2022-06-07T18:38:20.000-03:00\",\n \"updated_at\": \"2022-06-07T18:38:21.000-03:00\",\n \"last_transaction\": {\n \"id\": 7542009,\n \"transaction_type\": \"charge\",\n \"status\": \"success\",\n \"amount\": \"100.0\",\n \"installments\": 1,\n \"gateway_message\": \"Transacao aprovada\",\n \"gateway_response_code\": null,\n \"gateway_authorization\": \"03508DDF8C9C0B5B61E1067AC69E5C12\",\n \"gateway_transaction_id\": \"936f8b41-8df9-49b4-8efc-30c95cd40555\",\n \"gateway_response_fields\": {\n \"nsu\": \"BC7F44F6E2E1D565A63CD051783AFAA6\"\n },\n \"fraud_detector_score\": null,\n \"fraud_detector_status\": null,\n \"fraud_detector_id\": null,\n \"created_at\": \"2022-06-07T18:38:20.000-03:00\",\n \"gateway\": {\n \"id\": 3153,\n \"connector\": \"fake\"\n },\n \"payment_profile\": {\n \"id\": 1021243,\n \"holder_name\": \"LONGBOB LONGSEN\",\n \"registry_code\": null,\n \"bank_branch\": null,\n \"bank_account\": null,\n \"card_expiration\": \"2023-09-30T23:59:59.000-03:00\",\n \"allow_as_fallback\": null,\n \"card_number_first_six\": \"444444\",\n \"card_number_last_four\": \"4448\",\n \"renewed_card\": {\n \"card_number_last_four\": null,\n \"card_expiration\": null\n },\n \"card_renewed_at\": null,\n \"token\": \"cb0d8927-c067-4a9c-a065-95b735592f26\",\n \"created_at\": \"2022-06-07T18:38:19.000-03:00\",\n \"payment_company\": {\n \"id\": 13,\n \"name\": \"Visa\",\n \"code\": \"visa\"\n }\n }\n },\n \"payment_method\": {\n \"id\": 6230,\n \"public_name\": \"Cartão de crédito\",\n \"name\": \"Cartão de crédito\",\n \"code\": \"credit_card\",\n \"type\": \"PaymentMethod::CreditCard\"\n }\n }\n ],\n \"customer\": {\n \"id\": 1485236,\n \"name\": \"Jane Doe\",\n \"email\": \"jane@doe.com\",\n \"code\": null\n },\n \"period\": null,\n \"subscription\": null,\n \"metadata\": {},\n \"payment_profile\": {\n \"id\": 1021243,\n \"holder_name\": \"LONGBOB LONGSEN\",\n \"registry_code\": null,\n \"bank_branch\": null,\n \"bank_account\": null,\n \"card_expiration\": \"2023-09-30T23:59:59.000-03:00\",\n \"allow_as_fallback\": null,\n \"card_number_first_six\": \"444444\",\n \"card_number_last_four\": \"4448\",\n \"renewed_card\": {\n \"card_number_last_four\": null,\n \"card_expiration\": null\n },\n \"card_renewed_at\": null,\n \"token\": \"cb0d8927-c067-4a9c-a065-95b735592f26\",\n \"created_at\": \"2022-06-07T18:38:19.000-03:00\",\n \"payment_company\": {\n \"id\": 13,\n \"name\": \"Visa\",\n \"code\": \"visa\"\n }\n },\n \"payment_condition\": null\n }\n }\n '\n end", "def order\n params.permit(order_attrs).tap do |ans|\n si = Hash(params[:shipping_info])\n bi = Hash(params[:billing_info])\n ans[:shipping_info][:name] = si[:first_name] if si[:name].blank? && si[:first_name].present?\n ans[:billing_info][:name] = bi[:first_name] if bi[:name].blank? && bi[:first_name].present?\n end\n end", "def index\n @bill_detail_infos = BillDetailInfo.all\n end", "def new\n @invoice = Invoice.new\n $details = Array.new\n @customers = Customer.all\n @retire_notes = Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end" ]
[ "0.72587776", "0.7185455", "0.69965315", "0.69143224", "0.6884329", "0.68250376", "0.6822092", "0.6804976", "0.6750653", "0.6750653", "0.66991025", "0.66827124", "0.66827124", "0.6565685", "0.6546315", "0.650386", "0.6472567", "0.6433595", "0.63902986", "0.6374602", "0.6370367", "0.6367491", "0.63656026", "0.62993073", "0.62981284", "0.62909335", "0.6251223", "0.6234259", "0.6186723", "0.617783", "0.615625", "0.6077525", "0.6025389", "0.60229915", "0.60082805", "0.5998716", "0.5997733", "0.5990398", "0.59900606", "0.59836495", "0.59704393", "0.5968654", "0.59489363", "0.5938782", "0.5924699", "0.59229034", "0.5908162", "0.5907605", "0.5887089", "0.5884448", "0.5880739", "0.58739424", "0.5866382", "0.5846184", "0.58366066", "0.58209634", "0.58159506", "0.58159506", "0.58159506", "0.5815072", "0.5799107", "0.57887423", "0.5785129", "0.57846093", "0.57804656", "0.57792604", "0.5774304", "0.5767008", "0.5751153", "0.57391363", "0.57279795", "0.5719074", "0.57172674", "0.57140917", "0.5710364", "0.56936", "0.569307", "0.5692483", "0.5691208", "0.5680751", "0.5675229", "0.5673696", "0.56726336", "0.5669739", "0.5665316", "0.56627554", "0.5647375", "0.56432205", "0.5631115", "0.5624333", "0.5621123", "0.56163627", "0.5609077", "0.5602864", "0.5601885", "0.5601004", "0.5594285", "0.55929536", "0.55923545", "0.55887955" ]
0.7785259
0
PUT /billing_infos/1 PUT /billing_infos/1.json
def update @billing_info = BillingInfo.find(params[:id]) respond_to do |format| if @billing_info.update_attributes(params[:billing_info]) format.html { redirect_to @billing_info, notice: 'Billing info was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @billing_info.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @billing_info.update(billing_info_params)\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_billing_info\n @billing_info = BillingInfo.find(params[:id])\n end", "def set_billing_info\n @billing_info = BillingInfo.find(params[:id])\n end", "def update_billing_info\n Validation.validateParameters(params)\n billing_address = params['billing_address']\n begin \n ChargeBee::Customer.update_billing_info(@customer_id, \n :billing_address => billing_address)\n render json: {\n :forward => \"/ssp/subscription\"\n } \n rescue ChargeBee::InvalidRequestError => e\n ErrorHandler.handle_invalid_request_errors(e, self)\n rescue Exception => e\n ErrorHandler.handle_general_errors(e, self)\n end\n\n end", "def update\n respond_to do |format|\n if @billing.update(billing_params)\n format.html { redirect_to @billing, notice: \"Billing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @billing }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @billing.update(billing_params)\n format.html { redirect_to @billing, notice: 'Billing was successfully updated.' }\n format.json { render :show, status: :ok, location: @billing }\n else\n format.html { render :edit }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_billing_info\n billing_info = Recurly.js.fetch(params[:recurly_token])\n logger.info billing_info\n\n flash[:notice] = 'Billing information was successfully updated!'\n redirect_to app_url(subdomain: current_company.subdomain)\n end", "def update\n respond_to do |format|\n if @billing_info.update(billing_info_params)\n format.html { redirect_to select_plan_path, notice: 'Gracias por actualizar su información de facturación, esta será validada a la brevedad.' }\n format.json { head :no_content }\n else\n format.html { redirect_to select_plan_path, notice: 'Hubo un problema en la validación de los datos, por favor revíselos.' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @billing_info = BillingInfo.find(params[:id])\n\n respond_to do |format|\n if @billing_info.update_attributes(params[:billing_info])\n format.html { redirect_to(@billing_info, :notice => 'BillingInfo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @billing_info.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to @billing_info, notice: 'Billing info was successfully created.' }\n format.json { render json: @billing_info, status: :created, location: @billing_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @billing_address = BillingAddress.find(params[:id])\n\n respond_to do |format|\n if @billing_address.update_attributes(params[:billing_address])\n format.html { redirect_to @billing_address, notice: 'Billing address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @billing_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def billing_info_params\n params.require(:billing_info).permit(:bill_date, :CardInfo_id)\n end", "def update\n respond_to do |format|\n if @billing_plan.update(billing_plan_params)\n format.html { redirect_to @billing_plan, notice: 'Billing plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @billing_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill_detail_info.update(bill_detail_info_params)\n format.html { redirect_to @bill_detail_info, notice: 'Bill detail info was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill_detail_info }\n else\n format.html { render :edit }\n format.json { render json: @bill_detail_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @billing_info = BillingInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_info }\n end\n end", "def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billing_info }\n end\n end", "def create\n @billing_info = BillingInfo.new(billing_info_params)\n @billing_info.company_id = current_user.company_id\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to select_plan_path, notice: 'Gracias por ingresar su información de facturación, esta será validada a la brevedad.' }\n format.json { render action: 'show', status: :created, location: @billing_info }\n else\n format.html { redirect_to select_plan_path, notice: 'Hubo un problema en la validación de los datos, por favor revíselos.' }\n format.json { render json: @billing_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @billing_plan = BillingPlan.find(params[:id])\n\n respond_to do |format|\n if @billing_plan.update_attributes(params[:billing_plan])\n format.html { redirect_to(@billing_plan, :notice => 'Billing plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @billing_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_billing\n @billing = Billing.find(params[:id])\n end", "def set_billing\n @billing = Billing.find(params[:id])\n end", "def set_billing\n @billing = Billing.find(params[:id])\n end", "def billing_info_params\n params.require(:billing_info).permit(:active, :contact, :name, :rut, :address, :sector, :email, :phone, :accept, :company_id)\n end", "def billing_info_edit\n result = ChargeBee::Customer.retrieve(@customer_id)\n @customer = result.customer\n @billing_address = result.customer.billing_address\n @country_codes = get_country_codes\n end", "def purchase billing, number\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PUT',\r\n query_url:query_url,\r\n body:\"{\\\"billing_method\\\": #{billing.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def create\n @billing = Billing.new(billing_params)\n @billing.account = current_account\n respond_to do |format|\n if @billing.save\n format.html { redirect_to @billing, notice: 'Billing was successfully created.' }\n format.json { render :show, status: :created, location: @billing }\n else\n format.html { render :new }\n format.json { render json: @billing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @panel_billing = Panel::Billing.find(params[:id])\n\n respond_to do |format|\n if @panel_billing.update_attributes(params[:panel_billing])\n format.html { redirect_to(panel_subscribe_index_path, :notice => 'Billing was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_billing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @bill.update(bill_params)\n render json: { bill: @bill }, status: :ok\n else\n render json: { errors: @bill.errors, status: 501 }\n end\n end", "def update\n @billing_entry = BillingEntry.find(params[:id])\n\n respond_to do |format|\n if @billing_entry.update_attributes(params[:billing_entry])\n flash[:notice] = 'BillingEntry was successfully updated.'\n format.html { redirect_to(@billing_entry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @billing_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find_by(uid:params[:id]).extend(Billit::BillRepresenter)\n @bill.from_json(request.body.read)\n @bill.save\n begin\n Sunspot.index!(@bill)\n rescue\n puts \"#{$!}\"\n puts \"unindexed bill: \" + @bill.uid\n end\n respond_with @bill, :represent_with => Billit::BillRepresenter\n end", "def update_account_info\n Validation.validateParameters(params)\n begin\n customer_id = @customer_id\n result = ChargeBee::Customer.update(customer_id, {:first_name => params['first_name'],\n :last_name => params['last_name'],\n :email => params['email'],\n :company => params['company'],\n :phone => params['phone']\n }) \n render json: {\n :forward => \"/ssp/subscription\"\n }\n rescue ChargeBee::InvalidRequestError => e\n ErrorHandler.handle_invalid_request_errors(e, self)\n rescue Exception => e\n ErrorHandler.handle_general_errors(e, self)\n end\n end", "def update\n @reserver = @reservation.reserver\n @billing = @reserver.billing_info || @reserver.billing_infos.create\n @billing.update_attributes params[:billing_info]\n \n @response = @reservation.process_new_tenant @billing\n \n if IssnAdapter.no_fatal_error?(@response['sErrorMessage']) && @reserver.save\n @reservation.update_attribute :status, 'paid' if @response['sErrorMessage'].blank?\n send_notices\n \n render :json => { :success => true, :data => render_to_string(:partial => 'reservations/step3') }\n else\n render :json => { :success => false, :data => (@response['sErrorMessage'].blank? ? model_errors(@reserver) : @response['sErrorMessage']) }\n end\n #rescue => e\n # render :json => { :success => false, :data => e.message }\n end", "def create\n @billing_info = BillingInfo.new(params[:billing_info])\n\n respond_to do |format|\n if @billing_info.save\n format.html { redirect_to(@billing_info, :notice => 'BillingInfo was successfully created.') }\n format.xml { render :xml => @billing_info, :status => :created, :location => @billing_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billing_info.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def update\n @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def update(billing_key, options = {})\n raise MethodNotImplemented\n end", "def update\n @payable_billing = PayableBilling.find(params[:id])\n\n respond_to do |format|\n if @payable_billing.update_attributes(params[:payable_billing])\n flash[:notice] = 'Pagamento atualizado.'\n format.html { redirect_to(@payable_billing) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to bill_path(@bill), notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n if @customer_bill.update_attributes(params[:customer_bill])\n format.html { redirect_to @customer_bill, notice: 'Customer bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @billing_account = args[:billing_account] if args.key?(:billing_account)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @project_billing_info = args[:project_billing_info] if args.key?(:project_billing_info)\n end", "def update\n @camp = Camp.find(params[:id])\n begin\n if @camp.valid?\n camp = Stripe::Plan.retrieve(@camp.id.to_s)\n camp.delete\n Stripe::Plan.create( :amount => params[:camp][:cost].to_i * 100, :interval => 'month', :name => params[:camp][:name] , :currency => 'usd', :id => @camp.id )\n if @camp.update_attributes(params[:camp])\n redirect_to(@camp, :notice => 'Camp was successfully updated.')\n else\n render :action => \"edit\"\n end\n end\t\n rescue Exception => e\n @camp.errors[:base] << \"Exception #{e.class}: #{e.message}\"\n render :action => \"edit\"\n end\n end", "def billing_params\n params.require(:billing).permit(:firstname, :lastname, :address, :phone, :city, :state, :country, :email)\n end", "def update\n respond_to do |format|\n if @purchase_bill.update_attributes(params[:purchase_bill])\n flash[:notice] = 'PurchaseBill was successfully updated.'\n format.html { redirect_to(@purchase_bill) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @purchase_bill.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_customer_info(customer, params)\n customer.card = params[:account][:stripe_cc_token]\n customer.description = \"#{ACCOUNT_NAME} account for #{params[cardholder_name]}\"\n customer.email = params[:cardholder_email]\n\n customer.save\n end", "def destroy\n @billing_info = BillingInfo.find(params[:id])\n @billing_info.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end", "def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end", "def put(invoice_number, invoice_sequence)\n #xml = order_update_template % { status: status.to_i }\n #put_request(t_url(:order, order_id), xml)\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @billing_option.update(billing_option_params)\n @billing_options = BillingOption.all\n @billing_option = BillingOption.new\n end", "def billing_params\n params.require(:billing).permit(:accounted_at, :client_id, :payment_method_id)\n end", "def index\n @billing_infos = BillingInfo.all\n end", "def index\n @billing_infos = BillingInfo.all\n end", "def create\n @bill_detail_info = BillDetailInfo.new(bill_detail_info_params)\n\n respond_to do |format|\n if @bill_detail_info.save\n format.html { redirect_to @bill_detail_info, notice: 'Bill detail info was successfully created.' }\n format.json { render :show, status: :created, location: @bill_detail_info }\n else\n format.html { render :new }\n format.json { render json: @bill_detail_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @bill = Bill.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @bill.update_attributes(params[:bill])\r\n format.html { redirect_to @bill, only_path: true, notice: 'Bill was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @bill.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to edit_bill_path(@bill), notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @bill }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @customer_info.update(customer_info_params)\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_info }\n else\n format.html { render :edit }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end", "def update\n authorize! :update, buyer_account\n\n buyer_account.vat_rate = params[:vat_rate].to_f if params[:vat_rate]\n buyer_account.settings.attributes = billing_params\n buyer_account.update_with_flattened_attributes(flat_params)\n\n respond_with(buyer_account)\n end", "def billing\n request('billing', :get)\n end", "def update\n attributes = fulfillment_bill_params.clone\n puts attributes\n @store = Store.find(attributes[\"store_id\"])\n puts \"Found Store = #{@store.StoreName}\" if !@store.nil?\n attributes = attributes.merge(\"store_name\" => @store.StoreName)\n puts attributes\n respond_to do |format|\n if @fulfillment_bill.update(attributes)\n format.html { redirect_to @fulfillment_bill, notice: 'Fulfillment bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @fulfillment_bill }\n else\n format.html { render :edit }\n format.json { render json: @fulfillment_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # too many issues trying to do strong parametesr.\n # TODO: implement strong params in the future\n params = request.parameters\n\n if !params.has_key?(:invoice_items) then\n flash[:error] = \"No items to update in invoice #{invoice.id}\"\n head status: :precondition_failed\n return\n end\n\n invoice = Invoice.find(params[:id])\n\n #just try to update the damn thing\n params[:invoice_items].each_pair do |key,value|\n InvoiceItem.find(key).update_attributes(value)\n end\n\n invoice.update_attribute(:total_billing, invoice.generate_total_billing)\n # update status\n if invoice.total_billing.zero? then\n invoice.update_attribute(:status, Invoice.statuses[\"settled\"])\n else\n invoice.update_attribute(:status, Invoice.statuses[\"outstanding\"])\n end\n\n flash[:notice] = \"Invoice #{invoice.id} updated\"\n render json: {message:\"Invoice #{invoice.id} updated\", invoice:invoice}, status: :ok\n end", "def set_billing_plan\n @billing_plan = BillingPlan.find(params[:id])\n end", "def new\n @billing_info = BillingInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billing_info }\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to(@bill, :notice => 'Bill was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => @bill, :status => :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bill.errors, :status => :unprocessable_entity }\n format.json { render :json => @bill, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @purchase.update(purchase_params)\n format.json { head :no_content }\n else\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill.type_of_bill_id = 1\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to bills_url, notice: 'Счет успешно обновлен.' }\n format.json { render :show, status: :ok, location: @bill }\n log(current_user.id,\"Обновил счет\",\"\")\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update!(**args)\n @billing_account_name = args[:billing_account_name] if args.key?(:billing_account_name)\n @billing_enabled = args[:billing_enabled] if args.key?(:billing_enabled)\n @name = args[:name] if args.key?(:name)\n @project_id = args[:project_id] if args.key?(:project_id)\n end", "def update_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.update_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.update_customer\"\n end\n allowable_values = [\"public\", \"private\"]\n if @api_client.config.client_side_validation && opts[:'billing_network_type'] && !allowable_values.include?(opts[:'billing_network_type'])\n fail ArgumentError, \"invalid value for \\\"billing_network_type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_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['billing_contact_id'] = opts[:'billing_contact_id'] if !opts[:'billing_contact_id'].nil?\n form_params['billing_network_type'] = opts[:'billing_network_type'] if !opts[:'billing_network_type'].nil?\n form_params['billing_ref'] = opts[:'billing_ref'] if !opts[:'billing_ref'].nil?\n form_params['can_configure_wordpress'] = opts[:'can_configure_wordpress'] if !opts[:'can_configure_wordpress'].nil?\n form_params['can_reset_passwords'] = opts[:'can_reset_passwords'] if !opts[:'can_reset_passwords'].nil?\n form_params['can_upload_vcl'] = opts[:'can_upload_vcl'] if !opts[:'can_upload_vcl'].nil?\n form_params['force_2fa'] = opts[:'force_2fa'] if !opts[:'force_2fa'].nil?\n form_params['force_sso'] = opts[:'force_sso'] if !opts[:'force_sso'].nil?\n form_params['has_account_panel'] = opts[:'has_account_panel'] if !opts[:'has_account_panel'].nil?\n form_params['has_improved_events'] = opts[:'has_improved_events'] if !opts[:'has_improved_events'].nil?\n form_params['has_improved_ssl_config'] = opts[:'has_improved_ssl_config'] if !opts[:'has_improved_ssl_config'].nil?\n form_params['has_openstack_logging'] = opts[:'has_openstack_logging'] if !opts[:'has_openstack_logging'].nil?\n form_params['has_pci'] = opts[:'has_pci'] if !opts[:'has_pci'].nil?\n form_params['has_pci_passwords'] = opts[:'has_pci_passwords'] if !opts[:'has_pci_passwords'].nil?\n form_params['ip_whitelist'] = opts[:'ip_whitelist'] if !opts[:'ip_whitelist'].nil?\n form_params['legal_contact_id'] = opts[:'legal_contact_id'] if !opts[:'legal_contact_id'].nil?\n form_params['name'] = opts[:'name'] if !opts[:'name'].nil?\n form_params['owner_id'] = opts[:'owner_id'] if !opts[:'owner_id'].nil?\n form_params['phone_number'] = opts[:'phone_number'] if !opts[:'phone_number'].nil?\n form_params['postal_address'] = opts[:'postal_address'] if !opts[:'postal_address'].nil?\n form_params['pricing_plan'] = opts[:'pricing_plan'] if !opts[:'pricing_plan'].nil?\n form_params['pricing_plan_id'] = opts[:'pricing_plan_id'] if !opts[:'pricing_plan_id'].nil?\n form_params['security_contact_id'] = opts[:'security_contact_id'] if !opts[:'security_contact_id'].nil?\n form_params['technical_contact_id'] = opts[:'technical_contact_id'] if !opts[:'technical_contact_id'].nil?\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.update_customer\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#update_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(invoice_params)\n format.html { redirect_to action: 'index', notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n end\n end\n\n end", "def call(subscription, customer_shipping_information)\n subscription.user.update(\n billing_first_name: customer_shipping_information['first_name'],\n billing_last_name: customer_shipping_information['last_name'],\n billing_adress: customer_shipping_information['adress'],\n billing_zip_code: customer_shipping_information['zip_code']\n )\n Success(subscription)\n end", "def billing_params\n params.require(:billing).permit(:member_id, :time_in, :time_out, :price, :comment, :duration, :expiration, :number_park, :reports_attributes => [:id, :date, :time_in, :time_out, :duration, :price, :comment, :member_id, :billing_id] )\n end", "def update\n @bill = current_user_or_guest.bills.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(bill_params)\n format.html { redirect_to(@bill, notice: t('bill.updated')) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @bill.errors, status: :unprocessable_entity }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @invoice.update(invoice_params)\n render :show, status: :ok, location: @invoice\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "def update\n @az_bill = AzBill.find(params[:id])\n\n respond_to do |format|\n if @az_bill.update_attributes(params[:az_bill])\n format.html { redirect_to(@az_bill, :notice => 'AzBill was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_bill.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @purchase_order.update(purchase_order_params)\n\n @purchase_order.record_update(current_user, purchase_order_params)\n \n format.html { redirect_to @purchase_order, notice: 'Purchase order was successfully updated.' }\n format.json { respond_with_bip @purchase_order }\n else\n format.html { render action: 'edit' }\n format.json { render json: @purchase_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n @patient = @user.patients.find(params[:patient_id])\n @invoice = @patient.invoices.find(params[:invoice_id])\n @cost_item = CostItem.find(params[:id])\n @cost_item.costType = CostType.find(params[:costType_id])\n @cost_item.invoice = @invoice\n\n\n respond_to do |format|\n if @cost_item.update_attributes(params[:cost_item])\n format.html { redirect_to user_patient_invoice_cost_items_url(@user,@patient,@invoice),notice: 'Cost item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cost_item.errors, status: :unprocessable_entity }\n end\n end\n calculate_costitem_amount(@cost_item)\n calculate_invoice_sum(@invoice)\n end", "def update_shipping_from_purchase\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n flash[:notice] = 'Address was successfully updated.'\n format.html { redirect_to( new_payment_path ) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit_shipping_from_purchase\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if billing_params != {}\n if billing_params[:type][0] == '1'\n cust = @job.customer\n if cust == nil\n return redirect_to edit_job_job_detail_path(@job, @job_detail), notice: 'No customer was found.'\n end\n @job_detail.billing_type_id = 1\n @job_detail.billing_address_id = @job.customer.address_id\n @job_detail.billing_address_first_name = @job.customer.first_name\n @job_detail.billing_address_last_name = @job.customer.last_name\n elsif billing_params[:type][0] == '2'\n adjuster = @job.adjuster\n unless adjuster\n return redirect_to edit_job_job_detail_path(@job, @job_detail), notice: 'No adjuster was found.'\n end\n @job_detail.billing_type_id = 2\n @job_detail.billing_address_id = adjuster.address_id\n @job_detail.billing_address_first_name = adjuster.first_name\n @job_detail.billing_address_last_name = adjuster.last_name\n elsif billing_params[:type][0] == '3'\n @job_detail.billing_type_id = 3\n @job_detail.billing_address_first_name = address_params[:first_name]\n @job_detail.billing_address_last_name = address_params[:last_name]\n @billing_address = Address.new(address_1: address_params[:address_1],\n address_2: address_params[:address_2],\n city: address_params[:city],\n zip_code: address_params[:zip_code],\n county: address_params[:county])\n @billing_address.save\n @job_detail.billing_address_id = @billing_address.id\n @job_detail.save\n end\n @job_detail.update(job_detail_params)\n @job_detail.save\n\n return redirect_to job_job_detail_path(@job, @job_detail), notice: 'Job was successfully updated.'\n end\n respond_to do |format|\n if @job_detail.update(job_detail_params)\n format.html { redirect_to job_job_detail_path(@job, @job_detail), notice: 'Job detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_detail }\n else\n format.html { render :edit }\n format.json { render json: @job_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_billing(req)\n with_stripe_error_handlers do\n customer = Stripe::Customer.retrieve(@dealership.customer_id)\n customer.card = posted['stripeToken']\n customer.save\n req.session['billing_flash_msg'] = \"Card updated successfully.\"\n redirect \"/admin/#{@dealership.slug}/billing\"\n end\n end", "def update\n respond_to do |format|\n if @customer_purchase.update(customer_purchase_params)\n format.html { redirect_to @customer_purchase, notice: 'Customer purchase was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_purchase }\n else\n format.html { render :edit }\n format.json { render json: @customer_purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find_by(id: params[:id])\n _c_params = customer_params\n if customer_params[:bank_id].blank? and bank_params[:bankname].present?\n @bank = Bank.new(bank_params)\n @bank.save\n @customer.bank_id = @bank.id\n _c_params[:bank_id] = @bank.id\n end\n\n respond_to do |format|\n if @customer.update(_c_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_billing_option\n @billing_option = BillingOption.find(params[:id])\n end", "def set_bill_detail_info\n @bill_detail_info = BillDetailInfo.find(params[:id])\n end", "def update\n @shop_claim = ShopClaim.find(params[:id])\n\n if @shop_claim.update(shop_claim_params)\n head :no_content\n else\n render json: @shop_claim.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @invoice.update(invoice_number_params)\n format.html { redirect_to invoices_path, notice: 'Invoice number was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :edit, Bill\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to bills_path, notice: 'Bill was successfully updated.' }\n format.json { render :show, status: :created, location: @bill }\n else\n format.html { render :edit }\n format.json\n end\n end\n end" ]
[ "0.7353004", "0.72369725", "0.72369725", "0.7159049", "0.704509", "0.70017296", "0.6880946", "0.6879077", "0.68785393", "0.68317735", "0.6506148", "0.6471375", "0.6402917", "0.63708013", "0.63098514", "0.63009953", "0.62468094", "0.62392145", "0.6224508", "0.6224508", "0.6224508", "0.6211677", "0.6205288", "0.61956686", "0.61359596", "0.610012", "0.6094021", "0.60808957", "0.6080153", "0.6078618", "0.6069172", "0.6058927", "0.60580474", "0.60036856", "0.5996922", "0.5994984", "0.5993126", "0.5973954", "0.5964849", "0.59041286", "0.58789194", "0.5871031", "0.584403", "0.5842005", "0.58314127", "0.5831161", "0.58269846", "0.58269846", "0.58217794", "0.5815168", "0.5801691", "0.5801691", "0.5781366", "0.57789135", "0.57786644", "0.57786644", "0.57786644", "0.57786644", "0.57786644", "0.57786644", "0.57786644", "0.57684", "0.575254", "0.5749267", "0.57450086", "0.57422554", "0.5733181", "0.57265115", "0.57244796", "0.5724197", "0.57203245", "0.57185525", "0.57161987", "0.57161987", "0.57129896", "0.5711568", "0.57040924", "0.5702377", "0.56909126", "0.56889254", "0.568335", "0.5679338", "0.56385386", "0.563836", "0.5637738", "0.56354564", "0.56317043", "0.56305933", "0.56280637", "0.5612349", "0.5611407", "0.5610922", "0.5596363", "0.55961347", "0.55952364", "0.55945414", "0.55916184", "0.5591084", "0.558627", "0.55814576" ]
0.75241995
0
DELETE /billing_infos/1 DELETE /billing_infos/1.json
def destroy @billing_info = BillingInfo.find(params[:id]) @billing_info.destroy respond_to do |format| format.html { redirect_to billing_infos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_info = BillingInfo.find(params[:id])\n @billing_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_infos_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @billing.destroy\n respond_to do |format|\n format.html { redirect_to billings_url, notice: 'Billing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing.destroy\n respond_to do |format|\n format.html { redirect_to billings_url, notice: \"Billing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_plan.destroy\n respond_to do |format|\n format.html { redirect_to billing_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_address = BillingAddress.find(params[:id])\n @billing_address.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @payable_billing = PayableBilling.find(params[:id])\n @payable_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_billings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bill_detail_info.destroy\n respond_to do |format|\n format.html { redirect_to bill_detail_infos_url, notice: 'Bill detail info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_entry = BillingEntry.find(params[:id])\n @billing_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_entries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @billing_plan = BillingPlan.find(params[:id])\n @billing_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @panel_billing = Panel::Billing.find(params[:id])\n @panel_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_billings_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_bill_detail.destroy\n respond_to do |format|\n format.html { redirect_to admin_bill_details_url, notice: t(:bill_details_destroyed_success) }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_bill = CustomerBill.find(params[:id])\n @customer_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n render json: @bill\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_path }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @bill = Bill.find(params[:id])\r\n @bill.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to bills_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to account_path(@bill.account_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_bills_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n head :no_content\n end", "def destroy\n @banking_detail = BankingDetail.find(params[:id])\n @banking_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to banking_details_url }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @az_bill = AzBill.find(params[:id])\n @az_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_bills_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @invoice = Invoice.find(params[:id])\r\n @retail_plan = RetailPlan.find(@invoice.retail_plan_id)\r\n billing_site_id = @retail_plan.billing_site_id\r\n @invoice.destroy\r\n redirect_to billing_site_url(billing_site_id), notice: 'Invoice has been destroyed successfully !'\r\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_usage.destroy\n respond_to do |format|\n format.html { redirect_to customer_usages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n # TODO: \"un-updateEnergyGoals\" related to this bill\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchase_path }\n format.json { head :no_content }\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @cc_bill_payment.destroy\n respond_to do |format|\n format.html { redirect_to cc_bill_payments_url }\n format.mobile { redirect_to cc_bill_payments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @purchase.destroy\n respond_to do |format|\n\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n\n end", "def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(bills_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @purchase_datum.destroy\n respond_to do |format|\n format.html { redirect_to purchase_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @callplan.destroy\n respond_to do |format|\n format.html { redirect_to callplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n \n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(bills_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoicedetail = Invoicedetail.find(params[:id])\n @invoicedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicedetails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incident = Incident.find(@plan.incident_id)\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { head :no_content }\n end\n end", "def destroy\n @fulfillment_bill.destroy\n respond_to do |format|\n format.html { redirect_to fulfillment_bills_url, notice: 'Fulfillment bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n\n head :no_content\n end", "def destroy\n @shipping_detail.destroy\n respond_to do |format|\n format.html { redirect_to shipping_details_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end", "def destroy\n requires :customer_gateway_id\n \n service.delete_customer_gateway(customer_gateway_id)\n true\n end", "def destroy\n @purchase_request.destroy\n respond_to do |format|\n format.html { redirect_to purchase_requests_url, notice: 'Purchase request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill_entry.destroy\n respond_to do |format|\n format.html { redirect_to bill_entries_url, notice: 'Bill entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.deleted = 1\n @bill.save\n\n respond_to do |format|\n format.html { redirect_to(customer_path(@bill.customer)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer_info.destroy\n respond_to do |format|\n format.html { redirect_to customer_infos_url, notice: 'Customer info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase_information = PurchaseInformation.find(params[:id])\n @purchase_information.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_informations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @purchasedetail.destroy\n respond_to do |format|\n format.html { redirect_to purchasedetails_url, notice: 'Purchasedetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bank_detail.destroy\n respond_to do |format|\n format.html { redirect_to bank_details_url, notice: 'Bank detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @bill.destroy\n render status: 200\n else\n render json: { errors: @bill.errors }, status: 501\n end\n end", "def destroy\n @transactionbill.destroy\n respond_to do |format|\n format.html { redirect_to transactionbills_url, notice: 'Transactionbill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @balance_bill = BalanceBill.find(params[:id])\n @balance_bill.updated_user = current_user.login_name\n @balance_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to balance_bills_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @monthlybill = Monthlybill.find(params[:id])\n @monthlybill.destroy\n\n respond_to do |format|\n format.html { redirect_to monthlybills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n head :no_content\n end", "def destroy\n #@bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(bills_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n @purchase_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_path(@purchase) }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchases.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase deleted with success.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @freight_bill.destroy\n respond_to do |format|\n format.html { redirect_to freight_bills_url, notice: 'Freight bill was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @electricity_bill.destroy\n respond_to do |format|\n format.html { redirect_to electricity_bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if Transaction.where(bill_id: @bill.id).blank?\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url, notice: 'Счет удален' }\n format.json { head :no_content }\n end\n log(current_user.id,\"Удалил счет\",\"\")\n end\n end", "def destroy\n @bill_summary.destroy\n respond_to do |format|\n format.html { redirect_to bill_summaries_url, notice: 'Bill summary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url, notice: t('flash.notice') if @bill.destroyed? }\n format.json { head :no_content }\n end\n end", "def destroy\n\t@responsible.bills.each do |bill|\n\t\tbill.destroy\n\tend\n @responsible.destroy\n respond_to do |format|\n format.html { redirect_to responsibles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_alipay.destroy\n respond_to do |format|\n format.html { redirect_to backend_shop_mobile_alipays_url(@current_shop) }\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\n @fedex_bill_check.destroy\n respond_to do |format|\n format.html { redirect_to fedex_bill_checks_url, notice: 'Fedex bill check was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.8067053", "0.79237777", "0.7494958", "0.7356279", "0.7349171", "0.72781503", "0.7186637", "0.7138617", "0.70773065", "0.7047433", "0.70213205", "0.688862", "0.681967", "0.67866445", "0.6781592", "0.6772383", "0.6701584", "0.6701584", "0.66995645", "0.66784316", "0.6646599", "0.6646572", "0.6646572", "0.6646572", "0.66371226", "0.66257596", "0.66218925", "0.65801185", "0.65637285", "0.6544527", "0.65172225", "0.6512028", "0.6512028", "0.6512028", "0.6512028", "0.6512028", "0.6512028", "0.6512028", "0.6512028", "0.6512028", "0.6512028", "0.6509773", "0.6507912", "0.64978176", "0.6492703", "0.64845794", "0.64827675", "0.64781845", "0.6469989", "0.6466072", "0.645862", "0.6450463", "0.64491737", "0.64395636", "0.64379126", "0.6428053", "0.6427959", "0.6426648", "0.6421598", "0.6421598", "0.6421447", "0.6414407", "0.6410699", "0.6410437", "0.64075774", "0.64072937", "0.6404249", "0.6404249", "0.6404249", "0.6404249", "0.6404249", "0.640345", "0.63981795", "0.63954663", "0.63954663", "0.6389316", "0.63851404", "0.6382539", "0.6379021", "0.6368206", "0.6367764", "0.6366375", "0.63598603", "0.63585514", "0.63547355", "0.63524777", "0.6350801", "0.6347641", "0.6343454", "0.6339189", "0.6335511", "0.633233", "0.63302726", "0.63302726", "0.63302726", "0.63302726", "0.63298655", "0.63165003", "0.63165003", "0.63165003" ]
0.80869853
0
Updates the order and advances to the next state (when possible.) Overriden by the promo gem if it exists.
def update op = object_params if op && op[:payments_attributes] @order.payments.where('spree_payments.state = "checkout"').destroy_all end # binding.pry if @order.update_attributes(op) fire_event('spree.checkout.update') if @order.next state_callback(:after) else flash[:error] = t(:payment_processing_failed) respond_with(@order, :location => hto_checkout_state_path(@order.state)) return end if @order.state == 'complete' || @order.completed? flash.notice = t(:order_processed_successfully) flash[:commerce_tracking] = 'nothing special' respond_with(@order, :location => completion_route) else respond_with(@order, :location => hto_checkout_state_path(@order.state)) end else respond_with(@order) { |format| format.html { render :edit } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete_order_step(order, order_step)\n original_state = order.state\n order.state = order_step\n\n if !order.next\n order.state = original_state\n order.save(validate: false) # store data from paypal. user will be redirect to 'personal' tab\n end\n end", "def order_upgrade\n @order.next\n @order.complete!\n # Since we dont rely on state machine callback, we just explicitly call this method for spree_store_credits\n if @order.respond_to?(:consume_users_credit, true)\n @order.send(:consume_users_credit)\n end\n @order.finalize!\n end", "def update\n if @order.update_attributes(object_params)\n fire_event('spree.checkout.update')\n\n unless apply_coupon_code\n respond_with(@order) { |format| format.html { render :edit } }\n return\n end\n\n # Add Klarna invoice cost\n @order.add_klarna_fee!\n # Remove Klarna invoice cost\n @order.remove_klarna_fee!\n\n if @order.next\n # FIXME not working\n # state_callback(:after)\n # fix require recheck\n session[:order_id] = nil if @order.completed?\n else\n flash[:error] = @order.get_error # Changed by Noc\n respond_with(@order, location: checkout_state_path(@order.state))\n return\n end\n\n if @order.state == 'complete' || @order.completed?\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:commerce_tracking] = 'nothing special'\n respond_with(@order, location: completion_route)\n else\n respond_with(@order, location: checkout_state_path(@order.state))\n end\n else\n respond_with(@order) { |format| format.html { render :edit } }\n end\n end", "def update!\n update_totals\n update_payment_state\n # update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n \n update_attributes_without_callbacks({\n :state => \"complete\"\n }) \n \n logger.info 'UPDATED ORDER'\n # update_hooks.each { |hook| self.send hook }\n end", "def update_order_state\n if self.status_changed?\n self.order.update_attributes(:state => self.status)\n end\n end", "def update_order_item\n \n end", "def set_order\n @order = Order.find(params[:id])\n OrderStateMgr.instance(self).set_curr_state(@order)\n end", "def update_order_steps\n order = current_order\n\n if !signed_in? # 'personal'\n update_order_personal_info\n end\n\n if !order.has_checkout_step?(\"address\") || order.bill_address.blank? || order.shipping_address.blank?\n update_order_addresses\n end\n\n order.state = 'payment'\n order.save\n end", "def update!(order)\n old_state = state\n new_state = determine_state(order)\n update_columns(\n state: new_state,\n updated_at: Time.current\n )\n after_ship if new_state == 'shipped' && old_state != 'shipped'\n end", "def update_order\n if @order.update_with_params(params, permitted_checkout_attributes)\n if @order.next\n if @order.completed?\n cur_order = nil\n else\n @error = @order.errors.full_messages.join(\"\\n\")\n end\n end\n else\n message = []\n @order.errors.each do |key, msg|\n message.push(\"#{key.to_s.gsub('.', ' ').humanize} #{msg}\")\n end\n @error = message.join(\"\\n\")\n end\n\n render json: {\n status: !@error.present?,\n error: @error,\n state: @order.present? ? @order.state : '',\n has_order: cur_order.present?,\n has_failed: params[:failed_id].present?,\n failed_id: params[:failed_id]\n }\n end", "def update\n update_item_count\n update_totals\n if order.completed?\n update_payment_state\n update_shipments\n update_shipment_state\n update_shipment_total\n end\n run_hooks\n persist_totals\n end", "def increment_order!\n @current += 1\n end", "def update\n if @order.update_attributes(object_params)\n\n # fire_event('moseller.checkout.update')\n \n if @order.respond_to?(:coupon_code) && @order.coupon_code.present?\n # fire_event('moseller.checkout.coupon_code_added', :coupon_code => @order.coupon_code)\n end \n \n if @order.state == \"delivery\"\n logger.info params\n @order.customer_name = params[:customer_name]\n @order.email = params[:email]\n @order.mobile_number = params[:mobile_number]\n \n if @order.check_sms\n flash[:success] = I18n.t(:order_sms_to_long)\n respond_with(@order, :location => checkout_state_path('delivery'))\n else\n @order.save\n end\n \n end\n\n if @order.state == \"payment\"\n logger.info \"PAYMENT\"\n if @order.payment_not_required?\n @order.next\n end\n end\n \n if @order.next\n state_callback(:after)\n else\n flash[:error] = I18n.t(:payment_processing_failed)\n respond_with(@order, :location => checkout_state_path(@order.state))\n return\n end\n \n if @order.state == \"complete\" || @order.completed?\n flash[:success] = I18n.t(:order_processed_successfully)\n # gflash :success => I18n.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"Your order number is \" + @order.number().to_s()\n respond_with(@order, :location => completion_route)\n else\n respond_with(@order, :location => checkout_state_path(@order.state))\n end\n else\n respond_with(@order) { |format| format.html { render :edit } }\n end\n end", "def update\n\t\tpp = permitted_checkout_attributes \n\t\tpp<< :pay_pal_token\n\t\tpp<< :pay_pal_payer_id\t\n\t\t\n\t\tif @order.update_from_params(params, pp, request.headers.env)\n\t @order.temporary_address = !params[:save_user_address]\n\n\t unless @order.next\n\t flash[:error] = @order.errors.full_messages.join(\"\\n\")\n\t redirect_to checkout_state_path(@order.state) and return\n\t end\n\n\t if @order.respond_to?(:requires_redirect?) && @order.requires_redirect? && @order.redirect_to\n\t \tredirect_to @order.redirect_to and return\n\t end\n\n\t if @order.completed?\n\t @current_order = nil\n\t flash.notice = Spree.t(:order_processed_successfully)\n\t flash['order_completed'] = true\n\t redirect_to completion_route\n\t else\n\t redirect_to checkout_state_path(@order.state)\n\t end\n\t else\n\t render :edit\n\t end\n\tend", "def update_order\n if order.present?\n order.price = order.order_items.pluck(:total_price).sum rescue 0\n order.shipping_price = 0\n order.total_price = order.price + order.shipping_price\n order.save\n end\n end", "def update\n if @order.update_attributes(object_params)\n persist_user_address\n\n unless @order.next\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to checkout_state_path(@order.state) and return\n end\n\n if @order.completed?\n session[:order_id] = nil\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n redirect_to completion_route\n else\n\n #ajax delivery update\n if params[:remote]\n render :partial => 'delivery_order_summary', :locals => { :order => @order }\n else \n redirect_to checkout_state_path(@order.state)\n end\n\n end\n else\n render :edit\n end\n end", "def update\n @order = current_order\n if @order.may_add?\n @order_item = @order.order_items.find(params[:id])\n @order_item.update_attributes(order_item_params)\n @order_items = @order.order_items\n end\n end", "def update\n if @order.completed?\n process_and_add_store_credit(@order)\n end\n\n return orig_update\n end", "def set_to_ordered\n self.status = \"ordered\"\n self.save\n end", "def ship_order\n self.update_attributes(status: 2)\n end", "def update_order\n # If there is no adjustment for the current gift package, just create one here unless there already is one for the gift package\n if self.gift_package_id && self.gift_package_id > 0 && self.adjustments.gift_packaging.where(:originator_id => self.gift_package_id).count == 0\n self.gift_package.adjust(self) \n end \n # Then update all adjustments\n self.update_adjustments\n # update the order totals, etc.\n order.update!\n end", "def update\n update_item_count\n update_group_state\n update_totals\n if order.completed?\n update_payment_state\n end\n update_order_type\n update_odd_store_id\n update_sale_total # for card deposit\n\n #run_hooks\n persist_totals\n end", "def set_order\n @order = Order.find(session[:order_id])\n end", "def update\n if @order.update_attributes(object_params)\n fire_event('spree.checkout.update')\n \n unless apply_coupon_code\n respond_with(@order) { |format| format.html { render :edit } }\n return\n end\n\n # Add Klarna invoice cost\n klarna_payments = @order.payments.valid.where(source_type: \"Spree::KlarnaPayment\")\n \n if @order.adjustments.klarna_invoice_cost.count <= 0 && klarna_payments.any?\n @order.adjustments.create(:amount => klarna_payments.first.payment_method.preferred(:invoice_fee),\n :source => @order,\n :originator => klarna_payments.first.payment_method,\n :locked => true,\n :label => I18n.t(:invoice_fee))\n @order.update!\n elsif @order.adjustments.klarna_invoice_cost.count > 0 \n @order.adjustments.klarna_invoice_cost.destroy_all\n @order.update!\n end\n \n if @order.next\n state_callback(:after)\n else\n flash[:error] = @order.get_error # Changed by Noc\n respond_with(@order, :location => checkout_state_path(@order.state))\n return\n end\n\n if @order.state == \"complete\" || @order.completed?\n flash.notice = t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n respond_with(@order, :location => completion_route)\n else\n respond_with(@order, :location => checkout_state_path(@order.state))\n end\n else\n respond_with(@order) { |format| format.html { render :edit } }\n end\n end", "def edit \n @order = current_order || Order.incomplete.\n includes(line_items: [variant: [:images, :option_values, :product]]).\n find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n @order.save! unless @order.id\n puts \"\\n\\n\\n edit guest_token=[#{cookies.signed[:guest_token]}] order=[#{@order.to_json}] \\n\\n\\n\"\n associate_user \n\n @order.assign_default_addresses!\n puts \"\\n\\n\\n\\n edit assign_default_addresses good bill_address=[#{@order.bill_address}]\\n\\n\\n\\n\";\n @order.bill_address = User.find(1).bill_address.try(:clone) unless @order.bill_address\n puts \"\\n\\n\\n\\n edit bill_address good\\n\\n\\n\\n\";\n \n \n # if @order.next\n # puts \"\\n\\n\\n\\n edit order next good\\n\\n\\n\\n\";\n\n # else\n # puts \"\\n\\n\\n\\n edit order next bad\\n\\n\\n\\n\";\n # end\n \n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n\n if (@order[:state] == 'cart')\n if @order.next\n puts \"\\n\\n\\n\\n edit order next cart good\\n\\n\\n\\n\";\n else\n puts \"\\n\\n\\n\\n edit order next cart bad\\n\\n\\n\\n\";\n end\n else\n puts \"\\n\\n\\n\\n edit order state not eq cart\\n\\n\\n\\n\";\n end \n @order.ship_address = User.find(1).ship_address.try(:clone) unless @order.ship_address\n # @updating_params = {order: { bill_address_attributes: [{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"} ] } }\n \n # \n @order.shipments = Spree::Stock::Coordinator.new(@order).shipments unless @order.shipments&.count > 0\n @order.refresh_shipment_rates\n @order.set_shipments_cost\n @order.apply_free_shipping_promotions\n @order.available_payment_methods\n # @updating_params ||= {}\n # @updating_params[:order] ||= {bill_address_attributes:[{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"}]}\n # @updating_params[:order][:bill_address_attributes] ||= [{}]\n # @updating_params[:order][:bill_address_attributes].first[:city] = \"Kriviy Rih\"\n # @updating_params[:order][:bill_address_attributes].first[:country_id] = \"229\"\n # @updating_params[:order][:bill_address_attributes].first[:state_id] = \"2975\"\n # @updating_params[:order][:bill_address_attributes].first[:zipcode] = \"50015\"\n # if @order.update_from_params(@updating_params, permitted_checkout_attributes, request.headers.env)\n\n # end\n # @order.bill_address = user.bill_address.try(:clone)\n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n puts \"\\n\\n\\n edit shipments=[\"+@order.shipments.to_json+\"]\\n\\n\\n\\n\"\n puts \"\\n\\n\\n edit shipment_total=[\"+@order.shipment_total.to_json+\"]\\n\\n\\n\\n\"\n # puts \"\\n\\n\\n edit client_store_ref_path=[#{client_store_ref_path}] \\n\\n\\n\"\n # puts \"\\n\\n\\n edit packages=[\"+Spree::Stock::Coordinator.packages.to_json+\"]\\n\\n\\n\\n\"\n # flash[:error] = \"order1112=[\"+@order.to_json+\"]\\n\\n available_payment_methods=[\"+@order.available_payment_methods.to_json+\"]\"\n end", "def set_order\n @order = Order.find(session[:order_id])\n end", "def reorder\n raise false unless active?\n\n result = create_reorder &&\n select_shipping &&\n add_payment &&\n confirm_reorder &&\n complete_reorder &&\n calculate_reorder_date!\n\n puts result ? \" -> Next reorder date: #{self.reorder_on}\" : \" -> FAILED\"\n \n result\n end", "def update_order(result)\n create_asendia_shipment_record(result['Status'], result['Error'])\n @transaction_id = result['ParcelId']\n @tracking_number = nil\n shipment = @order.shipment\n shipment.tracking = @tracking_number\n shipment.save\n shipment.ship!\n @order.line_items.each do |line_item|\n @success_orders << [\"#{@order.number}, #{line_item.sku}, #{@tracking_number}, #{@transaction_id}, #{line_item.quantity}, #{@order.completed_at}, #{(@order.ship_address.country.try(:name) || '').delete(',')}\"]\n end\n end", "def checkout\n @order = current_order\n @order.order_status_id = 2\n if @order.update_attributes(order_params)\n\n if @order.agreement\n @payment = PaymentChoice.find(@order.payment_choice_id)\n\n if @payment.name == \"Braintree\"\n @order.order_status_id = 6\n @order.save\n create_braintree_payment @order.total, @order, params[\"payment_method_nonce\"]\n\n elsif @payment.name == \"Stripe\"\n @order.order_status_id = 6\n @order.save\n create_stripe_payment params[:stripeEmail], params[:stripeToken], @order.total, @order\n\n else\n @order.decrease_inventory\n @order.placed_on = DateTime.now\n @order.save\n session.delete :order_id\n OrderMailer.confirmation_mail(@order).deliver_later\n @token = DownloadToken.create(:expires_at => Time.now + 24.hours)\n flash[:success] = \"Order placed successfully\"\n if current_user\n redirect_to confirm_order_path(@order, :token => @token.token)\n else\n redirect_to thanks_path :token => @token.token\n end\n end\n\n else\n flash[:danger] = \"Sorry, your order could not be completed\"\n redirect_to cart_path\n end\n\n else\n flash[:danger] = \"Sorry, your order could not be completed\"\n redirect_to cart_path\n end\n end", "def update\n if @order.single?\n if( (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && (!@order.completed? ) && @order.update(update_order_params) )\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n else\n if(@order.update(update_order_params))\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updated']}, status: :unprocessable_entity\n end\n end\n end", "def processOrder\n \n end", "def update_state(product, state, order_line)\n hash = {\n item_id: order_line.item_id,\n transaction_id: order_line.transaction_id\n }\n if state == 'paid'\n hash.merge!(paid: true)\n elsif state == 'shipped'\n hash.merge!(shipped: true)\n end\n\n response = @allegro.complete_sale(hash)\n #Rails.logger.info response.inspect\n response\n end", "def set_order new_order\n\t\t\tnew_order = new_order.to_i\n\t\t\told_order = self.order\n\n\t\t\tif old_order < new_order\n\t\t\t\tchange = '- 1'\n\t\t\t\torder_range = [old_order + 1, new_order]\n\t\t\telse\n\t\t\t\tchange = '+ 1'\n\t\t\t\torder_range = [new_order, old_order - 1]\n\t\t\tend\n\n\t\t\tActiveRecord::Base.connection.execute(\n\t\t\t\t' UPDATE districts' +\n\t\t\t\t\" SET \\\"order\\\" = \\\"order\\\" #{change}\" +\n\t\t\t\t\" WHERE province_id = #{self.province_id} AND \\\"order\\\" BETWEEN #{order_range[0]} AND #{order_range[1]}\"\n\t\t\t);\n\n\t\t\tif !self.update order: new_order\n\t\t\t\treturn { status: 2 }\n\t\t\tend\n\n\t\t\t{ status: 0 }\n\t\tend", "def set_order\n @order = current_order\n\n if @order.new_record?\n @order.save!\n session[:order_id] = @order.id\n end\n end", "def update\n @order = Order.find(params[:id])\n @order.status = params[:order][:status]\n @order.update(order_params)\n if @order.status = \"入金確認\"\n @order.order_details.each do |order_detail|\n order_detail.update(making_status: 1)\n end\n end\n redirect_back(fallback_location: admin_orders_path)\n end", "def set_order\n # finds the current order using the params\n @order = Order.find(params[:id])\n end", "def update_payment_state\n last_state = order.payment_state\n if payments.present? && payments.valid.empty?\n order.payment_state = 'failed'\n elsif order.canceled? && order.payment_total == 0\n order.payment_state = 'void'\n else\n # no balance_due, credit_owed any more, we repay with /without card,\n order.payment_state = 'paid' if order.outstanding_balance > 0 #balance_due\n order.payment_state = 'paid' if order.outstanding_balance < 0 #credit_owed\n order.payment_state = 'paid' unless order.outstanding_balance?\n order.payment_state = 'unpaid' if order.payments.blank?\n end\n order.state_changed('payment') if last_state != order.payment_state\n order.payment_at = DateTime.current if order.payment_state == 'paid'\n order.payment_state\n end", "def update_order(order, options, locale = 'en_GB')\n options.each { |k, v| options[k] = v.to_json if v.class.name.deconstantize == 'Epages' }\n id = epages_id(order)\n old_order = perform_get_request(\"/orders/#{id}\", locale: locale)\n perform_put_with_object(\"/orders/#{id}?locale=#{locale}\", old_order.merge(options), Epages::Order)\n end", "def advance!\n if next_status\n self.status = next_status\n return save\n end\n end", "def update\n @order.update_attribute(:state, 'cart')\n if params[:shipments_attributes].present?\n if cookies[:board_id].present?\n @order.room_cookie = cookies[:board_id]\n end\n if cookies[:portfolio_id].present?\n @order.portfolio_cookie = cookies[:portfolio_id]\n end\n #params[:shipments_attributes].each do |key, value|\n #\n # shipment = @order.shipments.where(id: value[:id]).first\n # if shipment.present?\n # rate = shipment.shipping_rates.where(id: value[:selected_shipping_rate_id]).first\n #\n # if rate.present?\n # shipment.update_attributes({selected_shipping_rate_id: rate.id, cost: rate.cost})\n # end\n # end\n # shipment.adjustments.create(amount: shipment.cost, source_type: 'Spree::Order', order_id: @order.id, label: 'Shipment')\n #\n # #if @order.adjustments.where(label: 'Shipment').blank?\n # #@order.adjustments.shipping.create(amount: @order.shipments.sum(:cost), source_type: 'Spree::Shipment' ,label: 'Shipment')\n # #end\n #end\n if @order.update_from_params(params, permitted_checkout_attributes)\n persist_user_address\n unless @order.next\n\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to one_page_checkout_path and return\n end\n\n if @order.completed?\n @order.payments.destroy_all if request.put?\n @order.update_totals\n # @order.update(shipment_total: @order.shipments.sum(&:cost))\n shipment_total = @order.shipments.sum(&:cost)\n @order.update(total: @order.item_total + @order.additional_tax_total + shipment_total + @order.promo_total + @order.adjustment_total,shipment_total: shipment_total)#+ @order.adjustment_total\n unless @order.confirmation_delivered?\n @order.deliver_order_confirmation_email\n @order.update_columns(send_order_confirmation_email: true, order_confirmation_sent: true)\n end\n # Rails.logger.info session[:order_id]\n # session[:order_id] = nil\n if @order.subscribe == true\n @subscriber = Spree::Subscriber.find_by_email(@order.email)\n if @subscriber.present?\n @subscriber.update_attribute(\"last_subscribed_at\", Time.now)\n else\n sub = Spree::Subscriber.create(:email => @order.email, :last_subscribed_at => Time.now)\n Rails.logger.info \"ADDED TO MAILCHIMP LIST\" if sub.add_subscriber_to_mailchimp('subscribers')\n end\n end\n\n if @order.user_id.nil? and @order.email.present?\n user = Spree::User.find_by_email(@order.email)\n @order.update_columns(user_id: user.id) if user\n end\n\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n cookies[:user_movement_id] = nil\n redirect_to order_confirmation_path\n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n\n render :edit\n end\n else\n @order.errors.add(:shipments, \"Can't be blank\")\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to cart_path\n end\n\n end", "def update\n if @current_order.order_items.nil?\n flash[:warning] = \"You have zero items in your cart\"\n redirect_to products_path\n elsif @current_order.update(order_params)\n flash.now[:success] = \"Order was accepted\"\n @current_order.place_order # decrease inventory and change status to paid\n @current_order.save\n # show confirmation page\n @order = @current_order # needed for rendering order information in confirmation page\n render :confirmation\n session[:order_id] = nil\n else\n flash.now[:warning] = 'Order was not not created'\n @current_order.errors.messages.each do |field, msg|\n flash.now[field] = msg\n end\n render :edit\n end\n end", "def complete_order\n # Get the current user's last order (i.e. the current order)\n @order = @current_user.orders.last\n\n # Invoke an action in order.rb that 'moves' items from a user's cart to the current order\n @order.add_line_items_from_cart @cart\n\n # Invoke action in order.rb that updates stock levels\n @order.update_inventory\n\n # Destroy the user's cart\n @cart.destroy\n\n # Set a flash notification that the order was successful\n flash[:notification] = \"Order successful!!!\"\n\n # Redirect to orders#show\n redirect_to order_path(@order)\n end", "def order2\n puts(\"\\n\\n- - - - - - - - - - - - - - - -\\n[SHOP] Executing order 2: CCCCCCC should be $6.00\\n\\n\") \n @shop.reset_order\n 7.times { @shop.add_product_to_order_by_name('C') }\nend", "def finish\n @order.finish\n render_update @order\n end", "def process_order\n @order.process!\n redirect_to root_path\n end", "def change_order_status_on_qsm(mp)\n orders = Spree::Order.where(\"market_place_id=? AND fulflmnt_state IN (?)\", mp.id, ['rfp', 'picked_up'])\n orders.each do |order|\n smp = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=?\", order.seller.id, mp.id) rescue nil\n if smp.present?\n uri = URI(mp.domain_url+'/ShippingBasicService.api/SetSendingInfo')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({'key'=>smp.first.api_secret_key,'OrderNo'=>order.market_place_order_no,'ShippingCorp'=>'Fulfillment By Anchanto','TrackingNo'=>order.fulflmnt_tracking_no})\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|http.request(req)end\n end\n return res && res.code == \"200\" ? \"success\" : \"failed\"\n end\n end", "def update_order_status\n order.delivery_status = status\n order.save\n end", "def completed\n\n @order = current_order\n \n posted_xml = params[:xml]\n\n # Remove XHTML character encoding (hopefully won't need to do this when we receive XML message from RomanCart!)\n xml = posted_xml.sub(\"<?xml version='1.0' encoding='UTF-8'?>\", \"\")\n \n xml_doc = Nokogiri::XML(xml) \n \n if @order = current_order\n \n @order.email = xml_doc.xpath(\"/romancart-transaction-data/sales-record-fields/email\").first.content\n \n @order.user_id = xml_doc.xpath(\"/romancart-transaction-data/orderid\").first.content\n \n @order.number = xml_doc.xpath(\"/romancart-transaction-data/orderid\").first.content \n flash[:message] = \"Order number taken from current time!\"\n @order.number = Time.now.to_i.to_s\n \n # ----------------------- Billing Address -------------------------------\n @order.bill_address = romancartAddress(xml_doc)\n # ----------------------- Delivery Address ------------------------------ \n #<delivery-address1/>\n if xml_doc.xpath(\"/romancart-transaction-data/sales-record-fields/delivery-address1\").first.content.empty?\n @order.use_billing = true\n else\n @order.ship_address = romancartAddress(xml_doc, \"delivery-\")\n end\n \n # Spree StateMachine = 1)cart -> 2)address -> 3)delivery -> 4)payment -> 5)confirm -> 6)complete\n\n # If the order is just for samples then it'll be free so no payment is required\n if @order.item_total == 0\n \n while @order.state != \"complete\"\n @order.next!\n end\n \n else\n \n while @order.state != \"payment\"\n @order.next!\n end\n \n if xml_doc.xpath(\"/romancart-transaction-data/paid-flag\").first.content.eql?(\"True\")\n\n unless @order.payments.exists?\n @order.payments.create!(:amount => @order.total)\n @order.payments.last.payment_method = Spree::PaymentMethod.find_by_name(\"RomanCart\")\n end\n \n # '@order.payments' is an array so need to get last one entered to access 'Spree::Payment' methods\n @order.payments.last.complete\n \n @order.payment_total = @order.total\n\n # To 6 - Complete\n @order.state = \"complete\"\n @order.completed_at = Time.now\n \n @order.save!\n end\n end\n\n end\n\n end", "def set_order\n @order = Order::Preorder.find(params[:id])\n end", "def update\n Payjp.api_key = \"sk_test_c62fade9d045b54cd76d7036\"\n begin\n subscription = Payjp::Subscription.retrieve(id: @order.subscription)\n case status\n when \"cancel\"\n subscription.cancel\n when \"pause\"\n subscription.pause\n end\n rescue => e\n end\n @user = @order.user\n @item = @order.item\n update_role(subscription)\n redirect_back(fallback_location: item_orders_path(@order.item))\n end", "def advance!\n @state = (@state + 1) % @@states.length\n end", "def update\n # puts \"params: #{params.to_hash}\"\n return_order_items = JSON.parse(params[:order][:items]) \n\n # puts \"Params: #{return_order_items}\"\n\n @order = Order.find(params[:id])\n\n\n ActiveRecord::Base.transaction do\n return_order_items.each do |item|\n if params[:order].has_key?(:supplier) \n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.decrement!(:remaining_quantity, item[\"quantity\"].to_i)\n else\n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.increment!(:remaining_quantity, item[\"quantity\"].to_i)\n end\n end\n\n @order.return = true\n if @order.save\n @current_user = current_user\n redirect_to :root, notice: 'Return Order was successfully created.'\n else\n render :new\n end\n end\n\n end", "def update_order_status\n carts = Cart.where(:order_id => self.id)\n order_complete = true\n\n #go through the cart to check state of carts\n carts.each do |cart|\n if cart.status != 5 then\n order_complete = false\n break\n end \n end\n\n if order_complete then\n self.update_attribute( :status, 3) \n end\n\n return order_complete\n end", "def set_order\n @order = Order.find(params[:order_id])\n end", "def set_order\n @order = Order.find(params[:order_id])\n end", "def recalibrate_order!\n order.reload\n order.refresh_shipping_cost\n order.save\n end", "def update\n @order_detail = OrderDetail.find(params[:id])\n @order = Order.find(@order_detail.order_id)\n if params[:order_detail][:production_status] == \"in_production\"\n @order.order_status = \"in_production\"\n @order.save\n end\n if @order_detail.update(order_detail_params)\n count_production_completed = 0\n @order.order_details.each do |order_detail|\n if order_detail.production_status == \"production_completed\"\n count_production_completed += 1\n end\n end\n if @order.order_details.count == count_production_completed\n @order.order_status = \"preparing_for_shipping\"\n @order.save\n end\n redirect_to admin_order_path(@order)\n else\n redirect_to admin_order_path(@order)\n end\n end", "def completed\n\n #@order = current_order\n \n posted_xml = params[:ROMANCARTXML]\n\n # Remove XHTML character encoding (hopefully won't need to do this when we receive XML message from RomanCart!)\n xml = posted_xml.sub(\"<?xml version='1.0' encoding='UTF-8'?>\", \"\")\n \n xml_doc = Nokogiri::XML(xml) \n \n total_price = xml_doc.xpath(\"/romancart-transaction-data/sales-record-fields/total-price\").first.content\n orders = Spree::Order.where(\"state = ? AND total = ?\", \"cart\",total_price)\n Rails.logger.info \"#{orders.count} orders in 'cart' state with a price of #{total_price}\"\n \n if orders.count == 0\n # 5/3/14 DH: Testing ROMANCARTXML feedback locally so price is something...\n orders = Spree::Order.where(\"state = ? AND total > ?\", \"cart\",\"0.00\")\n end\n\n @order = orders.last\n \n # 6/3/14 DH: Since CSRF checking is removed for ROMANCARTXML feedback then need to check 'storeid' + items match\n if @order and feedbackValid(xml_doc,@order)\n Rails.logger.info \"Order number selected: #{@order.number}\"\n \n @order.email = xml_doc.xpath(\"/romancart-transaction-data/sales-record-fields/email\").first.content\n \n @order.user_id = xml_doc.xpath(\"/romancart-transaction-data/orderid\").first.content\n \n @order.number = xml_doc.xpath(\"/romancart-transaction-data/orderid\").first.content\n #Rails.logger.info \"Keeping Spree Order number rather than taking RomanCart one\"\n \n #flash[:message] = \"Order number taken from current time!\"\n #@order.number = Time.now.to_i.to_s\n \n # ----------------------- Billing Address -------------------------------\n @order.bill_address = romancartAddress(xml_doc)\n # ----------------------- Delivery Address ------------------------------ \n #<delivery-address1/>\n if xml_doc.xpath(\"/romancart-transaction-data/sales-record-fields/delivery-address1\").first.content.empty?\n @order.use_billing = true\n else\n @order.ship_address = romancartAddress(xml_doc, \"delivery-\")\n end\n \n # Spree StateMachine = 1)cart -> 2)address -> 3)delivery -> 4)payment -> 5)confirm -> 6)complete\n\n # If the order is just for samples then it'll be free so no payment is required\n if @order.item_total == 0\n \n while @order.state != \"complete\"\n @order.next!\n end\n \n else\n \n while @order.state != \"payment\"\n @order.next!\n Rails.logger.info \"Order number '#{@order.number}' is in state:#{@order.state}\" \n end\n \n #if xml_doc.xpath(\"/romancart-transaction-data/paid-flag\").first.content.eql?(\"True\")\n if xml_doc.xpath(\"/romancart-transaction-data/paid-flag\").first.content.eql?(\"False\")\n Rails.logger.info \"Testing ROMANCARTXML feedback using cheque payment so '<paid-flag>False</paid-flag>'\"\n\n unless @order.payments.exists?\n # 5/3/14 DH: Previously this worked for 'spree-2.0.4' but the payments system was changed in 'spree-2.1'\n #@order.payments.create!(:amount => @order.total)\n #@order.payments.last.payment_method = Spree::PaymentMethod.find_by_name(\"RomanCart\")\n #@order.payments.last.complete\n\t \n # 5/3/14 DH: Taken this from 'spree/2-1-stable/api/app/models/spree/order_decorator.rb' \n payment = @order.payments.build\n payment.amount = @order.total\n payment.complete\n payment.payment_method = Spree::PaymentMethod.find_by_name(\"RomanCart\")\n payment.save!\n\t \n if @order.payments.last.payment_method\n Rails.logger.info \"Creating #{@order.payments.last.payment_method.name} payment of #{@order.total}\"\n else\n Rails.logger.info \"RomanCart payment method not found!\"\n end\n end\n \n \n @order.payment_total = @order.total\n\n # To 6 - Complete\n #@order.payment_state = \"paid\"\n updater = Spree::OrderUpdater.new(@order)\n updater.update_payment_state\n \n @order.state = \"complete\"\n @order.completed_at = Time.now\n @order.save!\n Rails.logger.info \"Order number '#{@order.number}' is in state:#{@order.state}\"\n end\n end\n\n else # No current order (prob because of the CSRF error preventing Devise access the current order session)\n Rails.logger.info \"Well that's what Devise does since there's no CSRF authenticy...doh!\"\n end\n\n end", "def update\n\n\n if @order.contents.update_cart(order_params)\n\n respond_with(@order) do |format|\n format.html do\n if params.has_key?(:checkout)\n @order.next if @order.cart?\n redirect_to checkout_path\n else\n redirect_to cart_path\n end\n end\n format.js {}\n end\n else\n respond_with(@order)\n end\n end", "def set_order\n @item = Order.find(params[:id])\n end", "def update_payment_state\n last_state = order.payment_state\n if payments.present? && payments.valid.size == 0\n order.payment_state = 'failed'\n elsif ['canceled', 'void'].include?(order.state) && order.payment_total == 0\n order.payment_state = 'void'\n elsif !order.outstanding_balance?\n order.payment_state = 'paid'\n elsif order.outstanding_balance < 0\n order.payment_state = 'credit_owed'\n elsif order.final_payments_pending?\n order.payment_state = 'pending'\n elsif order.outstanding_balance > 0\n order.payment_state = 'balance_due'\n end\n order.state_changed('payment') if last_state != order.payment_state\n order.payment_state\n end", "def update_order\r\n @order = @cards.collect {|card| card.to_s}\r\n end", "def order3\n puts(\"\\n\\n- - - - - - - - - - - - - - - -\\n[SHOP] Executing order 3: ABCD should be $7.25\\n\\n\") \n @shop.reset_order\n @shop.add_product_to_order_by_name('A')\n @shop.add_product_to_order_by_name('B')\n @shop.add_product_to_order_by_name('C')\n @shop.add_product_to_order_by_name('D')\nend", "def update_order(order, attributes = nil)\n return false unless order.valid?\n\n if attributes.present? && attributes.is_a?(Hash)\n attributes = attributes.to_json\n end\n\n response = write_order(order, attributes)\n if order.id.present?\n # Klarna update method returns 'An updated representation of the Checkout Order'\n Order.new(JSON.parse(response.body))\n else\n # Klarna create method returns 'URI of the new Checkout Order resource'\n id = response.headers['Location'].split('/').last\n # but this should return 'An updated representation of the Checkout Order'\n # including all other attributes updated/generated by klarna.\n read_order(id)\n end\n end", "def update_order!\n order.update(\n coupon_discount: coupon_discount,\n coupon_applied_at: Time.now,\n coupon_id: coupon.id\n )\n end", "def assign_order\n num = 1\n self.game_players.each do |player|\n player.username = player.user.username\n player.turn_order = num\n if num == 1\n self.up_next = player.user.username\n end\n num = num + 1\n player.save\n end\n end", "def shift_up_orders()\n Feature.update_all('\"order\" = \"order\" - 1', '\"order\" > '+order.to_s)\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def mark_order_complete\n order_params = (driver_order_params)\n order_params[:payable_attributes][:driver_id] = current_user.customer_id\n if @order.single?\n if( (Time.now >= Time.parse(@order.place_date + ' ' + @order.timeslot.start) || true) && (@order.pending? ) && @order.update(order_params) )\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity\n end\n else\n if(@order.update(order_params))\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be completed']}, status: :unprocessable_entity\n end\n end\n end", "def set_order\n @order = ShopOrder.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end", "def set_order\n @order = Order.find(params[:id])\n end" ]
[ "0.7348647", "0.7116942", "0.7114427", "0.7059295", "0.6950519", "0.69288135", "0.6909866", "0.68980557", "0.67957497", "0.6714615", "0.667935", "0.66670233", "0.6596521", "0.6525653", "0.6493509", "0.6483893", "0.6455525", "0.6422882", "0.63958985", "0.6367494", "0.6339467", "0.6337841", "0.6317773", "0.6308931", "0.62369", "0.6203564", "0.61870116", "0.6178626", "0.61600643", "0.61576664", "0.6152228", "0.61367685", "0.61125654", "0.6099252", "0.60878104", "0.60548687", "0.6050973", "0.6045863", "0.6033448", "0.60231787", "0.6019623", "0.6003574", "0.59580904", "0.5949052", "0.5944227", "0.59363407", "0.5917852", "0.5916577", "0.5910936", "0.5906875", "0.5904145", "0.5894861", "0.5874638", "0.58714855", "0.58714855", "0.5870342", "0.58668405", "0.5864459", "0.5864032", "0.5862392", "0.5855002", "0.58547395", "0.5845755", "0.58398587", "0.58286697", "0.58250254", "0.5820497", "0.58129054", "0.58099663", "0.58095884", "0.58082163", "0.58046544", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827", "0.58013827" ]
0.69522107
4
Provides a route to redirect after order completion
def completion_route order_path(@order, :checkout_complete => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def completion_route\n thankyou_order_url(@order)\n end", "def completion_route\n return order_path(@order) unless @order.user.anonymous?\n token_order_path(@order, @order.user.token)\n end", "def completion_route\n order_path(@order)\n end", "def redirect_or_complete_order\n @order = Spree::Order.find_by_number!(params[:id])\n payment = @order.payments.find { |pt| pt.source && pt.source.redirect? && !pt.source.redirect_success? }\n\n if @order.complete? && payment&.pending?\n redirect_to solidus_stripe_sources.redirect_path(@order.number) and return\n end\n end", "def redirect\n @order.assign_attributes(order_params)\n if @order.valid?\n Gocardless::RedirectFlowService::Initialize.run(@order) do |redirect_url|\n return redirect_to redirect_url\n end\n else\n @address = @order.address\n @product = @order.product.decorate\n @order = @order.decorate\n render 'signup/orders/confirm'\n end\n end", "def complete\n handle_callback_params!\n redirect_to redirect_path(@payment.try(:order))\n end", "def index\n redirect_to orders_path\n\n end", "def redirect(options = {})\r\n end", "def redirect_to_finish_wizard(options = nil)\n redirect_to \"/adventures/#{@adventure.slug}\", notice: \"PENDING APPROVAL: <a href='/adventures/new'> Click to add another adventure </a> \"\n end", "def redirects; end", "def redirect_to_full_path\n redirect_to swinfo_full_path(params[:item].strip,\n (params[:sort] || DEFAULT_SORT_ORDER).strip,\n (params[:page] || '1').strip)\n end", "def redirect_to_overview\n if current_order.confirming?\n redirect_to wizard_path(:overview) and return unless step == :overview\n end\n end", "def redirect_to(args)\n end", "def return_to_main\n options = main_path_to_return\n # use url_for in case main_path_to_return returns Hash with status param,\n # which would be interpreted as status option to redirect_to instead of url param\n redirect_to options.is_a?(Hash) ? url_for(options) : options\n end", "def redirect_path\r\n if !(@target =~ /invoice/i).nil?\r\n redirect_to new_invoice_path\r\n else\r\n redirect_to @account\r\n end\r\n end", "def after_anyway\n redirect redirection if redirection\n end", "def redirect_after_create\n @index_path\n end", "def route_index; end", "def follow_redirection(&block); end", "def next_location # :nologin: :norobots:\n redirect_to_next_object(:next, Location, params[:id].to_s)\n end", "def redirect_ok; end", "def redirect_ok; end", "def resolve_landing_path\n params[:return_to] || root_path\n end", "def redirect_path\n if @bank_dup.present?\n latest_ofxes_path\n elsif session[:current_acct].present?\n account_path(session[:current_acct])\n else\n account_path(@entry.splits.order(:id).first.account)\n end\n end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def redirect_after_create\n resources_url {}\n end", "def redirect_to(route)\n status = route[:status] || 302\n url = route[:redirect_to]\n options = self.request.params\n options.merge!(route)\n options - [:controller, :action, :redirect_to, :method, :status, :format]\n url = url_for_pattern(url, options)\n self.response.status = status\n self.response['Location'] = url\n self.response.write(redirect_html(self.request.path_info, url, status))\n end", "def redirect_to(path)\n render(:status => 302, \"Location\" => path) { p { text(\"You are redirected to \"); a(path, :href => path) } }\n end", "def redirect\n redirect_to @goto_url\n end", "def success\n order = Spree::Order.find_by!(number: params[:order_id])\n\n redirect_to order_path(order)\n end", "def redirect_to(route={}, opts={})\n path = url(route)\n # p \"Redirect to: #{path}\"\n raise Doozer::Redirect.new(path, opts)\n end", "def redirect_away(*params)\n store_return_point\n redirect_to(*params)\n end", "def redirect(url); end", "def redirect\n \n if \"succeeded\" == params[\"state\"]\n # Acknowledge the update payment method hosted page id passed in return URL. \n # The response will have customer and their masked payment details.\n result = ChargeBee::HostedPage.acknowledge(params[\"id\"])\n hosted_page = result.hosted_page\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_payment_method/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end", "def post_req\n redirect_to :controller => :listings, :action => :index\n end", "def redirect_to_index\n redirect_to locations_url\n end", "def redirect_path\r\n !(@target =~ /invoice/i).nil? ? redirect_to(new_invoice_path) : set_reload_path\r\n end", "def after_confirmation_path_for(resource_name, resource)\n \t'/welcome/index'\n end", "def show\n redirect_to \"/order_items\"\n end", "def redirect?; end", "def redirect_after_update\n resources_url {}\n end", "def redirect\n @item = Item.find_by_id(Base58.decode(params[:id]))\n redirect_to @item[:location]\n end", "def redirect_url(immediate = false)\n moje_id_request.redirect_url(realm, return_to, immediate)\n end", "def redirect_path\n organization_path(self)\n end", "def route_for_current_step\n steps_routes_mapping[state] || steps_routes_mapping[:pending]\n end", "def route9\n redirect_to params[:key]\n end", "def redirect_handler\n id = params['id']\n result = ChargeBee::HostedPage.retrieve(id)\n if result.hosted_page.state == \"succeeded\"\n redirect_to \"/ssp/subscription\"\n else \n redirect_to \"/400\"\n end\n end", "def handle_completed_request\n redirect_to results_path if cookies[:completed]\n end", "def route\n #TODO\n end", "def send_to_redirect\n redirect_to @short_url.redirect\n end", "def fine_print_return\n redirect_back key: :fine_print_return_to\n end", "def default\n lambda { res.redirect('/', 301) }\n end", "def current\n Job.generate_work_order\n redirect_to '/'\n end", "def redirect(object = nil)\n page_number = params[:original_page].blank? ? nil : params[:original_page]\n \n if params[:from] == \"pending\"\n redirect_to object.nil? ?\n pending_admin_pages_url(:page => page_number) :\n admin_page_url(:id => object, :page => page_number, :from => params[:from])\n else\n redirect_to object.nil? ?\n admin_pages_url(:page => page_number) :\n admin_page_url(:id => object, :page => page_number)\n end\n end", "def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"adjudicators\"\n return (tournament_path(params[:id]) + '/control/adjudicators');\n else\n puts(\"Hack ###\");\n redirect_to root_path;\n return;\n end\n end", "def redirect(url)\n raise \"To be implemented by client application\"\n end", "def on_subscription_success\n redirect_to(action: :index) \n end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end", "def redirect(location, as: 302, **params)\n @connection.status = Rack::Utils.status_code(as)\n @connection.set_response_header(\"Location\", location.is_a?(Symbol) ? app.endpoints.path(location, **params) : location)\n halt\n end", "def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end", "def redirect_to_path(path)\n redirect_to path\n end", "def redirect_if_single_result\n redirect_to asq_path(one_result) if one_result\n end", "def redirect_to_finish_wizard(options = nil)\n redirect_to @setup, notice: \"You are ready to show your setup off to the world!\"\n end", "def index; redirect_to '/'; end", "def gringotts_redirect_to(url)\n # save url for redirecting back after we verify\n flash[:gringotts_next_url] = request.original_url\n \n # keep other flash items (e.g., success messages)\n flash.keep\n \n # last but not least ... redirect\n redirect_to url\n end", "def redirect_ok\n @agent.redirect_ok\n end", "def handle_redirect(response)\n redirect_href = response.http_header[\"Location\"]\n redirect_href = redirect_href.first unless !redirect_href.is_a? Array\n redirect_href = expand_path(redirect_href)\n store_link('redirect', redirect_href, @link_id)\n end", "def index\n redirect_to :action => 'request_bill'\n end", "def product_revenue\n p '#{request.referer}'\n redirect_to \"http://www.google.com\" ,status: 301\n end", "def finalize_flow!\n redirect!(custom_session['return_to'])\n teardown_flow\n throw(:warden)\n end", "def redirect_to_welcome_path(user)\n # FIXME: Hack for now. When spam problem is fixed, we want to wait for email activiation/confirmation\n if user.salesforce_campaign_id\n please_wait_path(new_user_id: user.id)\n else\n welcome_path(new_user_id: user.id)\n end\n end", "def redirect_url(realm, return_to=nil, immediate=false)\n message = get_message(realm, return_to, immediate)\n return message.to_url(@endpoint.server_url)\n end", "def run(req, res)\n to_run = match(req)\n if to_run.nil?\n @res.status = 302\n @res.header[\"location\"] = url\n end\nend", "def next_location_description # :nologin: :norobots:\n redirect_to_next_object(:next, LocationDescription, params[:id].to_s)\n end", "def after_confirmation_path_for(resource_name, resource)\n dm_cms.showpage_path(:locale => DmCore::Language.locale, :slug => 'confirmation_success')\n end", "def index; redirect_to :action => 'list'; end", "def process_order\n @order.process!\n redirect_to root_path\n end", "def after_resending_confirmation_instructions_path_for(resource_name)\n root_path\n end", "def checkout_uri # TODO cambiar por direccion real\n @command.continue_shopping_url = \"http://200.116.131.110:3000/cart/step2\"\n response = @command.send_to_google_checkout.redirect_url \n end", "def redir\n redirect_to facility_path_for(@listing), :status => 301\n end", "def send_unstarted_claiments_to_the_start\n redirect_to root_url unless current_policy_routing_name\n end", "def finish_wizard_path\n admin_users_path\n end", "def redirect(url)\n headers['Location'] = url\n self.status = 302\n raise FinishRequest\n end", "def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"teams\"\n return (tournament_path(@tournament) + '/control/teams');\n else\n puts(\"Hack ###\");\n redirect_to root_path;\n return;\n end\n end", "def redirect_index_to_kitchen\n\n redirect_to kitchen_path\n\nend", "def new\n redirect_to orders_path\n end", "def after_confirmation_path_for(resource_name, resource)\n '/'\n end", "def defer_to(params = {}, &conditional_block)\n Router.routes << (route = to_route(params, &conditional_block))\n route\n end", "def show\n redirect_to orders_path\n end", "def after_commit_redirect_path\n resource.fabric ? edit_fabric_path(resource.fabric) : fabrics_path\n end", "def after_sign_in_path_for(resource)\n if resource.kind_of? ::AdminUser\n '/admin'\n else\n if session[:redirect_to_order] = 1\n new_order_path\n else\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end\n end\n end", "def redirect_to_origin(opts = {})\n if params[:ret].present?\n redirect_to params[:ret], opts\n else\n redirect_to opts.merge!(action: :index)\n end\n end", "def redirect_to(url)\n raise \"Already delivered response\" if self.already_built_response?\n res.status = 302\n res['Location'] = url\n @already_built_response = true\n self.session.store_session(res)\n self.flash.store_flash(res)\n end", "def index\n return redirect_to place_path(params[:place_id])\n end", "def follow_get_redirection(&block); end", "def success\n authorize! :view_sofort_thankyou_page, @order\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/show' if @order.confirmed?\n transaction = ::Sofort::FinishTransaction.new(@order)\n transaction.run do\n @order.status = :paid\n @order.confirm\n return render 'signup/orders/show'\n end\n # customer opens success-page, but transaction is not complete\n flash.now[:notice] = t(:transaction_no_confirmation)\n render 'signup/orders/show'\n end", "def route_based_on_status\n status = group_invite_status&.status\n case status\n when \"unaccepted\", nil\n redirect_to group_assignment_invitation_path(invitation)\n when \"completed\"\n redirect_to successful_invitation_group_assignment_invitation_path if action_name != \"successful_invitation\"\n when *(GroupInviteStatus::ERRORED_STATUSES + GroupInviteStatus::SETUP_STATUSES)\n redirect_to setup_group_assignment_invitation_path if action_name != \"setup\"\n else\n raise InvalidStatusForRouteError, \"No route registered for status: #{status}\"\n end\n end", "def redirect_to_results\n redirect_to results_path(params[:query])\n end", "def redirect_returning_user(pathway, options = {})\n params = {}\n case pathway\n\t when \"gift_sent\"\n params[:action] = \"show_organization\"\n params[:organization_id] = options['organization_id']\n\t when \"self\"\n params[:action] = \"give_gift_self\"\n params[:gift_template_id] = options['gift_template_id']\n\t when \"friend\"\n params[:action] = \"give_gift_friends\"\n params[:gift_template_id] = options['gift_template_id']\n\t else\n\t\t flash[:notice] = \"We're sorry, but something went wrong. Please try again.\"\n params[:action] = \"index\"\n\t end\n redirect_to(params) and return\n end", "def test_assert_redirect_to_named_route\n with_routing do |set|\n set.draw do |map|\n map.route_one 'route_one', :controller => 'action_pack_assertions', :action => 'nothing'\n map.connect ':controller/:action/:id'\n end\n set.install_helpers\n\n process :redirect_to_named_route\n assert_redirected_to 'http://test.host/route_one'\n assert_redirected_to route_one_url\n assert_redirected_to :route_one_url\n end\n end" ]
[ "0.74368024", "0.7307958", "0.72201335", "0.69129425", "0.66553843", "0.6452472", "0.62485075", "0.62060976", "0.6169361", "0.611184", "0.6103027", "0.6096453", "0.6055876", "0.60554457", "0.60248774", "0.60073847", "0.6004088", "0.59874326", "0.5986176", "0.5959058", "0.59493524", "0.59493524", "0.5934456", "0.5933761", "0.59241724", "0.58977187", "0.5893605", "0.5886955", "0.5874747", "0.58738023", "0.5868603", "0.58628297", "0.5854633", "0.5845425", "0.5840656", "0.58357656", "0.58311874", "0.5826332", "0.5817879", "0.5781217", "0.5777296", "0.5762135", "0.5747356", "0.5747266", "0.573072", "0.5727514", "0.5725678", "0.57167816", "0.57155174", "0.5711092", "0.5708271", "0.5702209", "0.5687613", "0.56695044", "0.5665053", "0.5664077", "0.5661181", "0.5659253", "0.56545216", "0.5648029", "0.5642935", "0.5636136", "0.5626774", "0.5625643", "0.5608407", "0.5605117", "0.56051064", "0.55994254", "0.5596006", "0.559382", "0.55807763", "0.5573618", "0.55680573", "0.55653256", "0.55647224", "0.55602723", "0.5558065", "0.5556984", "0.5550207", "0.55476844", "0.554251", "0.5542279", "0.55375403", "0.5527592", "0.55254215", "0.5517119", "0.55096847", "0.55089015", "0.55069983", "0.55065244", "0.55052656", "0.5504099", "0.5502307", "0.5500626", "0.5497165", "0.54954046", "0.5487422", "0.5480855", "0.547735", "0.54767615" ]
0.74656683
0
Provides a description for the next matcher
def desc(string) @last_description = string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n \"#{match.description} #{label}\"\n end", "def next_match_title\n \"Match#{next_match_number}\"\n end", "def matcher_name; end", "def matcher_name; end", "def get_description_from_matcher(should_or_should_not, method, *args, &block) #:nodoc:\n verb = should_or_should_not.to_s.gsub('_', ' ')\n\n desc = Remarkable::Matchers.send(method, *args, &block).spec(self).description\n verb = Remarkable.t(\"remarkable.core.#{should_or_should_not}\", :default => verb)\n rescue\n desc = method.to_s.gsub('_', ' ')\n ensure\n verb << ' ' << desc\n end", "def matcher; end", "def matcher; end", "def last_submatcher_run; end", "def underlying_matcher; end", "def underlying_matcher; end", "def matcher_name=(_arg0); end", "def usage\n matchers.map do |regexp, options, action, description|\n next unless description\n if options[:sent_to_me]\n at_nick + \" \" + description\n else\n description\n end\n end.compact\n end", "def desc(description); @next_desc = description; end", "def desc(description); @@next_desc = description; end", "def description(options={}) #:nodoc:\n message = super(options)\n message.strip!\n\n optionals = self.class.matcher_optionals.map do |optional|\n if @options.key?(optional)\n value = @options[optional]\n defaults = [ (value ? :positive : :negative) ]\n\n # If optional is a symbol and it's not any to any of the reserved symbols, search for it also\n defaults.unshift(value) if value.is_a?(Symbol) && !OPTIONAL_KEYS.include?(value)\n defaults << ''\n\n options = { :default => defaults, :inspect => value.inspect, :value => value.to_s }\n translate_optionals_with_namespace(optional, defaults.shift, options)\n else\n translate_optionals_with_namespace(optional, :not_given, :default => '')\n end\n end.compact\n\n message << ' ' << array_to_sentence(optionals)\n message.strip!\n message\n end", "def description\n parser.description\n end", "def validator_description\n\t\t\treturn \"a '%s'\" % [ self.pattern_name ]\n\t\tend", "def match()\n end", "def parse_matcher(matcher)\n matcher\n end", "def match\n @match\n end", "def match; end", "def match; end", "def match_name\n \"#{group.name} #{name} #{I18n.t(:match)}\"\n end", "def submatcher; end", "def submatcher; end", "def post_match() end", "def name\n @example.description.scan(/\\((\\w+)\\)/).flatten.first\n rescue\n @example.description\n end", "def on_match_pattern_p(node); end", "def describe(desc, *additional_desc, &block); end", "def description\n yield if block_given?\n end", "def match\n @argument_matchers[0...-1].each_with_index do |argument_matcher, index|\n @argument_matchers[index + 1].successor = argument_matcher\n end\n\n chain_matcher = @argument_matchers.last\n chain_matcher.check_to_assing_and_match(@data)\n end", "def create_matcher(type, name, &block)\n matcher = StepMatcher.new(name, &block)\n @hash_of_lists_of_matchers[type] << matcher\n matcher\n end", "def initialize\n @matchers = []\n @matches = {}\n end", "def label\n @example.description.scan(/Campo\\s(.*?)\\s\\(\\w+\\)/).flatten.first\n rescue\n @example.description\n end", "def describe\n # TODO\n end", "def create_matcher(type, name, &block)\n matcher = Step.new(name, &block)\n @hash_of_lists_of_steps[type] << matcher\n matcher\n end", "def matches_list\n #Need to pull in the region name based on selection\n puts \"#{@club_region} Precision Rifle Matches:\"\n puts <<-DOC.gsub /^\\s*/, ''\n 1. First Match\n 2. Second Match\n DOC\n end", "def describe\n @description\n end", "def describe\n @description\n end", "def validator_description\n\t\t\treturn \"a value matching the pattern %p\" % [ self.pattern ]\n\t\tend", "def matches\n parse\n end", "def run\n # header\n cols = [:title, :candidates, :s30, :s40, :s50, :c_tm, :s_tm, :correct]\n puts cols.join(\"\\t\")\n\n # simhash: 5..9\n @matcher.options[:candidates] = :simhash\n 5.upto(9).each do |i|\n @matcher.options[:simhash_max_hamming] = i\n report(\"simhash #{i}\")\n end\n\n # ngrams: 5..3\n @matcher.options[:candidates] = :ngrams\n 5.downto(3).each do |i|\n @matcher.options[:ngram_overlaps] = i\n report(\"ngrams #{i}\")\n end\n\n # all\n @matcher.options[:candidates] = :all\n report(\"all\")\n end", "def fnmatch(matcher); end", "def on_match_pattern(node); end", "def pick_matcher(ind = nil)\n @matcher_i = ind || yield(headers)\n end", "def pre_match() end", "def match(pattern); end", "def desc() summary; end", "def descriptions\n @all_descriptions ||= @doc.match DESCRIPTION_MATCHES\n end", "def next_regex regex\n if regex.is_a? Symbol\n regex = @text_patterns[regex]\n raise \"Pattern specified #{regex} does not exist in text_patterns \" unless regex\n end\n @last_regex = regex\n find_more\n end", "def submatchers; end", "def get_matcher\n @matcher_string = self.class.to_s.split('::').last.gsub(/([A-Z][a-z]+)/,'\\1_').chomp('_').upcase\n @log_line_matcher = RailsLogStat.const_get( @matcher_string )\n end", "def description\n [@group.description,@description].join(' ')\n end", "def match_captures; end", "def repeated_descriptions(node); end", "def next_token; end", "def cmd_compreply\n puts references_by_pattern * \" \"\n end", "def description=(_arg0); end", "def description=(_arg0); end", "def description=(_arg0); end", "def matched\n match.to_s if matched?\n end", "def cmd_list pattern = '.'\n puts \"Following mnemo's #{pattern && \"matching regexp /#{pattern}/\"} are present\"\n puts\n references_by_pattern(pattern).each do |reference|\n puts (\" \" * 4) + reference\n end\n\n puts\n puts \"Done ..\"\n end", "def inc_match\n @matchedCount += 1\n end", "def match_message\n \"Matches completion with condition #{condition.inspect}.\"\n end", "def name\n @token\n #match(/^Information\\son\\s([&#+][^:]+):$/)\n end", "def markup(match)\n raise NotImplementedError\n end", "def description\n \"match fixture #{@fixture.path}\"\n end", "def name\n @token\n #match(/^Information\\son\\s([^\\s]+)/)\n end", "def run_matchers # :nodoc:\n matches = Matchers.run(phrase_without_matches)\n matches.each do |match|\n text, category = match\n if text\n @matches[category] << text\n end\n end\n end", "def match(p0) end", "def match(p0) end", "def base_description(_); end", "def desc=(_); end", "def matchers\n @matchers ||= {}\n end", "def description\n parsed {\n @description\n }\n end", "def describe_parameter_extra_regexps(name)\n [\n \"#{name}::\",\n \"+#{name}+::\",\n \"<tt>#{name}</tt>::\"\n ].map do |pattern|\n r = pattern.is_a?(Regexp) ? pattern : Regexp.escape(pattern)\n /#{r}\\n\\ {2,}.+/m\n end\n end", "def rspec_matcher_message(matcher)\n if @negated\n if matcher.respond_to?(:failure_message_for_should_not)\n return matcher.failure_message_for_should_not\n end\n if matcher.respond_to?(:negative_failure_message)\n return matcher.negative_failure_message\n end\n end\n\n if matcher.respond_to?(:failure_message_for_should)\n return matcher.failure_message_for_should\n end\n if matcher.respond_to?(:failure_message)\n return matcher.failure_message\n end\n\n return matcher.to_s # TODO: or just `nil` ?\n end", "def frame_description(b); end", "def next() end", "def next() end", "def description()\n return \"#{@name} is a #{@color} colored planet, it has #{@moon_count} moons, and it's #{@distance_from_the_sun} from the Sun. It is #{@robots} that there are robots there, and it is #{@cats} that there are cats there.\"\n end", "def step_name(keyword, step_match, status, source_indent, background, file_colon_line)\n step_name = step_match.format_args(lambda{|param| \"*#{param}*\"})\n @test_steps << \"#{keyword}#{step_name}\"\n end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def description; end", "def desc; end", "def matcher=(_arg0); end", "def pattern\n @pattern\n end", "def description\n super + \", Mocha\"\n end", "def failure_message\n actual = prettify_args(@actual)\n matcher = prettify_matcher(@metadata[:name])\n\n if @metadata[:args].count > 0\n args = prettify_args(*@metadata[:args])\n\n \"'#{actual}' should #{matcher} '#{args}'\"\n else\n \"'#{actual}' should #{matcher}\"\n end\n end", "def inspect\n \"<Pattern: #{id}>\"\n end", "def match_started(match)\n\n end", "def next_note\r\n end", "def failure_message\n if @options[:count]\n \"expected following text to match selector #{@expected} #{@options[:count]} times, but found it #{@occurences} times:\\n#{@document} \"\n else\n \"expected following text to match selector #{@expected}:\\n#{@document}\"\n end\n end" ]
[ "0.7377276", "0.7241259", "0.72155446", "0.72155446", "0.6540536", "0.6452032", "0.6452032", "0.62308383", "0.61723787", "0.61723787", "0.61167103", "0.61050314", "0.6079136", "0.5879723", "0.570075", "0.5685373", "0.5679126", "0.56703204", "0.5669363", "0.5667035", "0.56642675", "0.56642675", "0.56545836", "0.56273854", "0.56273854", "0.55325186", "0.55003995", "0.5454961", "0.5445586", "0.5440023", "0.54001784", "0.53910357", "0.5365224", "0.533922", "0.5314365", "0.5302764", "0.5300196", "0.5289955", "0.5289955", "0.5282459", "0.5275058", "0.527086", "0.52700716", "0.5263205", "0.5259692", "0.5258351", "0.52547216", "0.5249614", "0.52482635", "0.5238744", "0.5222912", "0.5216371", "0.5207534", "0.5199069", "0.5175394", "0.5175097", "0.5171304", "0.5164258", "0.5164258", "0.5164258", "0.51607215", "0.51502895", "0.51368773", "0.5133491", "0.5133457", "0.5121814", "0.5118262", "0.51083297", "0.5107021", "0.51066256", "0.51066256", "0.5097635", "0.508589", "0.5072544", "0.506082", "0.50581414", "0.50575876", "0.50571537", "0.50489515", "0.50489515", "0.5048747", "0.5048175", "0.50421965", "0.50421965", "0.50421965", "0.50421965", "0.50421965", "0.50421965", "0.50421965", "0.50421965", "0.50421965", "0.50421965", "0.50380945", "0.50342673", "0.50302005", "0.5023588", "0.5020894", "0.50174797", "0.50162846", "0.5008905", "0.49941674" ]
0.0
-1
A list of regular expressions to apply to input being sent to the plugin, along with blocks of actions to perform. Each element is a [regexp, options, action, description] array.
def matchers @matchers ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec(input, events=[])\n match = input.scan(@regexp)\n\n if match\n events << self\n events << CLOSE\n events << match.length\n end\n\n events\n end", "def regexps; end", "def exec(input, events=[])\n match = input.scan(@regexp)\n\n if match\n events << self\n events << CLOSE\n events << match.length\n end\n\n events\n end", "def match(regex, &action)\n append_action(regex, action)\n self\n end", "def match regexp, opt = {}, &block\n opt = { in: :line, match: :first }.merge opt\n (opt[:in] == :output ? receive_update_callbacks : receive_line_callbacks) << lambda do |data|\n matches = data.scan regexp\n if matches.length > 0\n case opt[:match]\n when :first\n EM.next_tick do\n block.call *matches[0]\n end\n when :last\n EM.next_tick do\n block.call *matches[matches.length-1]\n end\n end\n end\n end\n end", "def signature\r\n [@regexp, @replace]\r\n end", "def signature\r\n [@regexp, @replace]\r\n end", "def define_regexp\n # Default pattern if there is no tags specified on command line\n if @options[:tags].nil?\n pattern = 'TODO|FIXME'\n else\n # Parse defined tags on command line\n pattern = ''\n tags_names = @options[:tags].split(',')\n tags_names.each do |tag_name|\n pattern << (pattern.empty?) ? \"#{tag_name}\" : \"|#{tag_name}\"\n end\n end\n pattern\n end", "def patterns; end", "def add_blocks_to_regexp(options)\n options.inject({}) do |x, (regexp_str, value)|\n key = regexp_str.is_a?(String) ? Regexp.new(\"{{#{regexp_str}}}\") : /{{#{regexp_str.source}}/\n x[key] = value\n x\n end\n end", "def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = ACTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 142:11: 'actions'\n match( \"actions\" )\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__, 11 )\n\n end", "def each(&block)\n @patterns.each(&block)\n end", "def span_parser_regexps(parsers = T.unsafe(nil)); end", "def patterns\n @patterns ||=\n [\n {\n :type => :erb,\n :rx => /\\.erb\\Z/,\n :rep => '',\n },\n {\n :type => :none,\n :rx => /\\Z/,\n :rep => '',\n },\n ]\n end", "def hear(regex, &block)\n @regexes[regex] = block\n end", "def initialize regex=nil, priority=50, &action\n @regex = regex\n @action = action\n @priority = priority\n end", "def run\n handlers.each do |info, handler|\n matches = matches_options?(info[:type], info[:regexp])\n break if matches && handler.call(options)\n end\n end", "def usage\n matchers.map do |regexp, options, action, description|\n next unless description\n if options[:sent_to_me]\n at_nick + \" \" + description\n else\n description\n end\n end.compact\n end", "def methods_matching(re); end", "def lex_en_regexp_modifiers=(_arg0); end", "def lex_en_regexp_modifiers=(_arg0); end", "def lex_en_regexp_modifiers=(_arg0); end", "def on_matched_reply(regexp, &block)\n @matched_reply_actions ||= {}\n @matched_reply_actions[regexp] = block\n end", "def match(*pattern, &block)\n\t\t\t@rules << Rule.new(pattern, block)\n\t\tend", "def _perform(text)\n lines = text.split(\"\\n\")\n lines.map! {|line|\n line.gsub(/\\[\\[(.)+\\]\\]/i){|found|\n /\\[\\[([a-z_]*): ([a-z_]*)\\]\\]/i =~ found\n _perform(self.send($1.to_sym, $2))\n }\n }\n lines.join(\"\\n\")\n end", "def plugin_regex(type: :export)\n type = valid_type(type)\n pattern = []\n plugins[type].each do |_, options|\n pattern << options[:trigger].normalize_trigger\n end\n Regexp.new(\"^(?:#{pattern.sort.uniq.join('|')})$\", true)\n end", "def testRegExp(command, input)\n\treturn case command\n\twhen \"a\"\n\t\tssn(input)\n\twhen \"b\"\n\t\tphoneNumber(input)\n\twhen \"c\"\n\t\temail(input)\n\twhen \"d\"\n\t\tname(input)\n\twhen \"e\"\n\t\tdate(input)\n\twhen \"f\"\n\t\taddress(input)\n\twhen \"g\"\n\t\tletter(input)\n\twhen \"h\"\n\t\tmilitaryTime(input)\n\twhen \"i\"\n\t\tcurrency(input)\n\twhen \"j\"\n\t\twebsite(input)\n\twhen \"k\"\n\t\tpassword(input)\n\twhen \"l\"\n\t\tion(input)\n\telse \n\t\t\"Invalid input... try again.\"\n\tend\nend", "def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end", "def add_regexp_handling pattern, name, exclusive = false\n bitmap = @attributes.bitmap_for(name)\n @regexp_handlings << [pattern, bitmap]\n @exclusive_bitmap |= bitmap if exclusive\n end", "def consume_multi_block(end_expression, *sub_expr_patterns); end", "def process(items) \n out = []\n \n if items.is_a?(Array)\n items.each do |item|\n out << item.scan(@regex).flatten\n end\n \n elsif items.is_a?(String)\n out = items.scan(@regex).flatten#{|m| m.to_s}\n \n else\n out = items\n end\n \n out.flatten\n end", "def parse_all\n #check for skipping the block using add on module...\n parse_spc\n if @skiper.select{|f|send(f)}.length>0\n p \"skip > #{@row}\" if @dbg[:parse]\n else\n @plt_opt= '' \n #rtn= true if @selector.select{|f|send(f)}.length>0\n rtn = true if shortcut_exec( /(^[\\t ]*)\\-([\\w\\-&\\/:#.%]*\\{.*\\}=*) *([^\\n]*)\\n/) \n rtn = true if shortcut_exec( /(^[\\t ]*)\\-([\\w\\-&\\/:#.%=]*) *([^\\n]*)\\n/) \n rtn = true if shortcut_equal( /(^[\\t ]*)=([\\w\\-&\\/:#.%=]*) *([^\\n]*)\\n/) \n \n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]]+\\{.*?\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]]+\\{.*?\\}[= ]*)()\\n/)\n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]%=]+ )([^\\n]*)\\n/) \n rtn = true if get_hot_simple(/^[\\t ]*(%)([\\$\\w\\-&\\/:#.\\[\\]%=]+)()\\n/) \n \n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.]*\\{.*\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.]*\\{.*\\}[= ]*)()\\n/)\n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.=]* )([^\\n]*)\\n/) \n rtn = true if get_div(/^[\\t ]*([#.])([\\w\\-&\\/.=]*)()\\n/) \n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.]*\\{.*\\}[= ]*)([^\\n]*)\\n/)\n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.]*\\{.*\\}[= ]*)()\\n/)\n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.=]* )([^\\n]*)\\n/) \n rtn = true if get_input( /^[\\t ]*(:)([\\w\\-&\\/#.=]*)()\\n/) \n rtn = true if parse_hot\n rtn = true if merge_hot\n rtn = true if merge_w2x\n rtn = true if parse_set_var\n rtn = true if parse_set_mem\n rtn = true if parse_get_mem\n rtn = true if inline_tag\n rtn = true if parse_end\n if parse_tags\n rtn = nil\n elsif !rtn\n auto_close \n end\n end\n rtn\n end", "def mreplace regexp, &block\n matches = []\n offset = 0\n while self[offset..-1] =~ regexp\n matches << [offset, $~]\n offset += $~.end($~.size - 1)\n end\n raise 'unmatched' if matches.empty?\n\n matches.reverse.each do |offset, match|\n slice = self[offset...-1]\n send = (1...match.size).map {|i| slice[match.begin(i)...match.end(i)]}\n if send.length == 1\n recv = block.call(send.first)\n self[offset+match.begin(1)...offset+match.end(1)] = recv\n else\n recv = block.call(*send)\n next unless recv\n (1...match.size).map {|i| [match.begin(i), match.end(i), i-1]}.sort.\n reverse.each do |start, fin, i|\n self[offset+start...offset+fin] = recv[i]\n end\n end\n end\n self\n end", "def format_regex\n callback.options[:live_validator] || callback.options[:with]\n end", "def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end", "def lex_en_regexp_modifiers; end", "def lex_en_regexp_modifiers; end", "def lex_en_regexp_modifiers; end", "def scan_arguments(*how)\n if how.count == 1\n pattern = how.first\n else\n left_delimiter = how[0] || self.left_delimiter\n right_delimiter = how[1] || self.right_delimiter\n\n return [] unless left_delimiter && right_delimiter\n\n pattern = Regexp.new(Regexp.escape(left_delimiter) + '(.*?)' + Regexp.escape(right_delimiter))\n end\n\n @arguments = @base.scan(pattern).flatten\n end", "def initialize(*patterns)\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_procs = DEFAULT_IGNORE_PROCS.dup\n @items = []\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end", "def convert_regexp_handlings str, attrs, exclusive = false\n @regexp_handlings.each do |regexp, attribute|\n next unless exclusive == exclusive?(attribute)\n str.scan(regexp) do\n capture = $~.size == 1 ? 0 : 1\n\n s, e = $~.offset capture\n\n attrs.set_attrs s, e - s, attribute | @attributes.regexp_handling\n end\n end\n end", "def regexp\n pattern = '(?:' + Regexp.union([@name] + @aliases).source + ')'\n\n @arguments.each_value do |format|\n arg_regexp = case format\n when Array then Regexp.union(format)\n when Regexp then format\n when Symbol then ARG_FORMATS.fetch(format)\n else Regexp.escape(format.to_s)\n end\n\n pattern << ' (' << arg_regexp.source << ')'\n end\n\n # match the full message\n pattern << '$'\n\n return Regexp.new(pattern)\n end", "def matchtask(regex, split = nil)\n tasks = []\n regex.each do |r|\n @message.scan(eval(r['pattern'])).each do |arr|\n if split.nil?\n task = PACTask.new(arr[0])\n task.add_commit(self)\n self.referenced = true\n task.label = r['label']\n tasks << task\n else\n arr[0].split(split).each do |s|\n task = PACTask.new(s)\n task.add_commit(self)\n task.label = r['label']\n self.referenced = true\n tasks << task\n end\n end\n end\n end\n\n tasks\n end", "def scan\n list = []\n io.each do |input|\n # TODO: limit to text files, how?\n begin\n text = read(input)\n text.scan(regex) do\n list << Match.new(input, $~)\n end\n rescue => err\n warn(input.inspect + ' ' + err.to_s) if $VERBOSE\n end\n end\n list\n end", "def all_re(pattern, &hndlr)\n @j_del.allWithRegEx(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end", "def span_parser_regexps(parsers = @span_parsers)\n span_start = /#{parsers.map {|name| @parsers[name].span_start }.join('|')}/\n [span_start, /(?=#{span_start})/]\n end", "def initialize( *patterns )\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_re = nil\n @items = []\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end", "def setup_rules\n define_match_any_of\n\n shortcode_configuration = @configuration\n klass.rule(:block_tag) { match_any_of shortcode_configuration.block_tags }\n klass.rule(:self_closing_tag) { match_any_of shortcode_configuration.self_closing_tags }\n\n klass.rule(:quotes) { str(shortcode_configuration.attribute_quote_type) }\n\n klass.rule(:space) { str(\" \").repeat(1) }\n klass.rule(:space?) { space.maybe }\n klass.rule(:newline) { (str(\"\\r\\n\") | str(\"\\n\")) >> space? }\n klass.rule(:newline?) { newline.maybe }\n klass.rule(:whitespace) { (space | newline).repeat(1) }\n\n klass.rule(:key) { match('[a-zA-Z0-9\\-_]').repeat(1) }\n\n klass.rule(:value_with_quotes) { quotes >> (quotes.absent? >> any).repeat.as(:value) >> quotes }\n klass.rule(:value_without_quotes) { quotes.absent? >> ((str(\"]\") | whitespace).absent? >> any).repeat.as(:value) }\n klass.rule(:value) { shortcode_configuration.use_attribute_quotes ? value_with_quotes : (value_without_quotes | value_with_quotes) }\n\n klass.rule(:option) { key.as(:key) >> str(\"=\") >> value }\n klass.rule(:options) { (str(\" \") >> option).repeat(1) }\n klass.rule(:options?) { options.repeat(0, 1) }\n\n klass.rule(:open) { str(\"[\") >> block_tag.as(:open) >> options?.as(:options) >> str(\"]\") >> newline? }\n klass.rule(:close) { str(\"[/\") >> block_tag.as(:close) >> str(\"]\") >> newline? }\n klass.rule(:open_close) { str(\"[\") >> self_closing_tag.as(:open_close) >> options?.as(:options) >> str(\"]\") >> newline? }\n\n klass.rule(:text) { ((close | block | open_close).absent? >> any).repeat(1).as(:text) }\n klass.rule(:block) { (open >> (block | text | open_close).repeat.as(:inner) >> close) }\n\n klass.rule(:body) { (block | text | open_close).repeat.as(:body) }\n klass.root(:body)\n end", "def exec(input, events=[])\n if input.test(rule)\n events << self\n events << CLOSE\n events << 0\n end\n\n events\n end", "def match(*args)\n if args.first.is_a?(Qo::Matchers::GuardBlockMatcher)\n Qo::Matchers::PatternMatch.new(*args)\n else\n match_target, *qo_matchers = args\n Qo::Matchers::PatternMatch.new(*qo_matchers).call(match_target)\n end\n end", "def parse(input_string)\n _p, block= @patterns.detect do |pattern, block|\n pattern === input_string\n end\n if block\n # Perlish global ugliness necessitated by the use of\n # Enumerable#detect above. FIXME.\n if $1\n # if the regex had a group (based on the assumption that $1\n # represents the result of the === that matched), call the block\n # with all the group matches as arguments.\n block.call($~[1..-1])\n else\n block.call()\n end\n else\n puts \"i love you\"\n end\n end", "def on_matching_regex(controller_regex, action_regex = nil)\n @conditions << construct_condition_for_regex(controller_regex, action_regex)\n end", "def nested_arg_action!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 50)\n\n \n # - - - - main rule block - - - -\n # at line 535:2: '[' ( options {greedy=false; k=1; } : NESTED_ARG_ACTION | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | . )* ']'\n match(?[)\n # at line 536:2: ( options {greedy=false; k=1; } : NESTED_ARG_ACTION | ACTION_STRING_LITERAL | ACTION_CHAR_LITERAL | . )*\n loop do #loop 11\n alt_11 = 5\n look_11_0 = @input.peek(1)\n\n if (look_11_0 == ?]) \n alt_11 = 5\n elsif (look_11_0 == ?[) \n alt_11 = 1\n elsif (look_11_0 == ?\") \n alt_11 = 2\n elsif (look_11_0 == ?\\') \n alt_11 = 3\n elsif (look_11_0.between?(0x0000, ?!) || look_11_0.between?(?#, ?&) || look_11_0.between?(?(, ?Z) || look_11_0 == ?\\\\ || look_11_0.between?(?^, 0xFFFF)) \n alt_11 = 4\n\n end\n case alt_11\n when 1\n # at line 537:4: NESTED_ARG_ACTION\n nested_arg_action!\n\n when 2\n # at line 538:4: ACTION_STRING_LITERAL\n action_string_literal!\n\n when 3\n # at line 539:4: ACTION_CHAR_LITERAL\n action_char_literal!\n\n when 4\n # at line 540:4: .\n match_any\n\n else\n break #loop 11\n end\n end\n match(?])\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 50)\n\n end", "def grammar\n @grammar ||= %w[\n ^(help)(\\s+setup|\\s+start|\\s+stop|\\s+abort|\\s+terminate|\\s+results|\\s+purge|\\s+show|\\s+status)?$\n ^(setup)(\\s+force|\\s+help)?$\n ^(start)(\\s+redeploy|\\s+help)?$\n ^(stop)(\\s+suspend|\\s+wait|\\s+suspend\\s+wait|\\s+wait\\s+suspend|\\s+help)?$\n ^(abort)(\\s+suspend|\\s+help)?$\n ^(results)(\\s+show|\\s+exclude|\\s+include|\\s+report|\\s+export|\\s+import|\\s+help)?(\\s+[\\d\\-:]+|\\s+last)?(.*)$\n ^(purge)(\\s+tests|\\s+clusters|\\s+all|\\s+help)?$\n ^(show)(\\s+jmeter|\\s+cluster|\\s+monitor|\\s+help|\\s+active)?(|\\s+all)?$\n ^(terminate)(\\s+help)?$\n ^(status)(\\s+help)?$\n ].collect { |p| Regexp.compile(p) }\n end", "def do_parse text, pattern\n data = pattern[:blk].call(text.scan(pattern[:exp]))\n\n puts data.inspect\n end", "def __captures(ary)\n i = 1 # Captures do NOT include $& (the entire matched string)\n lim = length\n in_str = @inputString\n while i < lim\n x = self.begin(i)\n if x == -1\n ary << nil\n else\n y = self.end(i)\n ary << in_str[x, y-x] # GEMSTONE\n end\n i += 1\n end\n ary\n end", "def template_regex(type: :export)\n type = valid_type(type)\n pattern = []\n plugs = plugins[type].clone\n plugs.delete_if { |_, o| o[:templates].nil? }.each do |_, options|\n options[:templates].each do |t|\n pattern << t[:trigger].normalize_trigger\n end\n end\n Regexp.new(\"^(?:#{pattern.join('|')})$\", true)\n end", "def process_rules *args, &block\n Shotshare::ProcessRuleContainer.instance.rules = \\\n Docile.dsl_eval(Shotshare::Dsl::ProcessRuleBuilder.new, &block).build\nend", "def parse\n begin\n #regex_rules_params = \"(^#.*)\\nif([\\s\\w\\:\\\"\\.\\;\\(\\)\\,\\-]+)\\{([\\@\\<>=a-zA-Z0-9\\s\\[\\]\\_\\:\\\"\\.\\;\\(\\)\\,\\-\\/]+)\\}$\"\n #regex_rules_params2 = \"(^#.*)\\n(\\S+)(.+)\\n\\{\\n([\\s\\S]*)\\}\"\n parts = @text.scan(/(^#.*)\\n(\\S+)\\s(.+)\\n\\{\\n([\\s\\S]*)\\n\\}/)[0]\n parse_name(parts[0])\n @type = parts[1]\n\n self.disable! if parts[2] =~ /.*false #/\n #if the join is true, dont have conditions...\n if parts[2] =~ /true/\n @conditions << Condition.new(type:\"true\")\n elsif parts[2] =~ /(anyof|allof)/\n @join = parts[2][/^\\S+/]\n @conditions.concat(Condition.parse_all( parts[2].scan(/\\(([\\S\\s]+)\\)/)[0][0] ))\n else\n @conditions << Condition.new(text:parts[2])\n end\n\n @actions.concat(Action.parse_all(parts[3]))\n rescue => e\n puts e.to_s + \" - text: #{@text}\"\n end\n end", "def define_step(regex, &blk)\n steps[regex] = blk\n end", "def pre_match() end", "def regex(**mapping)\n render(STANDARD, REGEX, **mapping)\n end", "def lex_group start_state, regexp, action = nil\n rule = Rule.new(start_state, regexp, action)\n rule.group = group\n self.group << rule\n end", "def possible_regexes(w)\n possible = []\n w_as_regex = escape_regex(w)\n\n # Here we specify many different functions that generate regex criterias,\n #\n # For example, /\\$10/ and /\\$[0-9]+/ for $10\n possible << w_as_regex\n possible << w_as_regex.gsub(/[0-9]/, \"[0-9]+\")\n\n possible.uniq.map { |p| Regexp.new(p, Regexp::IGNORECASE) }\n end", "def initialize(*patterns)\n @pending_add = []\n @pending = false\n @exclude_patterns = DEFAULT_IGNORE_PATTERNS.dup\n @exclude_re = nil\n patterns.each { |pattern| include(pattern) }\n yield self if block_given?\n end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 14 )\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__81\" )\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__82\" )\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__78\" )\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule altpair\" )\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule options_spec\" )\n begin\n # at line 185:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match( T__81, TOKENS_FOLLOWING_T__81_IN_block_1119 )\n if @state.backtracking == 0\n stream_T__81.add( lp )\n end\n # at line 186:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == OPTIONS || look_31_0 == T__78 )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 186:5: (opts= options_spec )? ':'\n # at line 186:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek( 1 )\n\n if ( look_30_0 == OPTIONS )\n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 186:6: opts= options_spec\n @state.following.push( TOKENS_FOLLOWING_options_spec_IN_block_1128 )\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add( opts.tree )\n end\n\n end\n char_literal76 = match( T__78, TOKENS_FOLLOWING_T__78_IN_block_1132 )\n if @state.backtracking == 0\n stream_T__78.add( char_literal76 )\n end\n\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1139 )\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair77.tree )\n end\n # at line 187:11: ( '|' altpair )*\n while true # decision 32\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == T__82 )\n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 187:13: '|' altpair\n char_literal78 = match( T__82, TOKENS_FOLLOWING_T__82_IN_block_1143 )\n if @state.backtracking == 0\n stream_T__82.add( char_literal78 )\n end\n @state.following.push( TOKENS_FOLLOWING_altpair_IN_block_1145 )\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add( altpair79.tree )\n end\n\n else\n break # out of loop for decision 32\n end\n end # loop for decision 32\n rp = match( T__83, TOKENS_FOLLOWING_T__83_IN_block_1160 )\n if @state.backtracking == 0\n stream_T__83.add( rp )\n end\n # AST Rewrite\n # elements: altpair, options_spec\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 189:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 189:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( BLOCK, lp, \"BLOCK\" ), root_1 )\n\n # at line 189:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child( root_1, stream_options_spec.next_tree )\n\n end\n\n stream_options_spec.reset();\n # at line 189:48: ( altpair )+\n stream_altpair.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_altpair.has_next?\n @adaptor.add_child( root_1, stream_altpair.next_tree )\n\n end\n stream_altpair.reset\n @adaptor.add_child( root_1, @adaptor.create( EOB, rp, \"EOB\" ) )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 14 )\n\n end\n \n return return_value\n end", "def match(tokens, definitions); end", "def exec(input, events=[])\n events << self\n\n index = events.size\n n = 0\n m = rules.length\n\n while n < m && input.exec(rules[n], events).size == index\n n += 1\n end\n\n if index < events.size\n events << CLOSE\n events << events[-2]\n else\n events.pop\n end\n\n events\n end", "def run_matchers # :nodoc:\n matches = Matchers.run(phrase_without_matches)\n matches.each do |match|\n text, category = match\n if text\n @matches[category] << text\n end\n end\n end", "def exec(input, events=[])\n events << self\n\n index = events.size\n n = 0\n m = rules.length\n\n while n < m && input.exec(rules[n], events).size == index\n n += 1\n end\n\n if index < events.size\n events << CLOSE\n events << events[-2]\n else\n events.pop\n end\n\n events\n end", "def block\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 14)\n return_value = BlockReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n lp = nil\n rp = nil\n char_literal76 = nil\n char_literal78 = nil\n opts = nil\n altpair77 = nil\n altpair79 = nil\n\n tree_for_lp = nil\n tree_for_rp = nil\n tree_for_char_literal76 = nil\n tree_for_char_literal78 = nil\n stream_T__81 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__81\")\n stream_T__82 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__82\")\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_T__78 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__78\")\n stream_altpair = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule altpair\")\n stream_options_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule options_spec\")\n begin\n # at line 194:9: lp= '(' ( (opts= options_spec )? ':' )? altpair ( '|' altpair )* rp= ')'\n lp = match(T__81, TOKENS_FOLLOWING_T__81_IN_block_1124) \n if @state.backtracking == 0\n stream_T__81.add(lp)\n end\n # at line 195:3: ( (opts= options_spec )? ':' )?\n alt_31 = 2\n look_31_0 = @input.peek(1)\n\n if (look_31_0 == OPTIONS || look_31_0 == T__78) \n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 195:5: (opts= options_spec )? ':'\n # at line 195:5: (opts= options_spec )?\n alt_30 = 2\n look_30_0 = @input.peek(1)\n\n if (look_30_0 == OPTIONS) \n alt_30 = 1\n end\n case alt_30\n when 1\n # at line 195:6: opts= options_spec\n @state.following.push(TOKENS_FOLLOWING_options_spec_IN_block_1133)\n opts = options_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_options_spec.add(opts.tree)\n end\n\n end\n char_literal76 = match(T__78, TOKENS_FOLLOWING_T__78_IN_block_1137) \n if @state.backtracking == 0\n stream_T__78.add(char_literal76)\n end\n\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1144)\n altpair77 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair77.tree)\n end\n # at line 196:11: ( '|' altpair )*\n loop do #loop 32\n alt_32 = 2\n look_32_0 = @input.peek(1)\n\n if (look_32_0 == T__82) \n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 196:13: '|' altpair\n char_literal78 = match(T__82, TOKENS_FOLLOWING_T__82_IN_block_1148) \n if @state.backtracking == 0\n stream_T__82.add(char_literal78)\n end\n @state.following.push(TOKENS_FOLLOWING_altpair_IN_block_1150)\n altpair79 = altpair\n @state.following.pop\n if @state.backtracking == 0\n stream_altpair.add(altpair79.tree)\n end\n\n else\n break #loop 32\n end\n end\n rp = match(T__83, TOKENS_FOLLOWING_T__83_IN_block_1165) \n if @state.backtracking == 0\n stream_T__83.add(rp)\n end\n # AST Rewrite\n # elements: options_spec, altpair\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 198:9: -> ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n # at line 198:12: ^( BLOCK[$lp,\\\"BLOCK\\\"] ( options_spec )? ( altpair )+ EOB[$rp,\\\"EOB\\\"] )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(BLOCK, lp, \"BLOCK\"), root_1)\n\n # at line 198:34: ( options_spec )?\n if stream_options_spec.has_next?\n @adaptor.add_child(root_1, stream_options_spec.next_tree)\n\n end\n\n stream_options_spec.reset();\n # at line 198:48: ( altpair )+\n unless stream_altpair.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_altpair.has_next?\n @adaptor.add_child(root_1, stream_altpair.next_tree)\n\n end\n\n stream_altpair.reset\n @adaptor.add_child(root_1, @adaptor.create!(EOB, rp, \"EOB\"))\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 14)\n\n end\n \n return return_value\n end", "def any_of(*matcher_names, &action)\n matcher_names.each do |name|\n append_action(matchers[name], action)\n end\n self\n end", "def archetype_args\n tok = []\n @returns.map { |ent| tok << \"&#{ent.name}\" }\n @accepts.map { |ent| tok << ent.name }\n tok.join(', ')\n end", "def react(regexp, **args, &block)\n _hb_add_sub(:react, regexp, args, block)\n end", "def find_all_actions_matching(matcher)\n actions.find_all { |act| matcher === act.name }\n end", "def describe_parameter_extra_regexps(name)\n [\n \"#{name}::\",\n \"+#{name}+::\",\n \"<tt>#{name}</tt>::\"\n ].map do |pattern|\n r = pattern.is_a?(Regexp) ? pattern : Regexp.escape(pattern)\n /#{r}\\n\\ {2,}.+/m\n end\n end", "def parsed\n vals = \"-f #{capture_device} \"\n vals << parse_advanced(advanced_input)\n vals << \"-i #{input} \" unless advanced_input[:i] # Input provided by user\n vals << parse_advanced(advanced)\n vals << parse_advanced(advanced_output)\n vals << output\n end", "def exec(input, events=[])\n unless input.test(rule)\n events << self\n events << CLOSE\n events << 0\n end\n\n events\n end", "def define_operations\n # Starting point of potential difference (end of last match, or start\n # of string)\n @position_in_old = @position_in_new = 0\n @operations = []\n\n @matching_blocks.each do |match|\n create_operation_from(match)\n end\n end", "def matching_lines(regex); end", "def match(chat_text,params,admin=nil)\n actions.select{|a| admin || a.public?}.sort.each do |a|\n if args = action_match?(a,chat_text,params)\n logger.debug(\"COMMAND: #{names.inspect} #{a} matched with params #{args.inspect}\")\n return [a,args] # stop at first action match\n end\n end\n # no matching commands found\n return nil\n end", "def exec(input, events=[])\n events << self\n\n prev_size = events.size\n start = prev_size - 1\n\n # If the associated rule matches (adds events)\n # then close the label and set it's stream position\n # to be the position of the matched expression.\n if input.exec(rule, events).size > prev_size\n events << CLOSE\n events << events[-2]\n else\n # Remove the label rule since the associated expression\n # didn't match.\n events.slice!(start, events.size)\n end\n\n events\n end", "def listen arg_list, &fun\n @matcher << [arg_list, fun]\n end", "def convert_regexp_handling target\n return target.text if in_tt?\n\n handled = false\n\n @attributes.each_name_of target.type do |name|\n method_name = \"handle_regexp_#{name}\"\n\n if respond_to? method_name then\n target.text = public_send method_name, target\n handled = true\n end\n end\n\n unless handled then\n target_name = @attributes.as_string target.type\n\n raise RDoc::Error, \"Unhandled regexp handling #{target_name}: #{target}\"\n end\n\n target.text\n end", "def initialize(regex)\n raise ArgumentError.new(Rack::AARM::DSL::Helpers::ARGUMENTS_BAD) unless regex.is_a? Regexp\n @regex = regex\n @verbs = []\n end", "def rule(expression, &block); end", "def rule(expression, &block); end", "def regexp=(_arg0); end", "def exec(input, events=[])\n length = 0\n\n until input.test(rule)\n len = input.exec(DOT_RULE)[-1]\n break unless len\n length += len\n end\n\n if length > 0\n events << self\n events << CLOSE\n events << length\n end\n\n events\n end", "def subsequent_rules(*args); end", "def subsequent_rules(*args); end", "def options_re(pattern, &hndlr)\n @j_del.optionsWithRegEx(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\n end", "def lex_rule start_state, regexp, action = nil\n rules << Rule.new(start_state, regexp, action)\n end", "def extended_regexps!\n @hsh = self.class.er(@hsh)\n end", "def class_rules\n [\n Rule.new(:error, 4..6, \"Description Markdown\", \"Above your class you need documentation that covers the scope, and the usage of your plugin.\", proc do |json|\n json[:body_md] && json[:body_md].empty?\n end),\n Rule.new(:warning, 30, \"Tags\", \"This plugin does not include `@tags tag1, tag2` and thus will be harder to find in search.\", proc do |json|\n json[:tags] && json[:tags].empty?\n end),\n Rule.new(:warning, 29, \"References\", \"Ideally, you have a reference implementation of your plugin that you can show to people, add `@see org/repo` to have the site auto link it.\", proc do |json|\n json[:see] && json[:see].empty?\n end),\n Rule.new(:error, 8..27, \"Examples\", \"You should include some examples of common use-cases for your plugin.\", proc do |json|\n json[:example_code] && json[:example_code].empty?\n end)\n ]\n end", "def create_filter(regexs, field = nil)\n return nil if regexs.nil? || regexs.empty?\n\n # /<regex>/i match pattern ignore case\n proc { |e| regexs.index do |regex|\n return /#{regex}/i =~ e if field\n return /#{regex}/i =~ e[field] if field\n end }\n end", "def actions\n act = []\n act << 'capture' if can_capture? payment\n act << 'void' if can_void? payment\n act\n end", "def add_expressions(*expressions); end", "def cmd_list pattern = '.'\n puts \"Following mnemo's #{pattern && \"matching regexp /#{pattern}/\"} are present\"\n puts\n references_by_pattern(pattern).each do |reference|\n puts (\" \" * 4) + reference\n end\n\n puts\n puts \"Done ..\"\n end", "def regexp; end", "def regexp; end" ]
[ "0.5920286", "0.59070987", "0.5900984", "0.5639694", "0.5551771", "0.55253947", "0.55253947", "0.5500414", "0.5488807", "0.5464021", "0.5416229", "0.5403914", "0.53894776", "0.5377114", "0.5373245", "0.5370417", "0.5365531", "0.5341026", "0.5288651", "0.52825713", "0.52825713", "0.52825713", "0.5269627", "0.5256444", "0.5236358", "0.5233305", "0.5229388", "0.5209718", "0.5200362", "0.5187143", "0.5120597", "0.51099837", "0.5109652", "0.5095988", "0.50706875", "0.50340736", "0.50340736", "0.50340736", "0.5033987", "0.50184053", "0.50154394", "0.49992347", "0.49864706", "0.4980733", "0.49805903", "0.4977304", "0.4963864", "0.4940765", "0.49400657", "0.4939126", "0.49286687", "0.49279842", "0.49248636", "0.49243474", "0.49054807", "0.49000677", "0.48735", "0.48580378", "0.48571157", "0.48483697", "0.4844101", "0.48375812", "0.4834242", "0.482949", "0.48286346", "0.48177096", "0.48175335", "0.48162243", "0.48122466", "0.4809408", "0.48092535", "0.48003855", "0.47917843", "0.4789412", "0.47844538", "0.47836813", "0.47813556", "0.478128", "0.4773541", "0.47713304", "0.47685277", "0.47670296", "0.47664395", "0.476611", "0.47653872", "0.4758276", "0.4758276", "0.4757501", "0.47550046", "0.47477123", "0.47477123", "0.47411904", "0.4736345", "0.47348958", "0.47339368", "0.4727925", "0.4726424", "0.47171322", "0.47081175", "0.47075054", "0.47075054" ]
0.0
-1
Creates a new instance of this plugin to reply to a particular object over that object's connection
def initialize(reply_to, private_sender = nil) self.reply_to = reply_to self.connection = reply_to.connection self.private_sender = private_sender end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reply\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message.to(to)\n message\n end", "def reply\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message.to(sender)\n message\n end", "def reply(opts = {})\n self.dup.reply! opts\n end", "def reply\n message = self.message.class.new(:subject => \"Re: #{subject}\",\n :body => body.gsub(/^/, '> '))\n message.sender = receiver\n message.to(sender)\n message\n end", "def object_from_client(object, connection)\n\t\t# They clicked cancel/send buttons instead of speaking\n\t\tif @state == :CONFIRM_STATE && object['class'] == \"StartRequest\" && object['properties']['proxyOnly']\n\t\t\tconnection.otherConnection.inject_object_to_output_stream self.speech_recognized object, connection, object['properties']['utterance']\n\t\tend\n\t\tobject\n\tend", "def receive_object message\n message.exec self \n end", "def new(*args)\n my = self.init\n my.connect(*args)\n end", "def object_from_client(object, connection)\n\t\t\n\t\t\n\t\tobject\n\tend", "def object_from_guzzoni(object, connection) \n\t\tobject\n\tend", "def reply\n end", "def create_sender(context, opts = {})\n if context.is_a?(::String)\n context = Qpid::Proton::URL.new(context)\n end\n\n target = opts[:target]\n if context.is_a?(Qpid::Proton::URL) && target.nil?\n target = context.path\n end\n\n session = self._session(context)\n\n sender = session.sender(opts[:name] ||\n id(session.connection.container,\n target, opts[:source]))\n sender.source.address = opts[:source] if !opts[:source].nil?\n sender.target.address = target if target\n sender.handler = opts[:handler] if !opts[:handler].nil?\n sender.tag_generator = opts[:tag_generator] if !opts[:tag_gnenerator].nil?\n self._apply_link_options(opts[:options], sender)\n sender.open\n return sender\n end", "def create_reply\n msg = self.dup\n msg.performative = \"agree\"\n msg.receiver = msg.sender\n msg.sender = aid\n msg.in_reply_to = msg.reply_with\n msg\n end", "def create_sender(context, opts = {})\n if context.is_a?(::String)\n context = Qpid::Proton::URL.new(context)\n end\n\n target = opts[:target]\n if context.is_a?(Qpid::Proton::URL) && target.nil?\n target = context.path\n end\n\n session = _session(context)\n\n sender = session.sender(opts[:name] ||\n id(session.connection.container,\n target, opts[:source]))\n sender.source.address = opts[:source] if !opts[:source].nil?\n sender.target.address = target if target\n sender.handler = opts[:handler] if !opts[:handler].nil?\n sender.tag_generator = opts[:tag_generator] if !opts[:tag_gnenerator].nil?\n _apply_link_options(opts[:options], sender)\n sender.open\n return sender\n end", "def new_reply(req)\n SsaReply.new(req, self)\n end", "def create(connection)\n response = Hpricot.XML(connection.process(Document::Add.new(self).xml))\n raise Exception, response.at('error').innerHTML if response.at('error')\n self.handle = response.at('AddedObjectHandle').innerHTML\n self\n end", "def reply(env, message)\n self.send(env[:sender], [env[:conn_id]], message)\n end", "def publish(object)\n @channel << object\n end", "def new\n # build a 'temporary' post which is written to DB later (create-method)\n @switchgearconnection = Switchgearconnection.new\n end", "def forward\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message\n end", "def set_reply\n @reply = Replie.find(params[:id])\n end", "def reply\n @reply\n end", "def initialize\n @setup = false\n @reply_to = UUID.generate\n @pending = Hash.new\n end", "def show\n @reply = Reply.new\n end", "def reply( r )\n @main << r\n end", "def create(args = nil)\n # Connects to the xmpp-client that is used for sending xmpp-messages\n @send_client = connect(@@send_client_info)\n \n # Connect to xmpp-client that is used for receiving messages that are then turn into http-requests\n @receive_client = connect(@@receive_client_info)\n runMessageReceiver\n \n # Ensures that xmpp-server has node: home/host/<host>/<node_account>/contexts\n XmppHelper::createContextGeneralNode\n\n end", "def create_requestor(request_address, reply_address=nil, reply_queue=nil)\n HornetQ::Client::RequestorPattern.new(self, request_address, reply_address, reply_queue)\n end", "def reply_to\n @reply_to\n end", "def commandChat _obj, _args\n \"_obj commandChat _args;\" \n end", "def create_receiver(context, opts = {})\n if context.is_a?(::String)\n context = Qpid::Proton::URL.new(context)\n end\n\n source = opts[:source]\n if context.is_a?(Qpid::Proton::URL) && source.nil?\n source = context.path\n end\n\n session = self._session(context)\n\n receiver = session.receiver(opts[:name] ||\n id(session.connection.container,\n source, opts[:target]))\n receiver.source.address = source if source\n receiver.source.dynamic = true if opts.has_key?(:dynamic) && opts[:dynamic]\n receiver.target.address = opts[:target] if !opts[:target].nil?\n receiver.handler = opts[:handler] if !opts[:handler].nil?\n self._apply_link_options(opts[:options], receiver)\n receiver.open\n return receiver\n end", "def new_object\n @object = scope.new params[object_name.to_sym]\n set_instance\n end", "def new *args\n instance = __actor_new *args\n instance.instance_variable_set :@audience, {}\n instance.instance_variable_set :@mailbox, Queue.new\n \n audience = {}\n audience[:before] = {}\n audience[:after] = {}\n instance.instance_variable_set :@audience, audience\n\n Thread.new do\n loop do\n mailbox = instance.instance_variable_get :@mailbox\n method_name, args, block = mailbox.pop\n \n if audience[:before][method_name]\n audience[:before][method_name].each { |callback| callback.call }\n end\n\n result = instance.method(method_name).call *args, &block\n \n if audience[:after][method_name]\n audience[:after][method_name].each { |callback| callback.yield result }\n end\n end\n end\n\n Proxy.new instance\n end", "def create_receiver(context, opts = {})\n if context.is_a?(::String)\n context = Qpid::Proton::URL.new(context)\n end\n\n source = opts[:source]\n if context.is_a?(Qpid::Proton::URL) && source.nil?\n source = context.path\n end\n\n session = _session(context)\n\n receiver = session.receiver(opts[:name] ||\n id(session.connection.container,\n source, opts[:target]))\n receiver.source.address = source if source\n receiver.source.dynamic = true if opts.has_key?(:dynamic) && opts[:dynamic]\n receiver.target.address = opts[:target] if !opts[:target].nil?\n receiver.handler = opts[:handler] if !opts[:handler].nil?\n _apply_link_options(opts[:options], receiver)\n receiver.open\n return receiver\n end", "def post_initialize(**opts)\n set_reply_queue(opts[:reply_queue_name]) if opts[:reply_queue_name].present?\n end", "def new_connection(relation_name, other_object, bidi)\n return Relation.create(relation_name, self.node, other_object.node, bidi)\n end", "def customChat _obj, _args\n \"_obj customChat _args;\" \n end", "def initialize(instance = 1)\n ::Log.debug 'initalize a propertie to message'\n @correlation = SecureRandom.uuid\n @instance = instance\n end", "def forward\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message\n end", "def start\r\n @object.send(*@message)\r\n end", "def execute(connection)\n \n # Register the command as a connection listener, so we can receive response messages\n # from the server.\n connection.add_connection_listener(self)\n \n # Send the message.\n connection << self\n \n # Create a conditinal monitor variable.\n self.synchronize do\n @response_received ||= self.new_cond\n end\n \n return self\n \n end", "def reply_to(m)\n @message_type = METHOD_RETURN\n @reply_serial = m.serial\n @destination = m.sender\n self\n end", "def get_instance(payload)\n InteractionChannelInstance.new(@version, payload, interaction_sid: @solution[:interaction_sid], )\n end", "def reply!\n self[:src], self[:dst] = self[:dst], self[:src]\n self\n end", "def reply!\n self[:src], self[:dst] = self[:dst], self[:src]\n self\n end", "def reply!\n self[:src], self[:dst] = self[:dst], self[:src]\n self\n end", "def create_connection\n self.setup\n RfmAdaptor::Connection.new(self.server_name)\n end", "def new_connection; end", "def receive_object obj\n # stub\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def <<(obj)\n if [:id, :message, :trailing].all? {|m| obj.respond_to?(m)}\n enqueue_message(obj)\n else\n raise ArgumentError, \"#<< method requires argument responding to :id, :message, :trailing\"\n end\n end", "def test_create_reply_to_reply_to_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:matt_reply_to__kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @matt, reply_to, about)\r\n end", "def create_arp_reply message\nend", "def build_reply\n new_pm = PrivateMessage.new\n new_pm.author = receiver\n new_pm.receiver = author\n new_pm.title = 'RE: ' + title\n new_pm.message = '> ' + message.gsub(\"\\n\", \"\\n> \") + \"\\n\"\n new_pm\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def set_reply\n @reply = Reply.find(params[:id])\n end", "def initialize(message, user)\n # INSTANCE of THING\n # self ?????\n @message = message\n @user = user\n @@all << self\n end", "def initialize(replies, connection_description = nil, connection_global_id = nil)\n if replies\n if replies.is_a?(Array)\n if replies.length != 1\n raise ArgumentError, \"Only one (or zero) reply is supported, given #{replies.length}\"\n end\n reply = replies.first\n else\n reply = replies\n end\n unless reply.is_a?(Protocol::Message)\n raise ArgumentError, \"Argument must be a Message instance, but is a #{reply.class}: #{reply.inspect}\"\n end\n @replies = [ reply ]\n @connection_description = connection_description\n @connection_global_id = connection_global_id\n end\n end", "def method_missing(method, *args, &block)\n\t\tconnection.send(method, *args, &block)\n\tend", "def reply(message)\n return @mouth.reply(message)\n end", "def method_missing(method, *args)\n @connection.send(method, *args)\n end", "def set_reply(reply)\n @reply = reply\n end", "def reply(*args, &block)\n self.rooms.each do |room|\n room.reply(*args, &block)\n end\n end", "def vehicleChat _obj, _args\n \"_obj vehicleChat _args;\" \n end", "def initialize( options = {} )\n ensure_reactor!\n\n @options = {\n :reply_by_default => false\n }.merge( options )\n end", "def new(klass, *args)\n unless klass.is_a?(BasicObject)\n PEROBS.log.fatal \"#{klass} is not a BasicObject derivative\"\n end\n\n @lock.synchronize do\n obj = _construct_po(klass, _new_id, *args)\n # Mark the new object as modified so it gets pushed into the database.\n @cache.cache_write(obj)\n # Return a POXReference proxy for the newly created object.\n obj.myself\n end\n end", "def show\n @reply = Message.new\n @reply.message_id = @message.id\n @reply.subject = \"Reply to > #{@message.subject}\"\n end", "def reply\n results = QuestionDatabase.instance.execute(<<-SQL, self.reply_id)\n SELECT * FROM replies WHERE id = ?\n SQL\n \n results.map { |result| Reply.new(result) }\n end", "def create_new_connection(options, &block)\n if @connection\n logger.debug(\"[WinRM] shutting previous connection #{@connection}\")\n @connection.close\n end\n\n @connection_options = options\n @connection = Kitchen::Transport::Winrm::Connection.new(options, &block)\n end", "def receive_replies(connection); end", "def forwarding_to_object message, opts\n target = opts[ :to_object ]\n forwarding_with message, opts.merge( to: Meta::ObjectContainer.new(target), with: opts.fetch( :with, [] ) )\n end", "def test_create_reply_to_up_in_chain_reply_to_standalone_message_about_nothing\r\n about = nil\r\n reply_to = messages(:kevin_reply_to__andy_to_kevin_about_nothing)\r\n send_message(@tim, @kevin, reply_to, about)\r\n end", "def get_new_obj(obj, type='query')\n tmp_obj = self.new\n tmp_obj.send 'object'.to_sym, \"{#{obj['object'].to_s}}\"\n tmp_obj.send 'source_id'.to_sym, get_source_id\n tmp_obj.send 'update_type'.to_sym, type\n tmp_obj\n end", "def new_from_response_data(response_data)\n object = StorageRoom.class_for_name(response_data['@type']).new.set_from_response_data(response_data)\n\n if object.is_a?(Entry) && !object.loaded? && !object.proxy?\n StorageRoom.log(\"Return #{response_data['url']} proxied\")\n Proxy.new(object)\n else\n object\n end\n end", "def reply # acts as endpoint\n \tmessage_body = params[\"Body\"] # grab params from Twilio's request\n \tfrom_number = params[\"From\"]\n \tboot_twilio\n \tsms = @client.messages.create( # send to inbound number made by end user\n from: Rails.application.secrets.twilio_from_number,\n to: from_number,\n body: \"Hello there, thanks for texting me. Your number is #{from_number}.\"\n \t)\n end", "def set_reply\n @reply = Reply.find(params[:id] || params[:reply_id])\n end", "def reply_to(data=nil)\n set_get __method__, data\n end", "def method_missing(method, *args, &block)\n connection_name = $1.pluralize.to_sym if method.to_s =~ /(.+?)(_ids)?(=)?$/\n if connection = connection_definition(connection_name || method)\n puts \"#{self.class.name} is building connection for #{connection[:klass].name}##{connection_name || method} in method_missing \" if Connectable.debug\n connection[:klass].instance_eval do\n connects_to connection[:destination], connection[:options].merge(now: true)\n end\n send method, *args\n else\n super\n end\n end", "def initialize(responses, queue)\n @id = \"Bot-\" + SecureRandom.uuid\n @responses = responses\n @queue = queue\n @agent = Mechanize.new\n @state = {}\n @thread = Thread.new {run}\n end", "def store_instance(object, attachment_method = nil)\n # ensure the impl has a reference to the wrapper object\n object.impl.instance_eval { @proton_wrapper = object }\n registry_key = get_key(object.impl)\n unless attachment_method.nil?\n record = Cproton.__send__(attachment_method, object.impl)\n rbkey = Cproton.Pn_rbkey_new\n Cproton.Pn_rbkey_set_registry(rbkey, Cproton.pn_rb2void(Qpid::Proton::Util::Wrapper.registry))\n Cproton.Pn_rbkey_set_method(rbkey, \"delete\")\n Cproton.Pn_rbkey_set_key_value(rbkey, registry_key)\n Cproton.pn_record_def(record, RBCTX, Cproton.Pn_rbkey__class());\n Cproton.pn_record_set(record, RBCTX, rbkey)\n end\n Qpid::Proton::Util::Wrapper.registry[registry_key] = object\n end", "def connect(args, &block)\n raise \"No object given.\" if !args[\"object\"]\n raise \"No signals given.\" if !args.key?(\"signal\") and !args.key?(\"signals\")\n args[\"block\"] = block if block_given?\n object = args[\"object\"].to_sym\n\n @callbacks[object] = {} if !@callbacks[object]\n conn_id = @callbacks[object].length.to_s\n @callbacks[object][conn_id] = args\n return conn_id\n end", "def get_instance(payload)\n ChannelInstance.new(@version, payload)\n end", "def get_instance(payload)\n ChannelInstance.new(@version, payload)\n end", "def respond_with_protocol(verb, params=[], desc=\"\")\n fail NebulousError, \"Don't know which queue to reply to\" unless reply_to\n \n hash = {verb: verb, params: params, desc: desc}\n [ reply_to, Message.in_reply_to(self, hash) ]\n end", "def new\n BikeObject.new(self, 'Object', @type, @name)\n end", "def _construct_po(klass, id, *args)\n klass.new(Handle.new(self, id), *args)\n end", "def get_instance(payload)\n InteractionChannelParticipantInstance.new(@version, payload, interaction_sid: @solution[:interaction_sid], channel_sid: @solution[:channel_sid])\n end", "def respond(body)\n fail NebulousError, \"Don't know which queue to reply to\" unless reply_to\n\n # Easy to do by mistake, pain in the arse to work out what's going on if you do\n fail ArgumentError, \"Respond takes a body, not a message\" if body.is_a? Message \n\n mess = Message.in_reply_to(self, body: body)\n [ reply_to, mess ]\n end", "def reply\n message_body = params[\"Body\"]\n from_number = params[\"From\"]\n @recent_msg = Message.where(number: from_number).last # Get the name of this user if possible\n\n # Some random schmoe not in our db is trying to text me.\n if @recent_msg.blank?\n head 200, \"content_type\" => 'text/html'\n return\n end\n\n user = @recent_msg.user\n\n # Store reply in db and send back a simple text.\n @message = Message.new(user: user, number: from_number, text: message_body, action: 'REPLY')\n if @message.save\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_number,\n to: from_number,\n body: \"Hello from the other side! Your number is #{from_number}.\"\n )\n end\n head 200, \"content_type\" => 'text/html'\n end", "def reply(of_msg, content, cookies = nil)\n begin\n PUNK.start('reply','replying msg ...')\n response = of_msg.clone\n response.parent_id = of_msg.id\n response.id = CC.indigen_next_id(response.asset)\n response.content = content\n response.meta['protogen_cookies'] = cookies\n response.sender = '@@server@@'\n response.recipient = of_msg.asset\n user_api.mdi.tools.protogen.protogen_encode(response).each {|message| message.push}\n # success !\n PUNK.end('reply','ok','out',\"SERVER -> MSG[#{crop_ref(response.id,4)}] [reply of #{crop_ref(of_msg.id,4)}]\")\n # stats:\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['reply_sent_to_device'] += 1\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['total_sent'] += 1\n return response\n rescue Exception => e\n user_api.mdi.tools.log.error(\"Error on reply\")\n user_api.mdi.tools.print_ruby_exception(e)\n PUNK.end('reply','ko','out',\"SERVER -> MSG (reply)\")\n # stats:\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['err_on_reply'] += 1\n SDK_STATS.stats['agents'][user_api.user_class.agent_name]['total_error'] += 1\n return false\n end\n end", "def init_message(message)\n command = command_factory.instance.build(message)\n command.respond(self)\n end" ]
[ "0.6619756", "0.6294441", "0.61245936", "0.59539574", "0.58021915", "0.57856745", "0.5731792", "0.5727099", "0.56824994", "0.56238294", "0.562338", "0.5615103", "0.5558081", "0.5557623", "0.55218357", "0.54805046", "0.5468875", "0.5423861", "0.5400584", "0.53714174", "0.53667337", "0.53522235", "0.5332475", "0.53138506", "0.52989405", "0.5281113", "0.5277872", "0.52751285", "0.52739084", "0.5267011", "0.5240794", "0.52388173", "0.5237555", "0.5230825", "0.5230773", "0.52132624", "0.51910865", "0.5188949", "0.51874393", "0.5181159", "0.51653385", "0.51577556", "0.51577556", "0.51577556", "0.5156088", "0.5142104", "0.51409763", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51408535", "0.51378024", "0.5127709", "0.5120329", "0.5116884", "0.5115362", "0.5115362", "0.51133466", "0.51086366", "0.51037663", "0.5099951", "0.5094445", "0.5088591", "0.508189", "0.5076404", "0.50760233", "0.50658226", "0.5060778", "0.50563", "0.50556797", "0.5049502", "0.5046284", "0.50460494", "0.5042229", "0.50385827", "0.5030487", "0.5025836", "0.50234795", "0.50197214", "0.50101703", "0.50085413", "0.500552", "0.5004976", "0.5004976", "0.49956045", "0.49919134", "0.49887243", "0.49874586", "0.49833518", "0.4982991", "0.49788597", "0.49766624" ]
0.61363816
2
Send +message+ back to the HipChat server. If +to+ == +:room+, replies to the room. If +to+ == nil, responds in the manner the original message was sent. Otherwise, PMs the message to +to+.
def reply(message, to = nil) if to == :room reply_to.reply(message, nil) else reply_to.reply(message, to || private_sender) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reply_message(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n call_api(:method => :post, :uri => @api_base.merge(\"room/#{room_id}/reply\"), :body_params => params)\n end", "def broadcast_to(room, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: room, text: msg })\n\t\t\tm.save!\n\t\t\troom.broadcast(m)\n\t\tend", "def send_room_msg\n r = params[:r]\n m = params[:m]\n u = params[:u]\n MsgUtil.send_room_msg(u, r, m)\n success()\n end", "def remote_chat(sender, room, msg)\n add_msg \"<#{room || 'unknown'}> #{sender}: #{msg}\"\n end", "def reply_to_message\r\n @message = Message.find_by_id(params[:id])\r\n \r\n if !@message.nil? && can_view(@message) \r\n @message.recipient = @message.sender_name\r\n @message.subject = \"Re: \" + @message.subject \r\n @message.body = \"\\n\\n___________________________\\n\" + @message.sender_name + \" wrote:\\n\\n\" + @message.body\r\n render :action => \"send_message\" \r\n else\r\n flash[:notice] = \"Please keep your eyes on your own messages.\"\r\n redirect_to :action => \"inbox\"\r\n end \r\n end", "def message(to, message)\n send_raw_line(\"PRIVMSG \"+to.to_s+\" :\"+message.chomp)\n end", "def send_reply(from, to, title, message)\n RestClient.post API_URL+\"/messages\",\n :from => from.email,\n :to => to.email,\n :subject => \"Follow Up: UROP Application for \"+title,\n :text => message\n end", "def reply\n message = self.message.class.new(:subject => \"Re: #{subject}\",\n :body => body.gsub(/^/, '> '))\n message.sender = receiver\n message.to(sender)\n message\n end", "def reply(params = {})\n fail InitWithoutBot unless @bot\n\n params[:chat] = self[:chat]['id']\n\n params[:as_plain_message] = true unless params.key? :as_plain_message\n params[:reply_to] = self[:id] unless params[:as_plain_message]\n param.delete :as_plain_message\n\n @bot.send_text params\n end", "def action(msg, recipient)\n recipient ||= @msg.reply_to if @msg\n @bot.action(recipient, msg)\n end", "def reply\n message = self.class.new(:subject => subject, :body => body)\n message.sender = sender\n message.to(to)\n message\n end", "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end", "def reply\n message = self.message.class.new(:subject => subject, :body => body)\n message.sender = receiver\n message.to(sender)\n message\n end", "def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end", "def reply(options)\n say(\n body: options[:body],\n from: options[:to].to,\n to: options[:to].from,\n type: options[:to].type,\n )\n end", "def answer_message(from, to, subject, message, conv_id, mess_id)\r\n conv = self.conversations.fetch(conv_id.to_s)\r\n time = Time.new\r\n message = Message.create(from, to, subject, time, message, mess_id)\r\n conv.add_message(message)\r\n end", "def set_room_message\n @room_message = RoomMessage.find_by(id: params[:id])\n end", "def say(msg, recipient = nil)\n recipient ||= @msg.reply_to if @msg\n @bot.msg(recipient, msg)\n end", "def send(to, text)\n begin\n @log.info \"Sending message to '#{to}'\"\n @client.send Message::new(to, text).set_type(:chat).set_id('1').set_subject('Boti')\n return true\n rescue\n @log.error \"Error sending message to '#{to}'\"\n return false\n end\n end", "def handle(time, send, message)\n match(message, \"(join|switch to) (.*)\") do |md|\n new_room_name = md[2]\n \n old_room_name = Robut::Connection.config.room\n \n # nasty gsub of the room name in the room name string\n full_new_room_name = old_room_name.gsub(/[\\d]+_(.*)\\@.*/) { |str| str.gsub($1, new_room_name) }\n \n Robut::Connection.config.room = full_new_room_name\n \n # Reconnect to the new channel.\n # There is a lighter-weight way to accomplish this,\n # but we don't have access to the muc accessor here.\n begin\n Robut::Connection.new.connect\n rescue => e\n $stderr.puts e\n # reply(\"I can't join that room, bro.\")\n \n # reconnect to the original room if we can't connect to the new one\n Robut::Connection.config.room = old_room_name\n Robut::Connection.new.connect\n end\n end\n end", "def as_xmpp_message(to, persp=:default, body=nil, type=:chat)\n klass = self.class.to_xmpp_message_node(persp)\n obj = klass.new(to, body, type)\n obj.represents(self, persp)\n obj\n end", "def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end", "def send_message message\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{id}/chatMessages\", payload\n\n Message.new client, id, data\n end", "def send_message_to_room(company, room_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/messages/v3/' + company + '/rooms/' + room_id + '/stories', params\n end", "def send_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, text: msg })\n\t\t\tm.save!\n\t\t\tother_player.send_message(m)\n\t\tend", "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend", "def send_message_to(chatid, contact, message, transport=nil)\n return self.class.can_has_chat_server.send_message( :id => chatid,\n :to=>contact,\n :message=>message,\n :transport =>transport)\n end", "def reply(message)\n return @mouth.reply(message)\n end", "def relay_message(to, data)\n encrypted_message = data['message']\n\n ActionCable.server.broadcast(\n broadcasting_name(to),\n message: encrypted_message,\n uid: to)\n end", "def send(body=nil)\n msg = Jabber::Message.new(@to)\n msg.type = :chat\n msg.body = body || @message\n @base.stanza(msg)\n end", "def reply_to\n sent_to_channel? ? dest : nick\n end", "def send_message\n if message.present?\n sender.send_message(receiver, message, I18n.t(\"activity.verb.#{ contact_verb }.#{ receiver.subject_type }.message\", :name => sender.name))\n end\n end", "def reply\n message_body = params[\"Body\"]\n from_number = params[\"From\"]\n @recent_msg = Message.where(number: from_number).last # Get the name of this user if possible\n\n # Some random schmoe not in our db is trying to text me.\n if @recent_msg.blank?\n head 200, \"content_type\" => 'text/html'\n return\n end\n\n user = @recent_msg.user\n\n # Store reply in db and send back a simple text.\n @message = Message.new(user: user, number: from_number, text: message_body, action: 'REPLY')\n if @message.save\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_number,\n to: from_number,\n body: \"Hello from the other side! Your number is #{from_number}.\"\n )\n end\n head 200, \"content_type\" => 'text/html'\n end", "def say(to, msg, using = :chat)\n client.write Blather::Stanza::Message.new(to, msg, using)\n end", "def room_speak(room, message_body, options = {})\n actb_room_messages.create!({room: room, body: message_body}.merge(options))\n end", "def set_message\n @message = RoomMessage.find(param[:id])\n end", "def reply(req, msg)\n self.send_resp(req.sender, req.conn_id, msg)\n end", "def send_message(chat_id, message)\n ActionCable.server.broadcast \"Chat:#{chat_id}\", response: chat_message(message), type: 'message'\n end", "def send_message(other_user, room_id, content)\n from_messages.create!(to_id: other_user.id, room_id: room_id, content: content)\n end", "def reply_to(m)\n @message_type = METHOD_RETURN\n @reply_serial = m.serial\n @destination = m.sender\n self\n end", "def send_message(*args, **kwargs)\n bot = kwargs.fetch(:bot) { args.fetch(0) }\n args[0] = id\n kwargs[:chat_id] = id\n bot.send_message(*args, **kwargs)\n end", "def send_conversation_message(from, to, params = {})\n ConversationMessage.new(conversation_request(\n :post,\n 'send',\n params.merge(from: from,\n to: to)\n ))\n end", "def reply(*args, &block)\n self.rooms.each do |room|\n room.reply(*args, &block)\n end\n end", "def chat_message\n @room=current_user.room\n\n @chat_message=ChatMessage.create! content: params[:message],owner_id: current_user.id\n chat_message=render_to_string partial: \"chat_message/chat_message\"\n\n publish_async(\"presence-room_#{@room.id}\", \"chat_message\", {\n message: chat_message\n })\n\n render json: {\n message: chat_message\n }\n end", "def send_message(to:, body:)\n twilio_client.api.account.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: \"+1#{to}\",\n body: body\n )\n end", "def send_message(to, message)\n if !@client.is_connected?\n @log.warn \"Bot is not connected. Can't send the message.\"\n return false\n end\n\n case message\n when Array\n message.each do |text|\n sleep 1\n return unless send(to, text)\n end\n when String\n return send(to, message)\n else\n @log.error \"Message is not an Array nor a String. Can't send.\"\n return false\n end\n end", "def sendChatAction to, act\n self.query(\"sendChatAction\", {:chat_id=>to, :action=>act})\n end", "def set_meeting_room_message\n @meeting_room_message = MeetingRoomMessage.find(params[:id])\n end", "def event_outgoing_broadcast(msg)\n if @var[:room] == 'chat' and\n @var[:presence][@connection.comm.our_keyhash].first == 'away'\n local_back('')\n end\n\n # Private message?\n if @var[:room][0,1] == '@'\n peer = @var[:room].sub('@', '')\n local_msg(\"#{peer} #{msg}\")\n msg.replace('')\n end\nend", "def perform(message)\n \tActionCable.server.broadcast \"chatrooms:#{message.chatroom.id}\", {\n \t\tmessage: MessagesController.render(message),\n \t\tchatroom_id: message.chatroom.id\n \t}\n # Do something later\n end", "def send_message(message)\n self.broadcast({\n type: \"chat_message\",\n message: message\n })\n end", "def chat(data)\n # uid of the intended recipient\n # only the intended recipient will be able to decrypt\n to = data['to'].to_s\n\n if ConnectedList.include?(to)\n relay_message(to, data)\n else\n intended_recipient_not_found(to)\n end\n end", "def sending_message(to, msg)\n\t begin\n\t\t @client = Twilio::REST::Client.new @account_sid, @auth_token\n\t\t data = {\n\t\t\t\t:from => \"+\" + Rails.application.secrets.from_number.to_s, \n\t\t\t\t:to => to,\n\t\t\t\t:body => msg, \n\t\t\t}\n\t\t\tputs data.inspect\n\t\t\t@client.account.messages.create(data)\n\t\trescue\n raise \"Message not send\"\n\t\tend\n end", "def reply!(opts = {})\n opts = {:remove_children => false}.merge opts\n self.to, self.from = self.from, self.to\n self.children.remove if opts[:remove_children]\n self\n end", "def message(to, text, opts = {})\n Entity::Message.new(self, to, text, opts).deliver\n end", "def send_telegram message = nil\n chat_id = self.telegram\n if chat_id and !!@@telegram_client\n if message\n begin\n puts \"Enviando: #{message}\n to: #{chat_id}\"\n @@telegram_client.send_message(chat_id: chat_id, text: message)\n true\n rescue\n puts \"Error sending message to telegram group #{group_id}\"\n false\n end\n end\n end\n end", "def send_message_to(_user, _message, extra_data = {})\n return if _user.id == id # skip send message to self\n Conversation.get_single_conversation(id, _user.id).send_message(id, _message, extra_data)\n end", "def reply_to\n (@reply_to || self.from)\n end", "def send_message\n chat = Chat.find(params[:chat])\n SendMessageToChat.call(@previa_group, chat, params[:message])\n\n respond_to do |format|\n format.html { redirect_to previa_group_chat_path(@previa_group, :chat => chat) }\n format.json { head :no_content }\n end\n end", "def receive(data)\n puts \"messages:#{params[:room]} received #{data} from #{current_user}\"\n # we can relay the received message without the model if we want.\n # ActionCable.server.broadcast(\"messages\", data)\n end", "def respond(body)\n fail NebulousError, \"Don't know which queue to reply to\" unless reply_to\n\n # Easy to do by mistake, pain in the arse to work out what's going on if you do\n fail ArgumentError, \"Respond takes a body, not a message\" if body.is_a? Message \n\n mess = Message.in_reply_to(self, body: body)\n [ reply_to, mess ]\n end", "def send_message(msg, from = nil)\n msg = \"#{msg} (@#{from})\" unless from.nil?\n @auth_required ? @after_auth.push({:m => msg}) : send_data({:m => msg})\n end", "def write_message\n\t\t# sender will be the current user\n\t\t@user = current_user\n\t\t@message = Message.new\n\t\t@message.sender = current_user\n\t\t@unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n\t\t# if reciever has been specified, automatically use his/her name in the \"To:\" box\n\t\tif params[:receiver]\n\t\t\t@message.receiver = User.find_by_login(params[:receiver])\n\t\tend\n end", "def send(message, options = { channelID: 1 })\n params = { message: message, channelID: options[:channelID] }\n rest.post chat_path, params: params\n end", "def send_message(from, recipients)\n self.sent = true\n self.read = true\n \n if recipients == :all\n self.peer = \"All\"\n else\n if recipients.class.to_s != \"Array\"\n recipients = [recipients]\n end\n self.peer = recipients.join(\", \")\n end \n \n if from == :system\n self.user_id = 0\n else\n sender = User.find_by_username(from)\n if sender\n self.user_id = sender.id\n else\n return\n end \n end\n if self.save\n async_send_message(self.id, recipients)\n end\n end", "def direct_message_to(optname, optarg)\n ret = nil\n text = nil\n user = self.user_name_or_id(optarg)\n if user.nil? then\n $stderr.puts \"user must be a user-id/@screen_name\"\n return 1\n end\n\n if ARGV.size > 0 then\n text = ARGV[0]\n else\n $stderr.puts \"Error: Message is required.\"\n return 1\n end\n\n long_line = 76\n short_line = 68\n begin\n self.renderer.puts(self.line_str(long_line))\n self.renderer.puts(\"To : #{user}\")\n self.renderer.puts(\"Msg: #{text}\")\n\n if !@options.assume_yes? then\n if !self.prompt(\"Send the direct message? (Y/N): \")\n return EXIT_BY_NO\n end\n end\n\n self.client.new_auth(@account)\n self.client.create_direct_message(\n user, text, self.followers_cache_option())\n ret = 0\n rescue => e\n $stderr.puts experr(__FILE__, __LINE__, e, \"sending direct message\")\n $stderr.puts Tw::BACKTRACE_MSG\n raise if ENV[\"TWBT\"]\n ret = 1\n end\n return ret\n end", "def set_chat_room\n @chat_room = current_user.chat_rooms.find(params[:id])\n \n end", "def talk(dest, msg, server = nil)\n privmsg_channel(server, dest: dest, msg: msg)\n end", "def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end", "def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end", "def respond_with_protocol(verb, params=[], desc=\"\")\n fail NebulousError, \"Don't know which queue to reply to\" unless reply_to\n \n hash = {verb: verb, params: params, desc: desc}\n [ reply_to, Message.in_reply_to(self, hash) ]\n end", "def update\n @message = Message.new(:body => params[:message])\n if Messenger.add_reply(current_user, params[:id], @message)\n return_message(200, :ok)\n else\n return_message(200, :ok, {:err => {:messages => [106]}})\n end\n end", "def send_new_chat(data)\n stream_from \"Chat:#{data['chat']['id']}\"\n recipient = User.find(data['chat']['recipient_id'])\n unless current_user.id == recipient.id\n ActionCable.server.broadcast \"user_#{recipient.id}_chats\", chat: data['chat'], type: 'new_chat'\n end\n end", "def send_reply(text)\n @bot.api.send_message(chat_id: @last_message.chat.id, text: text)\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def reply_to(value = nil)\n if value.nil?\n @reply_to\n else\n @reply_to = value\n end\n end", "def update text\n payload = { \"text\" => message }.to_json\n data = client.post \"#{api_prefix}/rooms/#{room_id}/chatMessages/#{id}\", payload\n\n new client, room_id, data\n end", "def send_message(_target, text) # rubocop:disable Metrics/AbcSize\n url = \"https://api.gitter.im/v1/rooms/#{config.room_id}/chatMessages\"\n uri = URI.parse(url)\n\n Net::HTTP.start(\n uri.host,\n uri.port,\n use_ssl: true,\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n ) do |http|\n request = Net::HTTP::Post.new(uri.path)\n request.add_field('Content-Type', 'application/json')\n request.add_field('Accept', 'application/json')\n request.add_field('Authorization', \"Bearer #{config.token}\")\n request.body = { 'text' => text }.to_json\n response = http.request(request)\n\n @user_id = MultiJson.load(response.body)['fromUser']['id']\n end\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:chatroom_id])\n end", "def move_to_room(room_id)\n if Room.get_room_by_id(room_id)\n @current_room_id = room_id\n update\n end\n end", "def send_message( msg )\n @session.send_message msg\n self\n end", "def send_message\n unless message_sent\n twilio_client.messages.create(\n from: ENV.fetch(\"TWILIO_PHONE_NUMBER\"),\n to: contact.phone_number,\n body: content,\n )\n update(message_sent: true)\n end\n end", "def send_notification(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n call_api(:method => :post, :uri => @api_base.merge(\"room/#{room_id}/notification\"), :body_params => params)\n end", "def send_message(subject:, text:, from: nil)\n super(to: get_attribute(:name), subject: subject, text: text, from: from)\n end", "def send_message(subject:, text:, from: nil)\n super(to: get_attribute(:name), subject: subject, text: text, from: from)\n end", "def set_chatroom\n @chatroom = Chatroom.find_by( name: params[:id] )\n end", "def chat_meMessage(options = {})\n raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?\n raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?\n post('chat.meMessage', options)\n end", "def set_chatroom\n\t\t@chatroom = Chatroom.find(params[:id])\n\tend", "def reply_to_sender(phone_number, msg)\n msg = msg[0..MAX_MSG_PAYLOAD-1]\n org = get_system_org\n org.send_direct(org.system_user, phone_number, msg)\n end", "def dashboard_issue_zoom_room(from, to, opts = {})\n data, _status_code, _headers = dashboard_issue_zoom_room_with_http_info(from, to, opts)\n data\n end", "def say(msg)\n self.signed_request '/api/v1/chat.postMessage', 'POST', {roomId: @channel_id, text: '>' + msg}\n end", "def speak(data)\n sender = current_user\n message = data['message']\n\n # Save message in database as historical data\n msg = Message.new\n msg.user_id = current_user.id \n msg.recipient_id = data[\"target_user\"]\n msg.content = data['message']\n puts msg\n msg.save!\n\n # Sends back the data in realtime using websockets\n ActionCable.server.broadcast \"RoomChannel\", {message: message, sender: current_user, recipient: User.find(msg.recipient_id)}\n\n end", "def send_message(data)\n @chatroom = Chatroom.find(data[\"chatroom_id\"])\n message = @chatroom.messages.create(body: data[\"body\"], user: current_user)\n MessageRelayJob.perform_later(message)\n #Rails.logger.info data\n end", "def send_message(to_user, content)\n from_messages.create!(to_user_id: to_user.id, content: content)\n end", "def talk(dest,msg)\n $timer ||= 0\n sleep(0.2) until Time.now > $timer\n $timer = Time.now + 0.5\n privmsg_channel({dest: dest, msg: msg})\n end", "def respond\n\t\tconversation = current_user.mailbox.conversations.find(params[:id])\n\t\tif current_user.reply_to_conversation(conversation, params[:message])\n\t\t\trender json: { message: \"Replied conversation\"}\n\t\telse\n\t\t\trender json: { message: \"Could not send message\"}, status: :bad_request\n\t\tend\n\tend", "def update\n # Get the chat room\n @chat_room = ChatRoom.find(params[:id])\n\n # Save the changes\n @chat_room.update_attributes(params[:chat_room])\n\n # Update the flash based on whether we locked or unlocked the room\n if @chat_room.locked?\n flash[:notice] = 'Chat room now locked. No one else can join.'\n else\n flash[:notice] = 'Chat room now unlocked. Anyone can join.'\n end\n\n # Send the user back to the page they came from\n redirect_to(:back)\n end", "def reply(env, message)\n self.send(env[:sender], [env[:conn_id]], message)\n end", "def dashboard_zoom_room_issue(from, to, opts = {})\n data, _status_code, _headers = dashboard_zoom_room_issue_with_http_info(from, to, opts)\n data\n end" ]
[ "0.66002274", "0.63776666", "0.6189043", "0.6087626", "0.579443", "0.55950856", "0.55942017", "0.5593525", "0.5549418", "0.5490347", "0.5483273", "0.5465405", "0.54620755", "0.5447426", "0.54408777", "0.542646", "0.5415297", "0.54127085", "0.5405789", "0.53953594", "0.5394616", "0.53866297", "0.5365531", "0.5361011", "0.53474677", "0.5342156", "0.5335596", "0.5323303", "0.53215086", "0.5314629", "0.5313408", "0.5309241", "0.52963996", "0.5295256", "0.5271801", "0.52586794", "0.5246506", "0.5242736", "0.5226426", "0.52260894", "0.5189358", "0.5160066", "0.51548123", "0.51242507", "0.5106133", "0.5099248", "0.50744385", "0.50663674", "0.5054031", "0.50473243", "0.5043857", "0.50374097", "0.50354993", "0.50328183", "0.50213593", "0.5016826", "0.50167775", "0.5004203", "0.5001469", "0.49895298", "0.49890086", "0.49740604", "0.4971635", "0.49676248", "0.4957945", "0.49569207", "0.4950082", "0.49407387", "0.49389663", "0.49389663", "0.4931949", "0.49289232", "0.49151602", "0.49132636", "0.49124223", "0.49124223", "0.49023092", "0.48940617", "0.48821113", "0.48805422", "0.4875091", "0.48662278", "0.48643488", "0.48633343", "0.486177", "0.486177", "0.48354572", "0.48333412", "0.48280916", "0.48246256", "0.48219255", "0.48152322", "0.48149884", "0.4811074", "0.4803972", "0.4799501", "0.47969955", "0.4794131", "0.4792861", "0.47913525" ]
0.78462917
0
An ordered list of all words in the message with any reference to the bot's nick stripped out. If +command+ is passed in, it is also stripped out. This is useful to separate the 'parameters' from the 'commands' in a message.
def words(message, command = nil) reply = at_nick.downcase command = command.downcase if command message.split.reject {|word| word.downcase == reply || word.downcase == command } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_nick(message)\n possible_nick, command = message.split(' ', 2)\n if possible_nick.casecmp(at_nick) == 0\n command\n else\n message\n end\n end", "def words\n message.split\n end", "def command_list m\n get_list escape m.channel.to_s #logic/pug\n end", "def strip_message_from_whitespace msg\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def base_commands(command)\n prefix, base = command.match(/^(no )?(.*)$/).captures\n prefix = '' if prefix.nil?\n [prefix, base]\n end", "def preprocess_message(message, bot)\n # ignore if message is not from you\n return [false, '', ''] if message.from.id != Config.config['user']['tg_id']\n\n command_data = message.entities.find { |entity| entity.type == 'bot_command'}\n return [false, '', ''] if command_data.nil? # message to bot without command\n\n if command_data.offset != 0\n bot.api.send_message(chat_id: message.chat.id, text: 'Please give bot command first in your message :)')\n return [false, '', '']\n end\n\n long_command = message.text[0, command_data.length]\n command, bot_name = split_command_botname(long_command)\n text = message.text[command_data.length + 1, message.text.length]\n\n # ignore message cause it was adressed to another bot\n return [false, '', ''] if !bot_name.nil? && bot_name != Config.config['bot']['username']\n\n [true, command, text]\nend", "def words\n reject { |arg| arg.index('-') == 0 }\n end", "def commands_command(stem, sender, reply_to, msg)\n commands = self.class.instance_methods.select { |m| m =~ /^\\w+_command$/ }\n commands.map! { |m| m.to_s.match(/^(\\w+)_command$/)[1] }\n commands.reject! { |m| UNADVERTISED_COMMANDS.include? m }\n return if commands.empty?\n commands.map! { |c| \"#{options[:command_prefix]}#{c}\" }\n \"Commands for #{leaf_name}: #{commands.sort.join(', ')}\"\n end", "def strip_message_from_whitespace(msg)\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def strip_message_from_whitespace(msg)\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def reverse_words(message)\n message = message.split(\" \").reverse.join(\" \")\n p message\nend", "def remove_battle_command(command)\n battle_commands.delete_if { |cmd| cmd.name.casecmp?(command.to_s) }\n end", "def parse_command_id_list\n ids = detail('default:noun', {this: self}) || []\n ids << detail('default:name')\n ids.compact.uniq\n end", "def removeBlackList words\n\t\tblacklist = ['a','an','the','then','but','therefore','because','I','he',\n\t\t\t\t\t 'she','it','him','her','his','her','its','they','them','their']\n\t\tblacklist.map!{|w| w.upcase}\n\t\tmodified = words.clone\n\t\tmodified.delete_if{|w| blacklist.include?(w.upcase)}\n\t\treturn modified\n\tend", "def command_names\n commands.map &:name\n end", "def get_context(message)\n\n nouns = []\n @determiners.each do |determiner|\n matches = message.scan(/\\b#{determiner}\\s+([\\w-]+)\\b/i)\n\n matches.each do |match|\n unless @exempt.include? match.first or @determiners.include? match.first\n nouns << match.first.downcase\n @add_noun.execute(match.first)\n puts \"Added %s\" % match.first.downcase\n end\n end\n end\n nouns = nouns.uniq\n return nouns\n end", "def words\n @words ||= text.split(/\\s/).delete_if { |word| word.length.zero? }\n end", "def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end", "def get_list(command)\n out = []\n cmd(command)\n get_result(:array => true).each do |line|\n out << line.split(/\\s+/)\n end\n out\n end", "def words\n @phrase = @phrase.split(' ')\n end", "def preprocess_command(cmd)\n cmd.gsub!(\" \", \" \")\n cmd.strip!\n cmd.split(\" \");\n end", "def removeQuotesAndPunc sentence\n\t\tquotes = [\"\\\"\",\"'\",\":\",\",\",\".\",\"(\",\")\",\";\",\"!\",\"&\",\"<\",\">\",\"?\",\"-\",\"_\"]\n\t\twords = sentence.split(' ')\n\t\twords.map! do |w|\n\t\t\tw.slice!(1) if quotes.include?(w[0])\n\t\t\tw.slice(-1) if quotes.include?(w[-1])\n\t\t\tw\n\t\tend\n\t\treturn words.join(' ')\n\tend", "def messages(space)\n space.map do |message|\n message.to_s\n end\nend", "def undocumented_commands\n command_list - documented_commands\n end", "def admin_names\n extract_mentioned_screen_names(message)\n end", "def meaning(message)\n WORDS_MEANS_ACTION.find {|words, action| words.match(Regexp.new(message))} || []\n end", "def commands\n @commands.reject { |_, v| v.is_a? CommandLion::Option }\n end", "def command(command)\n output = \"\"\n\n # LETTER: equivalent to +LETTER\n if (command.match(\"^([A-Z])$\")) then\n command = \"+#{$1}\"\n end\n\n # +WORD : add words to table\n if (command.match(\"^\\\\+([A-Z ]+)$\"))\n new_words = $1.split(\" \").delete_if{|word|word.empty?}\n @words += new_words\n output += \"Added #{new_words.inspect} to table.\\n\"\n output += format_words\n\n # -WORD : remove words from table\n elsif (command.match(\"^-([A-Z ]+)$\"))\n remove_words = $1.split(\" \").delete_if{|word|word.empty?}\n words_copy = @words.dup\n valid = true\n remove_words.each do |word|\n index = words_copy.index(word)\n if index then\n words_copy.delete_at(index)\n else\n output += \"Invalid removal: Not enough #{word.inspect}s on the table.\\n\"\n valid = false\n end\n end\n if valid then\n @words = words_copy\n output += \"Removed #{remove_words.inspect} from table.\\n\"\n end\n output += format_words\n\n elsif ([\"@\",\"/WORDS\"].include?(command))\n output += format_words\n\n # # : number of moves\n elsif ([\"#\",\"/num\"].include?(command))\n output += \"Number of possible moves: #{moves.size}\"\n\n # ? : what moves can we make\n elsif ([\"?\",\"/moves\"].include?(command))\n output += \"Possible moves:\\n\"+@dictionary.format_moves(moves)\n\n # number : make that move\n elsif (command.match(\"^([0-9]+)$\"))\n move = moves[$1.to_i]\n if (move) then\n result = move(move)\n if result==true then\n output += \"Made move: #{dictionary.format_move(move)}\\n\"+format_words\n else\n output += result\n end\n else\n output += \"Unrecognized move #{$1.inspect}. Enter '?' for a list of valid moves.\" \n end\n\n else\n output += \"Unrecognized command #{command.inspect}\"\n end\n\n return output\n end", "def all_excluded_words\n (excluded_words + (lazy? ? LAZY_WORDS : [])).map(&:downcase)\n end", "def all_words\n result = []\n tagged_words.each do |word|\n result << word[0] unless is_punctuation([ word[0], word[1] ])\n end\n result\n end", "def words\n self.sentence.split('-')\n end", "def command_names(args)\n channel=args['channel']\n target=bot.Channel(channel)\n users = target.users.map { |u,m| \"#{'@' if m.include? \"o\" }#{'+' if m.include? \"v\"}#{u}\"}.sort\n send_command(\"names\",users: users)\n end", "def commands_list\n out = \"\"\n # If there are no commands set\n if COMMANDS.empty?\n out << \" ooops! commands are not here!\"\n else\n # Get the longest command's name, so we can output it nice 'n' clean\n # This '+ int' at the end is a distance (in spaces) from the longest\n # command to descriptions\n longest = COMMANDS.max_by(&:size).size + 8\n COMMANDS.each do |cmd|\n # Calc, calc.\n spaces = longest - cmd.size\n # Check if there is a 'desc' method\n desc = if eval \"Command::#{cmd}.new.respond_to? 'desc'\"\n # If there is - execute it\n eval \"Command::#{cmd}.new.desc\"\n else\n # If there is not\n \"---\"\n end\n out << \" \" << cmd.downcase.to_s << \" \" * spaces << desc\n # If this command is the last one, don't make a new line\n unless cmd == COMMANDS.last\n out << \"\\n\"\n end\n end\n end\n out\n end", "def parse_command(ws, msg, chatsession)\n parts = msg.split(\" \")\n command = parts.delete(parts[0])\n command = command[1..-1] # strip the /\n options = parts.join(\" \")\n case command\n when \"nick\"\n oldnick = chatsession[:nick]\n chatsession[:nick] = options\n ws.send \"Changed your nick to #{chatsession[:nick]}.\"\n @chatroom.push \"#{oldnick} is now known as #{chatsession[:nick]}\"\n end\n end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def get_word_list\n @word_list = @lines.reject do |line|\n line.length < 5 || line.length > 12\n end\n end", "def remove_w_words(sentence)\r\n\r\n arr = [] # empty array created\r\n x = sentence.split(\" \")\r\n\r\n i = 0\r\n while i < x.length # iteration starts to check \"w\" in each word\r\n arr << x[i] if x[i][0] != \"w\" # words w/o \"w\" collected\r\n i += 1\r\n end\r\n\r\n arr.join(\" \") # result\r\nend", "def parse_message message\n message.split(\"=>\").map { |i| i.strip }\n end", "def remove_command\n return if !has_manage_messages_permission?\n command.event.message.delete\n end", "def _excluded_words\n Lexhub.configuration.excluded_words\n end", "def remove_words(text, removes)\n\twords = text.split(\" \")\n\n\twords_to_remove = []\n\n\tremoves.split(\" \").each do |item|\n\t\twords_to_remove << item\n\tend\n\n\treturn_text = \"\"\n\n\twords.each do |word|\n\t\treturn_text += \"#{word} \" unless words_to_remove.include?(word)\n\tend\n\n\treturn return_text\nend", "def command_name(command)\n parts = []\n command = command.split(\" \")\n command.shift while command[0].to_s.include?(\"=\")\n parts << command.shift.split(\"/\")[-1]\n if parts[0] == \"sudo\"\n until command.empty?\n part = command.shift\n if part.include?(\"/\")\n parts << part.split(\"/\")[-1]\n break\n else\n parts << part\n end\n end\n end\n parts.join(\" \")\n end", "def word_with_guesses\n guesses_list = @guesses.to_s\n guesses_rx = /[^ #{guesses_list}]/\n @masked = @word.gsub(guesses_rx, \"-\")\n @masked.scan(/[a-z\\-]/).join\n end", "def full_message\n [message, @tags].reject(&:empty?).join(\" \")\n end", "def parse(message)\n if message.start_with? \":\"\n prefix, command, parameters = message[1..-1].strip.split(\" \", 3)\n else\n command, parameters = message.strip.split(\" \", 2)\n end\n\n if parameters.nil?\n parameters = []\n elsif parameters.start_with? \":\"\n trailing = parameters[1..-1]\n parameters = []\n else\n parameters, trailing = parameters.split(\" :\", 2)\n parameters = parameters.split(\" \")\n end\n\n return [prefix, command, parameters.compact, trailing]\n end", "def words\n @words_array = @phrase.split(' ')\n end", "def words\n []\n end", "def list(command)\n case command.split.at(1)\n when \"artists\" || \"artist\" || \"Artists\" || \"Artist\"\n navigate(Artist)\n when \"songs\" || \"song\" || \"Songs\" || \"Song\"\n navigate(Song)\n when \"genres\" || \"genre\" || \"Genre\" || \"Genres\"\n navigate(Genre)\n else\n puts \"The commands are:\" + Commands::list\n end\n @library.each_with_index {|member, index| puts index.to_s + \".\" + member.name}\n prompt(\"list\")\n end", "def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end", "def map_commands(commands)\n result = []\n commands.each { |c| result.push(*c.split(' ')) }\n\n result\n end", "def neutralize(sentence)\n words = sentence.split(' ')\n words.clone.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend", "def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend", "def neutralize(sentence)\n words = sentence.split(' ')\n words.reject! { |word| negative?(word) }\n words.join(' ')\nend", "def battle_commands\n @battle_commands ||= []\n end", "def all_commands\n [client_commands, server_commands].flatten\n end", "def dispatch_method_names(command, type = 'bot')\n [type + '_' + command.join('_').downcase,\n type + '_' + command.first.downcase]\n end", "def neutralize(sentence)\n words = sentence.split(' ')\n ok_words = words.select do |word|\n !negative?(word)\n end\n\n ok_words.join(' ')\nend", "def command_from_text(text, username = nil)\n return unless text\n match = text.match CMD_REGEX\n return unless match\n return if match[3] && username != true && match[3] != username\n [match[1], text.split.drop(1)]\n end", "def profile_names(command=nil)\n command = command || RC.current_command\n\n list = []\n @_config.each do |feature, configs|\n configs.each do |c|\n if c.command?(command)\n list << c.profile\n end\n end\n end\n list.uniq\n end", "def commands\n ensure_cache_up_to_date\n commands = self.redis.keys(\"bluster:objects:command:*\")\n commands.map! { |r| r.split(\":\")[3] }\n commands.uniq\n end", "def words( strict = false )\n splits = split( /\\b/ )\n splits.reject! { |w| !(w =~ /\\w/) } if strict\n splits\n end", "def battle_commands\n @battle_commands ||= []\n @battle_commands\n end", "def gather_command\n @command = []\n @lines.each do |x|\n if x[0,1].is_i?\n @command.push(x.split(/ /).s_to_i)\n else\n @command.push(x.split(//))\n end\n end\n end", "def get_text(command)\n command = command.split(' ')\n head = command.shift\n @params = command.join(' ')\n interpret_command head.to_s.downcase\n end", "def find_all_commands (sCOMMAND)\n array = Array.new()\n @commands.each do |command|\n if (command.commandName == sCOMMAND)\n array.push(command)\n end\n end\n return array\n end", "def list_my_words\n games = GameSession.where(user_id: self.id)\n games = games.select {|game| game.word_id != nil}\n words = games.map {|gs| Word.find(gs.word_id).word}\n wins = games.map {|gs| gs.win}\n h = {true => [], false => []}\n for i in 0..words.length-1\n wins[i] ? h[true] << words[i].green : h[false] << words[i].red\n end\n puts \"Puzzles Won\".green.underline\n if h[true].empty? \n puts \"(no puzzles won)\".black\n else\n puts h[true]\n end\n puts \"\\n\\n\"\n \n puts \"Puzzles Lost\".red.underline\n if h[false].empty?\n puts \"(no puzzles lost)\".black\n else\n puts h[false]\n end\n puts \"\\n\\n\\n\"\n end", "def getcommand(msg)\n msg.message =~ /#{$COMMAND}(\\w+)/\n commandused = $1\n case commandused\n when 'roll', 'nobotch', 'special'\n if msg.message =~ /#{commandused}\\s*help\\s*$/\n # show command help\n \"#{HELP_TEXT(commandused)}\"\n elsif msg.message =~ /#{commandused}\\s+(.*)\\s*$/\n begin\n \"<b>#{$names[msg.actor]}: </b>#{substitute($1,commandused)}\"\n rescue ArgumentError => e\n \"\\\"<b>Error</b>: #{e}</b>\\\",#{[msg.actor]}\"\n end\n end\n \n when 'help'\n \"<br>I'm here to make your V20 playing much more pleasureable!<br><br>\n Commands:<br>\n <b>#{$COMMAND}roll</b> &lt;input&gt; - Regular ol' dice rollin!<br>\n <b>#{$COMMAND}nobotch</b> &lt;input&gt; - Roll dice where 1s don't botch!<br>\n <b>#{$COMMAND}special</b> &lt;input&gt; - Make those 10s count DOUBLE!<br><br>\n\n use '<b>help</b>' as the input for more information on any command!\"\n else\n #wat r u doin dolan pls\n \"wat r u doin stahp\"\n end\nend", "def subcommand_list\n with_underscore, without_underscore = collect_do.partition {|command| command.include?('_')}\n with_underscore.find_all {|do_method| without_underscore.include?(do_method[/^[^_]+/])}\n end", "def make_command_list\n add_command(Vocab::SKILLS, :skills, main_commands_enabled)\n add_command(Vocab::CAPACITIES, :capacities, main_commands_enabled)\n add_command(Vocab::EQUIP, :equip, main_commands_enabled)\n add_command(Vocab::LEARNING, :learning, main_commands_enabled)\n add_command(Vocab::LIBRAIRIES, :librairies, main_commands_enabled)\n add_command(Vocab::ITEM, :item, main_commands_enabled)\n add_command(Vocab::CRAFTING, :crafting, main_commands_enabled)\n add_command(Vocab::STRATEGY, :strategy, main_commands_enabled)\n add_command(Vocab::COOKING, :cooking, main_commands_enabled)\n add_command(Vocab::SYSTEM, :system, main_commands_enabled)\n end", "def command_list\n collect_do - subcommand_list\n end", "def standard_message\n \"#{current_player.name}'s pending words: #{pending_result}\"\n end", "def words\n @phrase.split(/[^A-Za-z0-9']+/)\n end", "def clear_commands\n @@commands = HELP_COMMAND.dup\n end", "def cleanup_commands\n @cleanup_commands ||= []\n end", "def neutralize(sentence)\n words = sentence.split(' ')\n words.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend", "def neutralize(sentence)\n words = sentence.split(' ')\n unchanged_words = sentence.split(' ')\n unchanged_words.each do |word|\n words.delete(word) if negative?(word)\n end\n\n words.join(' ')\nend", "def hide_word(word)\n word.split('').map { '_' }.join\n end", "def parse_command(input, embedded = false)\n words = []\n\n input.consume if embedded # skip bracket\n\n consume_comments_and_whitespace input\n\n while not input.eof? do\n c = input.look_ahead\n case c\n # a new line or semi-colon ends a command\n when /[;|\\n]/ : input.consume; break\n when '\"' : words << parse_quoted_word(input)\n when '{' : words << parse_braced_word(input)\n # skip all other whitespace\n when /\\s/ : input.consume\n else\n # If this is an embedded command, check for closing bracket\n # otherwise the bracket is the start of an unquoted word.\n\n if embedded and c == \"]\"\n input.consume\n break\n end\n\n # everything else is handled as an unquoted word\n words << parse_unquoted_word(input, true)\n end\n end\n return words\n end", "def words\n split(/[^a-z0-9_.-]+/i)\n end", "def parse_cmd commands\n\t\t@commands = commands.split(//)\n\tend", "def filter\n @input.split(COMMAND_REGEX)\n .reject { |command| (command =~ COMMAND_REGEX).nil? }\n end", "def words_with_unapproved_synonyms\n return Keyword.joins(:synonyms).where(\"synonyms.approved\" => false).all\n end", "def neutralize(sentence)\n words = sentence.split(' ')\n words.each_with_index do |word, index|\n p index\n p word\n p words\n words.delete(word) if negative?(word)\n p words\n end\n\n words.join(' ')\nend", "def normalized_words\n self.split(/\\s+/).map { |word|\n Iconv.iconv('ascii//translit//ignore', 'utf-8', word).first.downcase.gsub(/\\W/,'')\n }.\n delete_if(&:empty?).\n map { |word|\n \"**#{word}\"\n }\n end", "def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end", "def words\n words = @phrase.split(\" \")\n words.each do |word|\n translate(word)\n end\n end", "def command_name(command)\n command.slice(0, command.index(/\\s/)).split('/')[-1]\n end", "def command_name(command)\n i = command =~ /\\s/\n command = command.slice(0, i) if i\n command.split('/')[-1]\n end", "def says\n\t\tself.current_state.sayings.map do |phrase|\n\t\t\tif phrase.is_a?(String) \n\t\t\t\tphrase.match(/^ivr/) ? I18n.t(phrase) : phrase\n\t\t\telsif phrase.is_a?(Symbol)\n\t\t\t\tself.send(phrase)\n\t\t\tend\n\t\tend.flatten || []\n\tend", "def subcommands_presentation\n return nil unless command.commands.size > 0\n command.commands.values.uniq.map(&:summarize).join(\"\\n\")\n end", "def admin_remove_member_request_list\n %w( tt_remove_member_request_list@booktrope.com )\n end", "def keep_only_words_that_match(hangman_pattern)\n pattern = Regexp.new('^' + hangman_pattern.gsub(/-/,'.') + '$')\n\n change_wordlist(@words.select { |word,letters| word.word =~ pattern })\n end", "def prepare_words(words)\n return [''] if words.blank?\n a = words.split(/[,\\s]/).map(&:strip)\n a.any? ? a : ['']\n end", "def matrix_command(message)\n pfx = @cmd_prefix\n cmd = message.content[:body].split(/\\s+/)[0].gsub(/#{pfx}/, '')\n\n res = 'Invalid command'\n\n res = case cmd\n when 'listcommands'\n \"Currently available commands: #{@all_commands.keys.sort.join(', ')}\"\n when 'help'\n if message.content[:body].split(/\\s+/).count <= 1\n '!help: Get help for a specific command' \\\n \"\\nUsage: !help COMMAND\"\n else\n second_cmd = message.content[:body].split(/\\s+/)[1]\n .gsub(/#{pfx}/, '')\n @all_commands[second_cmd.strip].help_command(message)\n end\n end\n\n room = @client.ensure_room(message.room_id)\n room.send_notice(res)\n end", "def unregister_commands\n Bot::Commands.delete_for self\n end", "def relayed_nick_parts\n @relayed_nick_parts ||= cinch_user.nick.split('/', 2)\n end", "def mentioned_people_names\n self.mentioned_people.map(&:name).join(', ')\n end", "def full_command\n command_array.join(' ')\n end", "def strip\n with_command \"-strip\"\n end" ]
[ "0.5913243", "0.5908133", "0.55127823", "0.5350945", "0.5346824", "0.5246391", "0.52345324", "0.51931435", "0.51899606", "0.51899606", "0.5138439", "0.5127919", "0.5068915", "0.50436324", "0.5021841", "0.50095546", "0.49676156", "0.4961847", "0.49489635", "0.49471855", "0.4947138", "0.49464214", "0.49440435", "0.4932411", "0.49089262", "0.4908001", "0.4899075", "0.4892742", "0.48857796", "0.4859248", "0.48506188", "0.48228118", "0.48181662", "0.48084173", "0.4804865", "0.4804865", "0.47935158", "0.47784507", "0.47774646", "0.47765878", "0.4770626", "0.47698432", "0.4760113", "0.4749544", "0.4743887", "0.4743289", "0.47415942", "0.47409174", "0.4732843", "0.47328404", "0.47132805", "0.47035918", "0.4692774", "0.4692774", "0.4688929", "0.4686475", "0.4680956", "0.468084", "0.46777445", "0.46748614", "0.4667011", "0.4665165", "0.46635205", "0.46581188", "0.46569863", "0.46568426", "0.46443313", "0.46176648", "0.4614081", "0.46103692", "0.46075708", "0.4606705", "0.46058112", "0.45929617", "0.45918155", "0.45914596", "0.4589136", "0.45837414", "0.45800662", "0.45795888", "0.45579314", "0.455712", "0.45556566", "0.45530975", "0.45517412", "0.45413697", "0.4538215", "0.4537627", "0.45285723", "0.45234627", "0.45229837", "0.4517118", "0.45133486", "0.450451", "0.45022717", "0.44955474", "0.44942996", "0.44937295", "0.44918284", "0.44762352" ]
0.7779327
0
Removes the first word in message if it is a reference to the bot's nick
def without_nick(message) possible_nick, command = message.split(' ', 2) if possible_nick.casecmp(at_nick) == 0 command else message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nick_part(nick, reason=nil)\n return if not @names.include?(nick)\n\n @names.delete(nick)\n reason = \" (#{reason})\" if reason\n @bridge.add(:xmpp, :irc, SYSTEM_USER, \"#{nick} just left the IRC channel#{reason}\")\n end", "def part msg\n msg.connection.channels.each_value do |chan|\n unless chan.get_user(msg.nick_canon) == nil\n return\n end\n end\n\n delete_user msg.nick_canon\n end", "def remove_prefix(msg)\n msg.sub(PREFIX_REGEX, \"|\")\n end", "def normalise_nick(nick)\n return /^[@+]?(.*)$/.match(nick)[1]\n end", "def process_part(message)\n channel = message.channel\n /:(?<user>\\w+)/ =~ message.raw\n channel.users.delete user if channel.users.key? user\n end", "def words(message, command = nil)\n reply = at_nick.downcase\n command = command.downcase if command\n message.split.reject {|word| word.downcase == reply || word.downcase == command }\n end", "def on_nick msg\n return unless msg.connection == self\n\n if msg.me?\n @nick = msg.text\n return\n end\n end", "def clean_message\n self.message = Loofah.fragment(self.message).scrub!(:strip).text\n end", "def irc_nick_event(stem, sender, arguments) # :nodoc:\n @nick = arguments[:nick] if sender[:nick] == @nick\n @chan_mutex.synchronize do\n @channel_members.each { |chan, members| members[arguments[:nick]] = members.delete(sender[:nick]) }\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end", "def remove_message(name)\n\t\tend", "def clean_message(message); end", "def parse_user_remove(msg_details)\n username = msg_details\n @userlist_table[username] = nil\n return username\n end", "def irc_part_event(stem, sender, arguments) # :nodoc:\n @chan_mutex.synchronize do\n if sender[:nick] == @nick then\n drop_channel arguments[:channel]\n else\n @channel_members[arguments[:channel]].delete sender[:nick]\n end\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end", "def r_nick(event)\n report \"#{event.nick} changed nick to #{event.message}\" unless event.nick == @yail.me\n end", "def local_nick(body)\n name1 = _pop_token(body)\n name2 = _pop_token(body)\n raise \"Usage: /nick <old_name> <new_name>\" if name1.to_s.empty?\n if name2.to_s.empty?\n name2 = name1\n name1 = @var[:our_name]\n end\n raise \"Name '#{name2}' is already in use\" if @var[:user_keys][name2]\n\n # Perform the renaming\n kh = @connection.comm.sender_keyhash(name1)\n key = @connection.comm.rsa_keys[name1]\n raise \"Invalid user name: '#{name1}'\" unless kh and key\n @connection.comm.rsa_keys[name2] = key\n @connection.comm.rsa_keys.delete(name1)\n @connection.comm.names[kh] = name2\n @var[:user_keys][name2] = key\n @var[:user_keys].delete name1\n @var[:granted].collect! { |x| x = name2 if x == name1 ; x }\n @var[:granted_by].collect! { |x| x = name2 if x == name1 ; x }\n @var[:revoked].collect! { |x| x = name2 if x == name1 ; x }\n \n # And lastly, if this is us, update our special name attribute\n @var[:our_name] = name2 if @var[:our_name] == name1\n _notice(\"#{name1} is now known as #{name2}\")\n _save_env\nend", "def parse_command(ws, msg, chatsession)\n parts = msg.split(\" \")\n command = parts.delete(parts[0])\n command = command[1..-1] # strip the /\n options = parts.join(\" \")\n case command\n when \"nick\"\n oldnick = chatsession[:nick]\n chatsession[:nick] = options\n ws.send \"Changed your nick to #{chatsession[:nick]}.\"\n @chatroom.push \"#{oldnick} is now known as #{chatsession[:nick]}\"\n end\n end", "def delete nick\n\t\t@users.delete ['nick', nick]\n\tend", "def renickify \n @bot.msg(\"nickserv\", \"ghost #{bot.nick} pearljam\")\n @bot.msg(\"nickserv\", \"identify pearljam\")\n @bot.nick = 'infobot-clone'\n return \"Renickifying!\"\n end", "def quit msg\n return unless msg.connection == @connection\n\n delete_user msg.nick_canon\n end", "def user_firstname\n return @message[:user][:name].split(' ').first\n end", "def nick(msg)\n if msg.user.last_nick == @settings['identity']['nick']\n bot.nick = @settings['identity']['nick']\n return\n end\n str = sprintf('*** %s is now known as %s',msg.user.last_nick,msg.user.nick)\n # gotta log to every channel this user is in\n (msg.user.channels & msg.bot.channels).each do |channel|\n log(msg,str,channel)\n end\n @beans[:nick]+=1\n end", "def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end", "def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end", "def nick\n @bot.nick\n end", "def nickname\n (f, l) = full_name.split(\" \", 2)\n \"#{f}#{l.split(/[\\s']/).collect(&:first).join}\"\n end", "def r_nick(fullactor, actor, nickname)\n report \"#{actor} changed nick to #{nickname}\" unless nickname == @me\n end", "def nick_canon\n @nick_canon ||= @connection.canonize @nick\n end", "def random_word(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n word = LiterateRandomizer.word\n @last_words = [] if @last_words.nil?\n word = LiterateRandomizer.word while @last_words.include?(word)\n @last_words.prepend_capped(word, 5)\n msg.reply(word)\n end", "def nickname(user)\n nickname = (!user.blank? && !user.nickname.blank?)? user.nickname : I18n.t('guest_name')\n nickname\n end", "def change_nick msg\n return if msg.connection != @connection\n return unless has_key? msg.nick_canon\n\n $log.debug(\"Users.add_user\") { \"Renaming user #{msg.nick} on #{@connection.name}\" }\n\n changed_nick_canon = msg.connection.canonize msg.text\n\n # Apparently structs don't let you change values. So just make a\n # new user.\n changed_user = User.new @connection, changed_nick_canon,\n self[msg.nick_canon].user,\n self[msg.nick_canon].host,\n self[msg.nick_canon].level,\n self[msg.nick_canon].account\n\n delete_user msg.nick_canon\n\n self[changed_nick_canon] = changed_user\n end", "def relayed_nick_parts\n @relayed_nick_parts ||= cinch_user.nick.split('/', 2)\n end", "def strip_message_from_whitespace(msg)\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def strip_message_from_whitespace(msg)\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def single_nick?\n @nick != '*'\n end", "def strip_message_from_whitespace msg\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "def remove(s)\np x = s.split(\"\")\nif x.last === \"!\"\nz = x.pop\np x.join(\"\")\nelsif x.last != \"!\"\np x.join(\"\")\nend\nend", "def nick\n @prefix =~ PREFIX_PAT and $1\n end", "def on_nick_in_use msg\n return if @registered or msg.connection != self\n\n if @nick == Bot::Conf[:core][:nick]\n\n if Bot::Conf[:core].key? :altnick\n @nick =Bot::Conf[:core][:altnick]\n else\n @nick = 'TerminusBot'\n end\n\n raw \"NICK #{@nick}\"\n return\n end\n\n @nick << \"_\"\n\n raw \"NICK #{@nick}\"\n end", "def remove_appended_messages(text)\n return nil if text.nil? || text.empty?\n string = text.to_s # ensure we have a string\n\n # ------------ Original Message ------------\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+[-=]+.*Original Message.*/mi, ''\n\n # ------------ Forwarded Message ------------\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+[-=]+.*Forwarded Message.*/mi, ''\n\n # From: Seth Vargo <svargo@andrew.cmu.edu>\n # Send: Tues, Oct 9, 2012\n # To: Robbin Stormer <a@example.com>\n # Subject: Cookies and Cream\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+From:.*Sent:.*(To:.*)?.*(Cc:.*)?.*(Subject:.*)?.*/im, ''\n\n # On Oct 9, 2012, at 6:48 PM, Robbin Stormer wrote:\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+On.+at.+wrote:.*/mi, ''\n\n # Begin forwarded message:\n string.gsub! /(<[\\w\\s=:\"#]+>|^)+Begin\\ forwarded\\ message:.*/mi, ''\n string.strip!\n string\n end", "def shout(message)\n\tmessage.upcase\nend", "def sender_obscured\n if sender.blank? or !topica_message_id.blank?\n return sender\n end\n \n sender_parts = sender.split(\"@\")\n if sender_parts.size > 1\n user_name = sender_parts.first\n if user_name.length > 2\n return user_name[0..(user_name.length - 3)] + \"..@\" + sender_parts.last\n else\n return \"..@\" + sender_parts.last\n end\n end\n \n return sender\n end", "def nickname\n (preferred_name && !preferred_name.strip.empty?) ? preferred_name : first_name\n end", "def without_instruction(text)\n text.gsub(/^you (should|must)/i, '').gsub(/\\.$/, '')\n end", "def clean_name\n return name.split(':').pop\n end", "def read_message\n if (line = @sock.gets and msg = IRC.parse_message(line))\n case msg.command\n when IRC::RPL_WELCOME\n i = msg.params[-1].rindex(' ') || -1\n @prefix = msg.params[-1][i + 1..-1]\n when IRC::CMD_PING\n pong(msg)\n when IRC::CMD_NICK\n # check if our nick got changed by the server\n @nickname = msg.params[0] if msg.nick == @nickname\n end\n msg\n end\n end", "def change_own_nickname(token, server_id, nick)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/members/@me/nick\",\n { nick: nick }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def nick(m)\n channel_users do |users|\n unless users.has_key?(m.user.last_nick)\n fail \"user '#{m.user.last_nick}' not found\"\n end\n\n users[m.user.nick] = users[m.user.last_nick]\n users.delete(m.user.last_nick)\n\n users[m.user.nick].each do |chan|\n @loggers[chan].each { |l| l.log(:nick, m) }\n end\n end\n end", "def clean(message)\n message = message.to_s.dup\n message.strip!\n message.gsub!(/%/, '%%') # syslog(3) freaks on % (printf)\n message.gsub!(/\\e\\[[^m]*m/, '') # remove useless ansi color codes\n return message\n end", "def motivate_you(msg)\n return if Variables::Constants::IGNORED_USERS.include?(msg.user.nick)\n motivate_else(msg, msg.user.nick)\n end", "def parse_userlevel_title(msg, remove: false, full: true)\n name, msg = parse_string_or_id(msg, quoted: ['for', 'title'], final: ['for'], remove: true)\n name.strip! if name.is_a?(String)\n if name.is_a?(String) && name.empty? && full\n name, msg = msg, ''\n name = name.strip.to_i if is_num(name)\n end\n remove ? [name, msg] : name\nrescue\n remove ? ['', msg] : ''\nend", "def modify_current_user_nick(guild_id, nick:)\n response = request(\n :guilds_gid_members_me_nick, guild_id,\n :patch,\n \"guilds/#{guild_id}/members/@me/nick\",\n nick: nick,\n )\n response.body\n end", "def clean(message)\n message = message.to_s.dup\n message.strip!\n message.gsub!(/%/, '%%') # syslog(3) freaks on % (printf)\n message.gsub!(/\\e\\[[^m]*m/, '') # remove useless ansi color codes\n return message\n end", "def del_msg_name( msgName )\n @msgNames.delete msgName if defined? @msgNames\n end", "def message_text\n message && message.gsub(%r{</?[^>]+?>}, '')\n end", "def reveal_author(nick)\n case nick\n when 'lddev' then 'MM'\n when '1bardesign' then 'Geti'\n when 'flieslikeabrick' then 'FliesLikeABrick'\n else I18n.news_fetcher.someone\n end\n end", "def remove_client_prompt\n\t\tname = prompt_input('To unsubscribe, please enter your first name:').capitalize\n\t\tputs \"Sorry to see you go, #{name}, but hope you'll be back again.\"\n\t\t$shelter.clients.delete(name)\n\tend", "def receive_message(nick, message)\n !preferences[:nicks].include?(nick)\n end", "def strip_prefix(string)\n string[/^OK.(.*)/, 1]\n end", "def strip_login\n self.login.to_s.strip!\n end", "def remove(s)\n s.gsub(/!/, '').concat(\"!\")\nend", "def nick_change_line(line)\n other_person = /-!- ([^ ]+) is now known as ([^ ]+)/.match(line)\n you_person = /-!- You're now known as ([^ ]+)/.match(line)\n if other_person\n old_nick, new_nick = other_person.captures\n<<-END\n<span class=\"old_nick\">#{old_nick}</span> is now known as <span class=\"new_nick\">#{new_nick}</span>\nEND\n elsif you_person\n new_nick = other_person.captures.first\n<<-END\nYou're now known as <span class=\"new_nick\">#{new_nick}</span>\nEND\n end\nend", "def sender_user_name_of_recent_message\n message = self.messages.last \n user = message.sender_id\n name = User.find_by(id: user)\n if name\n \"#{name.first_name} #{name.last_name}\"\n end\n end", "def truncate message, destination, notice = false\n prefix_length = @nick.length +\n @user.length +\n @client_host.length +\n destination.length +\n 15\n\n # PRIVMSG is 1 char longer than NOTICE\n prefix_length += 1 unless notice\n\n if (prefix_length + message.length) - 512 > 0\n return message[0..511-prefix_length]\n end\n\n message\n end", "def irc_quit_event(stem, sender, arguments) # :nodoc:\n @chan_mutex.synchronize do\n @channel_members.each { |chan, members| members.delete sender[:nick] }\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end", "def remove_unofficial(name)\n\tname = params[:param2]\n\tl_name = name.partition(\" \")\n\tl_name[0].clear\n\tname = \"\"\n\tl_name.each do |word|\n\t\tname += word\n\tend\n\treturn name\n\nend", "def remove_salt(possibly_salted)\n possibly_salted.include?(\"::::\") ? possibly_salted.split(\"::::\")[1] : possibly_salted\n end", "def nickname\n @nick\n end", "def delete_pre_address(address)\n address = address.sub(/^\\s*mail\\:\\s*/i, '')\n address.gsub(/.*\\,\\s+(\\d+\\b\\s+\\w)/i, '\\1')\n end", "def on_nick(connection, before, after)\n end", "def get_nickname(member)\n nickname = \"\"\n entry = @client[:nicknamer].first(server_id: member.server.id, role: member.colour_role.id)\n if entry\n nickname += (entry[:upper_prefix] || \"\") + \" \"\n end \n\n nickname += member.roles.map {|role| \n role_entry = @client[:nicknamer].first(server_id: role.server.id, role: role.id)\n role_entry[:normal_prefix] if role_entry\n }.join(\" \")\n nickname += member.name + \" \"\n \n nickname += member.roles.map {|role| \n role_entry = @client[:nicknamer].first(server_id: role.server.id, role: role.id)\n role_entry[:normal_suffix] if role_entry\n }.join(\" \")\n\n if entry\n nickname += (entry[:upper_suffix] || \"\")\n end \n nickname\n end", "def toggle_nick(bot, channel)\n @use_nicks[channel] = (not @use_nicks[channel] == true)\n \n if use_nicks?(channel)\n bot.say(\"Nicks will be sent with messages.\")\n else\n bot.say(\"Nicks will not be sent (omegle users will just see anonymous text)\")\n end\n end", "def sanitized_message\n message.to_s[0,140]\n end", "def remove_creator(content_node)\n creator_name = content_node.css(\"small\")[0]\n if creator_name.present? && creator_name.inner_html.match(/by ~.*?<a class=\"u\" href=/m)\n creator_name.remove\n end\n end", "def destroy_message(string)\n array = string.partition(\":\")\n\tfinal = array[0] + array[1]\nend", "def clean_hashtag\n self.hashtag.slice!(0) if self.hashtag.first == \"#\"\n end", "def parse_discord_user(msg)\n user = msg[NAME_PATTERN, 2].downcase\n raise OutteError.new \"You need to provide a user.\" if user.nil?\n\n parts = user.split('#')\n users = User.search(parts[0], !parts[1].nil? ? parts[1] : nil)\n case users.size\n when 0\n raise OutteError.new \"No user named #{user} found in the server.\"\n when 1\n return users.first\n else\n list = users.map{ |u| u.username + '#' + u.tag }.join(\"\\n\")\n raise OutteError.new \"Multiple users named #{parts[0]} found, please include the numerical tag as well:\\n#{format_block(list)}\"\n end\nend", "def just_first\n first.split(' ')[0]\n end", "def remove_first(input, string); end", "def scrub_plugin_name name\n\t\t\t\t\treturn name.gsub(\"(remote check)\", \"\").gsub(\"(uncredentialed check)\", \"\").gsub(/(\\(\\d.*\\))/, \"\")\n\t\t\t\tend", "def bot_short_name_without_version(pr)\n bot_short_name(pr).sub(/_v\\d*$/, '_v')\n end", "def last(m)\n\t\tnick = m.message.split(/\\W/)[2]\n\t\tuser = @users[nick]\n\t\tif Mailbox.exists? nick\n\t\t m.reply \"Last saw #{nick} [ #{\"%.2f\" % ((Time.now - user.last_seen) / 60 / 60)} hrs | #{user.missed_lines} lines ] ago\"\n\t end\n end", "def update_nickname(member)\n nickname = get_nickname(member)\n if member.display_name != nickname\n member.set_nick nickname\n end\n end", "def message_user\n return self.username\n end", "def preprocess_message(message, bot)\n # ignore if message is not from you\n return [false, '', ''] if message.from.id != Config.config['user']['tg_id']\n\n command_data = message.entities.find { |entity| entity.type == 'bot_command'}\n return [false, '', ''] if command_data.nil? # message to bot without command\n\n if command_data.offset != 0\n bot.api.send_message(chat_id: message.chat.id, text: 'Please give bot command first in your message :)')\n return [false, '', '']\n end\n\n long_command = message.text[0, command_data.length]\n command, bot_name = split_command_botname(long_command)\n text = message.text[command_data.length + 1, message.text.length]\n\n # ignore message cause it was adressed to another bot\n return [false, '', ''] if !bot_name.nil? && bot_name != Config.config['bot']['username']\n\n [true, command, text]\nend", "def parse_userlevel_author(msg, remove: false)\n name, msg = parse_term(msg, quoted: ['author id'], remove: true)\n if !name.empty? && is_num(name)\n name = name.strip.to_i\n else\n name, msg = parse_string_or_id(msg, quoted: ['by', 'author'], final: ['by'], remove: true)\n name.strip! if name.is_a?(String)\n end\n remove ? [name, msg] : name\nrescue\n remove ? ['', msg] : ''\nend", "def change_nickname(token, server_id, user_id, nick)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/members/#{user_id}\",\n { nick: nick }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def supprimerMessage(indice)\r\n\t\t@lstMessages.delete(indice) if @lstMessages.has_key?(indice)\r\n\tend", "def update_nick(new_nick)\n @last_nick, @name = @name, new_nick\n @last_id, @id = @id, sanitize(new_nick)\n @bot.user_list.update_nick(self)\n end", "def cunban(m, nick)\n nick = User(nick)\n if is_chanadmin?(m.channel, m.user) && is_botpowerful?(m.channel)\n m.channel.unban(nick.mask)\n elsif !is_chanadmin?(m.channel, m.user)\n m.reply NOTADMIN, true\n elsif !is_botpowerful?(m.channel)\n m.reply NOTOPBOT, true\n end\n end", "def change_nick(nick)\n join(nick)\n end", "def sanitize_mods_name_label(label)\n label.sub(/:$/, '')\n end", "def addressed_to_me?(message)\n if m = message.body.match(/^\\b#{name}[,:]\\s*(.*)/i) || message.body.match(/^\\s*(.*?)[,]?\\b#{name}[.!?\\s]*$/i)\n message.command = m[1]\n end\n end", "def remove_name_classifications(proto_record)\n proto_record[:full_name] = proto_record[:full_name].sub(/\\s-\\s[A-Z\\s]*/, \"\")\n end", "def nick\r\n return for_context(nil, false) { |c| c.nick }\r\n end", "def tweet(bot, nick, message)\n if message.to_s.length > 0\n $log.info \"Tweeting [#{nick}] #{message}\"\n @client.update(\"#{nick} says: #{message}\")\n bot.say \"Tweeted successully, #{nick}\"\n else\n bot.say \"Please provide a message!\"\n end\n end", "def truncate message, destination, notice = false\n prefix_length = @connection.nick.length +\n @connection.user.length +\n @connection.client_host.length +\n destination.length +\n 15\n\n # PRIVMSG is 1 char longer than NOTICE\n prefix_length += 1 unless notice\n\n if (prefix_length + message.length) - 512 > 0\n return message[0..511-prefix_length]\n end\n\n message\n end", "def delete_user nick\n $log.debug(\"Users.add_user\") { \"Removing user #{nick} on #{@connection.name}\" }\n\n delete nick\n end", "def repo_name_without_whitespace(repo_name)\n repo_name.strip\n end", "def unfollow(nick)\n config['following'].delete(nick)\n config.save\nend", "def remove_name_classifications(proto_record)\n proto_record[:full_name] = proto_record[:full_name].sub(/\\s-\\s[A-Z\\s]*/, '')\n end" ]
[ "0.6668592", "0.6528002", "0.64406157", "0.6282258", "0.616248", "0.6085518", "0.6074179", "0.60251206", "0.5927969", "0.5865599", "0.57653135", "0.5722443", "0.56778085", "0.5623015", "0.55778295", "0.55585176", "0.55238044", "0.5521788", "0.55213225", "0.55183566", "0.55121064", "0.5509884", "0.5509884", "0.54893994", "0.5472306", "0.5469895", "0.54638624", "0.5463363", "0.54483104", "0.5446497", "0.54221034", "0.5420785", "0.5420785", "0.54154265", "0.53857106", "0.53656965", "0.5332122", "0.5330596", "0.53290904", "0.52994716", "0.5293272", "0.52911276", "0.5290254", "0.52786815", "0.5265048", "0.52627766", "0.5247899", "0.5244424", "0.5244402", "0.52371746", "0.52353925", "0.5232228", "0.5227973", "0.52198696", "0.5218543", "0.52091134", "0.52090186", "0.5204751", "0.5203969", "0.5195707", "0.5179313", "0.5177891", "0.5175548", "0.51588726", "0.51569265", "0.5155169", "0.5153096", "0.5139839", "0.5131918", "0.5131005", "0.5130922", "0.5113613", "0.5113569", "0.51107645", "0.5106382", "0.51035213", "0.50978816", "0.5093749", "0.5092542", "0.50762737", "0.50732034", "0.50708157", "0.50702816", "0.5066318", "0.506111", "0.5057779", "0.50552297", "0.50529987", "0.5050792", "0.504932", "0.50422436", "0.50385773", "0.5035572", "0.50340647", "0.5029282", "0.5028994", "0.502795", "0.5024984", "0.5019183", "0.5019082" ]
0.7735524
0
Do whatever you need to do to handle this message. If you want to stop the plugin execution chain, return +true+ from this method. Plugins are handled in the order that they appear in Robut::Plugin.plugins
def handle(time, sender_nick, message) if matchers.empty? raise NotImplementedError, "Implement me in #{self.class.name}!" else find_match(message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_allowed?(plugin_name); end", "def check_command_plugins(msg)\n @command_plugins.each do |name, block, options|\n begin\n if name =~ /^!/\n if msg =~ /^#{name}\\b/\n msg = msg.gsub(/!\\S+\\s*/, \"\")\n block.call(msg)\n end\n else\n block.call(msg)\n end\n rescue Exception => e\n reply \"Error: #{e.class}\"\n e.dump(@current_server.logger)\n end\n end\n end", "def can_proceed?(plugins, plugin_name)\n plugins = plugins.select do |plugin|\n plugin['name'] == plugin_name\n end\n\n return false if plugins.length != 1\n plugin = plugins[0]\n\n if !TeracyDev::Plugin.installed?(plugin_name)\n @logger.debug(\"#{plugin_name} is not installed\")\n return false\n end\n\n if plugin['enabled'] != true\n @logger.debug(\"#{plugin_name} is installed but not enabled so its settings is ignored\")\n return false\n end\n return true\n end", "def plugin_installed?(name)\n raise \"Not Implemented\"\n end", "def plugin?(ref)\n\t\t\t\t\t\n\t\t\t\tend", "def reload_plugins?\n !!@reload_plugins\n end", "def stop_message_process?\n return ($scene.is_a?(Yuki::SoftReset) || $scene.nil?)\n end", "def plugin? name\n self.class.plugins.include? name\n end", "def stop_plugin\n @active = false\n end", "def plugins_respond_to?(cmd_name)\n\t\t\treturn respond_to?(\"command_#{cmd_name}\".to_sym)\n\t\tend", "def plugin_installed?(name)\n return if Vagrant.has_plugin?(name)\n puts \"Vagrant plugin '#{name}' is NOT installed.\"\n puts 'Please run:'\n puts \"\\tvagrant plugin install #{name}\"\n exit(1)\nend", "def has_plugin?(name)\n true\n end", "def may_destroy?\n return plugins.length == 1;\n end", "def handled?\n handled\n end", "def current_plugin?\n if Origen.application_loaded?\n Origen.app.plugins.current == self\n else\n puts <<-END\ncurrent_plugin? cannot be used at this point in your code since the app is not loaded yet.\n\nIf you are calling this from config/application.rb then you can only use current_plugin? within a block:\n\n# Not OK\nif current_plugin?\n config.output_directory = \"#{Origen.root}/output/dir1\"\nelse\n config.output_directory = \"#{Origen.root}/output/dir2\"\nend\n\n# OK\nconfig.output_directory do\n if current_plugin?\n \"#{Origen.root}/output/dir1\"\n else\n \"#{Origen.root}/output/dir2\"\n end\nend\n\nEND\n exit 1\n end\n end", "def stop_hooks_unless(result)\n\t\t\t\t\t(result == true) ? continue(true) : stop(false)\n\t\t\t\tend", "def plugin_enabled?(plugin_name)\n !!@config['plugins'][plugin_name]\n end", "def disabled_main_command?\r\n return false\r\n end", "def disabled_main_command?\r\n return false\r\n end", "def start_plugin\n @active = true\n end", "def run\n ok = true\n plugins.each do |plugin|\n next unless plugin.options.enable\n begin\n # we don't snap unless all plugin.before calls return a truthy value\n unless plugin.before\n plugin.options.enable = false\n ok = false\n end\n rescue => e\n logger.error \"Encountered error while running the #{plugin.name} plugin's before hook\"\n logger.error e\n end\n end\n\n take_snapshots if ok\n\n plugins.each do |plugin|\n begin\n plugin.after if plugin.options.enable\n rescue => e\n logger.error \"Encountered error while running the #{plugin.name} plugin's after hook\"\n logger.error e\n end\n end\n end", "def allow_continue?\n false\n end", "def disabled_main_command?\r\n # If Continue is Selected\r\n if @command_window.command == SDK::Scene_Commands::Scene_Title::Continue\r\n return true unless @continue_enabled\r\n end\r\n return false\r\n end", "def cancelable?\n !part_of_bundle? && super\n end", "def fall_back\n say 'Xin lỗi! Chúng tôi không biết lựa chọn của bạn. Xin vui lòng thử lại' unless text_message?\n return false unless !text_message? || stop_word_used?('Stop')\n stop_chuyenkhoan\n puts 'Fallback triggered!'\n true # to trigger return from the caller on 'and return'\n end", "def is_plugin(name)\n if Vagrant.has_plugin?(name)\n puts \"using #{name}\"\n else\n puts \"please run vagrant plugin install #{name}\"\n exit(1)\n end\nend", "def stop\n true\n end", "def stop\n true\n end", "def stop\n true\n end", "def stop\n true\n end", "def proceed?(global_options,command,options,arguments) #:nodoc:\n if command && command.skips_pre\n true\n elsif @@pre_block\n @@pre_block.call(global_options,command,options,arguments)\n else\n true\n end\n end", "def receive_message\n true\n end", "def ok_enabled?; handle?(:ok); end", "def on!\n return false\n end", "def plugin_disabled?\n if config['enabled']\n false\n else\n true\n end\n end", "def check_plugin(name, message, admins, backlog) #checks an individual plugin's (by name) regex against message\n\n \t\tif @plugins.length == 0\n\t\t\treturn \"\"\n\t\tend\n\n\t\tif !plugin_loaded(name)\n\t\t\treturn \"\"\n\t\telse\n\t\t\tif message['text'].match(get_plugin(name).regex) and (get_plugin(name).chans.include? \"any\" or get_plugin(name).chans.include? message['channel'])\n\t\t\t\tbegin\n\t\t\t\t\treturn get_plugin(name).script(message, admins, backlog) # plugins use the IRC_message object\n\t\t\t\trescue => e\n\t\t\t\t\treturn \"an error occured for plugin: #{name}\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\treturn \"\"\n\tend", "def phase3_basic_command_disabled?\r\n return false\r\n end", "def message?\n false\n end", "def run\n false\n end", "def stop?\n @stop_called.value\n end", "def plugin_disabled?\n if config['enabled']\n false\n else\n true\n end\n end", "def plugin_loaded(name)\n\n\t\tif @plugins.length == 0\n\t\t\treturn false\n\t\tend\n\n\t\t@plugins.each do |a|\n\t\t\tif a.name == name\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\n\t\treturn false\n\tend", "def stop?\n @exit == true\n end", "def stop?\n @exit == true\n end", "def stop?\n @exit == true\n end", "def halt?\n @halt\n end", "def output\n @plugin_output ||= if @event.at('plugin_output')\n @event.at('plugin_output').inner_text\n else\n false\n end\n end", "def ok_enabled?\r\n return true\r\n end", "def enable_plugin(plugin_name)\n if @plugin_message_channels[plugin_name]; server.logger.warn(\"#{plugin_name} is already enabled!\"); return; end\n unless @active_plugins[plugin_name]; server.logger.error(\"#{plugin_name} is not a loaded plugin!\"); return; end\n\n channel = @plugin_message_channels[plugin_name] = Thread::Channel.new\n plugin = @active_plugins[plugin_name]\n\n # Enabled callback\n plugin.enabled\n\n plugin.class.event_handlers.each_key do |event_name|\n @event_message_channels[event_name] << channel\n end\n\n plugin.class.command_handlers.each_key do |command_name|\n @command_message_channels[command_name] << channel\n end\n\n @plugin_worker_threads[plugin_name] = Thread.new do\n while message = channel.receive\n break if message == :stop\n\n begin\n type, *params = message\n\n if type == :command\n command_name = plugin.class.command_handlers[params.shift]\n plugin.current_args = params.shift\n plugin.send command_name\n elsif type == :event\n event_name = plugin.class.event_handlers[params.shift]\n plugin.current_args = params.shift\n plugin.send event_name\n else\n @logger.error { \"#{type} is not a valid plugin message!\" }\n end\n rescue Exception => e\n @@logger.error \"Exception in plugin: #{e.message} (#{e.class})\"\n @@logger.error (e.backtrace || [])[0..10].join(\"\\n\")\n end\n end\n end\n end", "def stop?\n @stop\n end", "def started?\n @continue\n end", "def stop\n setup unless running\n\n within_preserved_state do\n ::Guard::UI.debug 'Guard stops all plugins'\n runner.run(:stop)\n ::Guard::Notifier.turn_off\n ::Guard::UI.info 'Bye bye...', reset: true\n listener.stop\n @running = false\n end\n end", "def run_at_exit_hooks?\n value = self['resque.run_at_exit_hooks']\n\n if value.is_a?(String) && %w(n no false off disabled).include?(value)\n value = false\n end\n\n value.nil? ? true : value\n end", "def process_handling\n super\n #return unless cursor_movable?\n #return process_confirm if handle?(:confirm) && Input.trigger?(:X)\n end", "def running?\n super\n end", "def running?\n super\n end", "def handled?\n\t\treturn ! @status.nil?\n\tend", "def plugin_disabled?(plugin)\n site.disabled_plugins.find do |p|\n p.gsub(/_/, '').downcase == plugin.class.name.gsub(/_/, '').downcase\n end\n end", "def is_plugin?\n return true if (Sessions.type(session[:session_id]) == \"Administrator\" and Sessions.is_plugin?(session[:session_id]) == true)\nend", "def finish\n true\n end", "def stop?\n !!@stop\n end", "def load(path)\n path = path.sub(%r{/main$}, '')\n files = [File.join(@dir, path, 'main.rb'), File.join(@dir, \"#{path}.rb\")].select {|file| File.file?(file) }\n if files.size == 2\n Olelo.logger.error \"Duplicate plugin #{files.join(', ')}\"\n return false\n end\n return false if files.empty?\n\n if @loaded.include?(path)\n true\n elsif @failed.include?(path) || !enabled?(path)\n false\n else\n begin\n new(path, files.first)\n true\n rescue Exception => ex\n @failed << path\n if LoadError === ex\n Olelo.logger.warn \"Plugin #{path} could not be loaded due to: #{ex.message} (Missing gem?)\"\n else\n Olelo.logger.error \"Plugin #{path} could not be loaded due to: #{ex.message}\"\n Olelo.logger.debug ex\n end\n @loaded.delete(path)\n false\n\t end\n end\n end", "def postprocess\n return false if @@processed\n @@processed = true # Make sure this runs only once\n\n # Parses:\n # commands do\n # allow :kill \n # allow :custom_script, '/full/path/2/custom_script'\n # allow :git_clone, '/usr/bin/git', 'clone'\n # end\n # \n # * Tells Routines to force_array on the command name.\n # This is important b/c of the way we parse commands \n self.allow.each do |cmd|\n cmd, *args = *cmd\n \n ## Currently disabled\n ##raise AlreadyDefined.new(:commands, cmd) if @@allowed.member?(cmd)\n ##@@allowed << cmd\n \n # We can allow existing commands to be overridden but we\n # print a message to STDERR so the user knows what's up.\n if Rye::Cmd.can?(cmd)\n Rudy::Huxtable.ld \"Redefining #{cmd}\" if Rudy::Huxtable.global.verbose > 2\n end\n \n if args.last.is_a?(Proc)\n block = args.pop\n Rye::Cmd.add_command(cmd, nil, *args, &block)\n else\n # If no path was specified, we can assume cmd is in the remote path so\n # when we add the method to Rye::Cmd, we'll it the path is \"cmd\".\n path = args.shift || cmd.to_s\n \n raise PathNotString.new(:commands, cmd) if path && !path.is_a?(String)\n \n Rye::Cmd.add_command cmd, path, *args\n \n end\n \n \n ## We cannot allow new commands to be defined that conflict use known\n ## routines keywords. This is based on keywords in the current config.\n ## NOTE: We can't check for this right now b/c the routines config\n ## won't necessarily have been parsed yet. TODO: Figure it out!\n ##if Caesars.known_symbol_by_glass?(:routines, cmd)\n ## raise ReservedKeyword.new(:commands, cmd)\n ##end\n \n end\n \n ## NOTE: We now process command blocks as Procs rather than individual commands.\n ## There's currently no need to ForceRefresh here\n ##raise Caesars::Config::ForceRefresh.new(:routines)\n end", "def handleAction evt, action, caller\n # DO NOTHING - this method shall be implemented by the children\n return false\n end", "def start_routine\n \tunless download!\n \t\tRails.logger.error 'Download subroutine failed'\n \t\treturn false\n \tend\n \tunless process!(non_optimized)\n \t\tRails.logger.error 'Process subroutine failed'\n \t\treturn false\n \tend\n unless process_plain_text!\n Rails.logger.error 'Process plain text subroutine failed'\n return false\n end\n \tunless upload!\n \t\tRails.logger.error 'Upload subroutine failed'\n \t\treturn false\n \tend\n \tunless clean_up!(non_optimized)\n \t\tRails.logger.error 'Clean up subroutine failed'\n \t\treturn false\n \tend\n\n \treturn true\n end", "def stop?(*) end", "def handled!; @handled = true; end", "def validate\n if (errors.empty?) then \n if (plugin.nil?) then \n errors.add_to_base(\"Plugin may not be nil\"); \n elsif (plugin.new_record?) then \n errors.add_to_base \"Can't attach to unsaved plugin #{plugin.name}\" \n end \n end\n end", "def callback\n false\n end", "def validateHandin()\n updateModules()\n # Partners stand alone, they don't affect others\n if @modulesUsed.include?(\"Partners\") then\n if ! partnersValidateHandin() then\n return false\n end\n end\n \n # If we're validating for svn, we don't have a file to check\n if @modulesUsed.include?(\"Svn\") then\n if ! svnValidateHandin() then\n return false\n end\n else\n if ! super() then\n return false\n end\n end\n return true\n end", "def phase2_command_disabled?\r\n # If Escape Selected\r\n if @party_command_window.command == \r\n SDK::Scene_Commands::Scene_Battle::Escape\r\n # If it's not possible to escape\r\n return true unless $game_temp.battle_can_escape\r\n end\r\n return false\r\n end", "def halted?\n @halt\n end", "def run?\n return false unless @process\n return true\n end", "def plugin_manager; end", "def finish\n unless @config[:plugins].nil?\n @config[:plugins].each do |plugin_name|\n eval(\"#{plugin_name.to_s}.finish(@config)\")\n end\n end\n end", "def execute(plugin)\n return [true,\"\"] if @lines.empty?\n \n result = @lines.each {|line|\n res = plugin.execute(@logger, *line)\n\n if !res\n @logger.call(\"COMMAND not found: #{line.join(\" \")}.\") if @logger\n\n res = [false, \"COMMAND not found: #{line.join(\" \")}.\"]\n else\n if res.code == 0\n res = [true, \"\"]\n else\n res = [false, get_error_message(res.stderr)]\n end\n end\n\n # do not continue if command failed\n break res if !res[0]\n }\n \n result\n end", "def fall_back\n say 'You tried to fool me, human! Start over!' unless text_message?\n return false unless !text_message? || stop_word_used?('Stop')\n stop_questionnaire\n puts 'Fallback triggered!'\n true # to trigger return from the caller on 'and return'\n end", "def success?\n # if something # possibility of event interception?\n # self.activate\n # end\n if !@active\n return false\n end\n @active = false\n return true\n end", "def plugins; end", "def plugins; end", "def plugins; end", "def plugins; end", "def execute\n return unless active\n process_outbound_ack\n deactivate(@flag)\n end", "def run\n unknown 'Not implemented! You should override Sensu::Plugin::CLI#run.'\n end", "def in_plugin_path?(path)\n # get the directory where we plan to stick the plugin (not the actual file path)\n desired_dir = ::File.directory?(path) ? path : ::File.dirname(path)\n\n case node['platform']\n when 'windows'\n ::Ohai::Config.ohai['plugin_path'].map(&:downcase).include?(desired_dir.downcase)\n else\n ::Ohai::Config.ohai['plugin_path'].include?(desired_dir)\n end\n end", "def punch_out_order_message?\n !punch_out_order_message.nil?\n end", "def validate!\n errors = validate\n\n if errors.any?\n ErrorHandler.wrap PluginSyntaxError,\n backtrace: [],\n plugin_name: try(:name),\n plugin_version: try(:version),\n text: messages_from_errors(errors)\n end\n\n self\n end", "def stop\n raise NotImplementedError.new(\"Implement stop() in your Invoker. \")\n end", "def load_plugins; end", "def stop\n if self.started\n _dispose!\n self.started = false\n true\n else\n false\n end\n end", "def plugin_enabled_with_engine_additions?(path)\r\n Engines.load_all_plugins? || plugin_enabled_without_engine_additions?(path)\r\n end", "def running?\n !@stop\n end", "def execute\n return unless active\n process_outbound_messages\n end", "def run?\n return false unless @process\n return true\n end", "def poll_plugin_pids\n @plugins.each do |pid,plugin|\n if plugin.done?\n plugin_hash = plugin.to_hash\n msg = Hastur::Message::HB::PluginV1.new(\n :from => @uuid,\n :data => {\n :name => plugin_hash[:name],\n :value => nil, # should this be the resultcode?\n :timestamp => nil, # take the default\n :labels => plugin_hash\n }\n )\n _send msg\n # TODO: call plugin.stat (when it's ready) and send along a stat too\n @plugins.delete pid\n end\n end\n end", "def method_missing(method_name, *args, &block)\n if method_name[-1] == '!'\n output = super\n throw :turn_done\n else\n output = super \n end\n output\n end", "def can_process_cmd?\n settings.queue.empty?\n end", "def each_plugin(&block); end", "def plugin_setup!; end", "def disable_until_finished_or_interrupted; end", "def destroy_failed_jobs?\n return true\n end" ]
[ "0.6325551", "0.62367857", "0.6164796", "0.60785544", "0.6007291", "0.5962489", "0.5795329", "0.5782844", "0.5770373", "0.5750689", "0.5722477", "0.57117766", "0.5711286", "0.5685568", "0.56665176", "0.5653379", "0.5589711", "0.5587254", "0.5587254", "0.55451167", "0.5534572", "0.5522561", "0.55159044", "0.54965776", "0.5490338", "0.5487773", "0.5462759", "0.5462759", "0.5462759", "0.5462759", "0.54617256", "0.5444941", "0.54431975", "0.5406159", "0.54052055", "0.5398267", "0.53973573", "0.537595", "0.53584146", "0.5356044", "0.5352002", "0.5349373", "0.5348039", "0.5348039", "0.5348039", "0.5341716", "0.5339035", "0.533376", "0.53098714", "0.5305104", "0.53019774", "0.5297756", "0.52963626", "0.5273713", "0.5262571", "0.5262571", "0.52590793", "0.5249062", "0.5248939", "0.52437425", "0.52432966", "0.5233185", "0.52293974", "0.5225361", "0.5206688", "0.5205362", "0.5202739", "0.5201203", "0.51982147", "0.5195919", "0.51948035", "0.5176482", "0.5176384", "0.5170881", "0.5170879", "0.5167007", "0.51658535", "0.51500577", "0.5142364", "0.5142364", "0.5142364", "0.5142364", "0.51406175", "0.51305944", "0.5128836", "0.5121441", "0.511017", "0.51078534", "0.5102946", "0.51025885", "0.51011187", "0.5091917", "0.50894403", "0.5086341", "0.5064786", "0.50625783", "0.5059184", "0.5056835", "0.50537366", "0.50507516", "0.50502616" ]
0.0
-1
Returns a list of messages describing the commands this plugin handles.
def usage matchers.map do |regexp, options, action, description| next unless description if options[:sent_to_me] at_nick + " " + description else description end end.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commands\r\n @help_commands\r\n end", "def supported_commands\n commands.keys\n end", "def commands\n help_list = {}\n @commands.map do |cmd|\n info = Commands.const_get(\"#{cmd}\".capitalize!).info #=> {cmd => \"Description\"}\n help_list[info.keys.first] = info.values.first\n end\n\n return help_list\n end", "def commands_command(stem, sender, reply_to, msg)\n commands = self.class.instance_methods.select { |m| m =~ /^\\w+_command$/ }\n commands.map! { |m| m.to_s.match(/^(\\w+)_command$/)[1] }\n commands.reject! { |m| UNADVERTISED_COMMANDS.include? m }\n return if commands.empty?\n commands.map! { |c| \"#{options[:command_prefix]}#{c}\" }\n \"Commands for #{leaf_name}: #{commands.sort.join(', ')}\"\n end", "def commands\n COMMANDS\n end", "def commands\n {\n \"sample\" => \"A sample command added by the sample plugin\",\n \"notifier_start\" => \"Start session watcher\",\n \"notifier_stop\" => \"Stop session watcher\",\n \"notifier_set_user\" => \"Set Dashboard user name\",\n \"notifier_set_pass\" => \"Set Dashboard password\",\n \"notifier_set_dashboard_url\" => \"Set Dashboard base URL\",\n \"notifier_show_config\" => \"Show notifier config\",\n \"notifier_dashboard_login\" => \"Log in to dashboard\",\n \"notifier_dashboard_permissions\" => \"Get dashbaord user permissions\"\n }\n end", "def cmd_cmds\n puts self.methods.grep(/^cmd_/).map {|m| m[4..-1]} * \" \"\n end", "def commands_list\n out = \"\"\n # If there are no commands set\n if COMMANDS.empty?\n out << \" ooops! commands are not here!\"\n else\n # Get the longest command's name, so we can output it nice 'n' clean\n # This '+ int' at the end is a distance (in spaces) from the longest\n # command to descriptions\n longest = COMMANDS.max_by(&:size).size + 8\n COMMANDS.each do |cmd|\n # Calc, calc.\n spaces = longest - cmd.size\n # Check if there is a 'desc' method\n desc = if eval \"Command::#{cmd}.new.respond_to? 'desc'\"\n # If there is - execute it\n eval \"Command::#{cmd}.new.desc\"\n else\n # If there is not\n \"---\"\n end\n out << \" \" << cmd.downcase.to_s << \" \" * spaces << desc\n # If this command is the last one, don't make a new line\n unless cmd == COMMANDS.last\n out << \"\\n\"\n end\n end\n end\n out\n end", "def commands\n unless defined? @commands\n @commands = []\n end\n return @commands\n end", "def command_names\n commands.map &:name\n end", "def commands\n @commands.keys.sort\n end", "def commands\n @commands ||= []\n end", "def get_commands\n return nil\n end", "def commands\n self.class.command_classes\n end", "def list_commands\n puts template(:all, {\n app: File.basename(@app),\n\n cmds: ::WeatherSage::CLI::Help::COMMANDS.values.map { |cmd|\n template(:cmd, cmd)\n }.join(\"\\n\"),\n\n envs: ::WeatherSage::CLI::Env::VARS.map { |row|\n template(:env, row)\n }.join(\"\\n\\n\"),\n })\n end", "def commands\n\t\t{\n\t\t\t\"execute\" => \"Execute a command\",\n\t\t\t\"shell\" => \"Drop into a system command shell\",\n\t\t}\n\tend", "def all_commands\n [client_commands, server_commands].flatten\n end", "def commands\n\t\t\t\t{\n\t\t\t\t\t'notify_help'\t\t\t\t\t=> \"Displays help\",\n\t\t\t\t\t'notify_start'\t\t\t\t=> \"Start Notify Plugin after saving settings.\",\n\t\t\t\t\t'notify_stop'\t\t\t\t\t=> \"Stop monitoring for new sessions.\",\n\t\t\t\t\t'notify_test'\t\t\t\t\t=> \"Send test message to make sure confoguration is working.\",\n\t\t\t\t\t'notify_save'\t\t\t\t\t=> \"Save Settings to YAML File #{Notify_yaml}.\",\n\t\t\t\t\t'notify_set_webhook'\t=> \"Sets Slack Webhook URL.\",\n\t\t\t\t\t'notify_set_user'\t\t\t=> \"Set Slack username for messages.\",\n\t\t\t\t\t'notify_set_source'\t\t=> \"Set source for identifying the souce of the message.\",\n\t\t\t\t\t'notify_show_options'\t=> \"Shows currently set parameters.\",\n\n\t\t\t\t}\n\t\t\tend", "def command_list m\n get_list escape m.channel.to_s #logic/pug\n end", "def commands\n\t\t\t\t{\n\t\t\t\t\t'notify_help'\t\t\t\t\t\t\t\t=> \"Displays help\",\n\t\t\t\t\t'notify_start'\t\t\t\t\t\t\t=> \"Start Notify Plugin after saving settings.\",\n\t\t\t\t\t'notify_stop'\t\t\t\t\t\t\t\t=> \"Stop monitoring for new sessions.\",\n\t\t\t\t\t'notify_test'\t\t\t\t\t\t\t\t=> \"Send test message to make sure confoguration is working.\",\n\t\t\t\t\t'notify_save'\t\t\t\t\t\t\t\t=> \"Save Settings to YAML File #{Notify_yaml}.\",\n\t\t\t\t\t'notify_set_webhook'\t\t\t\t=> \"Sets Slack Webhook URL.\",\n\t\t\t\t\t'notify_set_user'\t\t\t\t\t\t=> \"Set Slack username for messages.\",\n\t\t\t\t\t'notify_show_parms'\t\t\t \t=> \"Shows currently set parameters.\"\n\n\t\t\t\t}\n\t\t\tend", "def commands\n\n {\n 'TODO' => \"This one shout take its sub commands from current(headers/body) variables and the key value should be the command description\n This one should depend on current context\"\n }\n\n end", "def commands\n {}\n end", "def commands\n\t\t{\n\t\t\t\"?\" => \"Help menu\",\n\t\t\t\"background\" => \"Backgrounds the current session\",\n\t\t\t\"close\" => \"Closes a channel\",\n\t\t\t\"channel\" => \"Displays information about active channels\",\n\t\t\t\"exit\" => \"Terminate the meterpreter session\",\n\t\t\t\"help\" => \"Help menu\",\n\t\t\t\"interact\" => \"Interacts with a channel\",\n\t\t\t\"irb\" => \"Drop into irb scripting mode\",\n\t\t\t\"migrate\" => \"Migrate the server to another process\",\n\t\t\t\"use\" => \"Load a one or more meterpreter extensions\",\n\t\t\t\"quit\" => \"Terminate the meterpreter session\",\n\t\t\t\"read\" => \"Reads data from a channel\",\n\t\t\t\"run\" => \"Executes a meterpreter script\",\n\t\t\t\"bgrun\" => \"Executes a meterpreter script as a background thread\",\n\t\t\t\"bgkill\" => \"Kills a background meterpreter script\",\n\t\t\t\"bglist\" => \"Lists running background scripts\",\n\t\t\t\"write\" => \"Writes data to a channel\",\n\t\t}\n\tend", "def commands\n\t\tall = {\n\t\t\t\"webcam_list\" => \"List webcams\",\n\t\t\t\"webcam_snap\" => \"Take a snapshot from the specified webcam\",\n\t\t\t\"record_mic\" => \"Record audio from the default microphone for X seconds\"\n\t\t}\n\t\treqs = {\n\t\t\t\"webcam_list\" => [ \"webcam_list\" ],\n\t\t\t\"webcam_snap\" => [ \"webcam_start\", \"webcam_get_frame\", \"webcam_stop\" ],\n\t\t\t\"record_mic\" => [ \"webcam_record_audio\" ],\n\t\t}\n\n\t\tall.delete_if do |cmd, desc|\n\t\t\tdel = false\n\t\t\treqs[cmd].each do |req|\n\t\t\t\tnext if client.commands.include? req\n\t\t\t\tdel = true\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\tdel\n\t\tend\n\n\t\tall\n\tend", "def list_commands\n Invoker::ProcessPrinter.to_json(workers)\n end", "def commands\n\t\t\t\t{\n\t\t\t\t\t'notify_pushover_help'\t\t\t\t\t=> \"Displays help\",\n\t\t\t\t\t'notify_pushover_start'\t\t\t\t\t=> \"Start notify_pushoverer plugin after saving settings.\",\n\t\t\t\t\t'notify_pushover_stop'\t\t\t\t\t=> \"Stop notifying for new sessions.\",\n\t\t\t\t\t'notify_pushover_test'\t\t\t\t\t=> \"Send test message to make sure configuration is working.\",\n\t\t\t\t\t'notify_pushover_save'\t\t\t\t\t=> \"Save Settings to YAML File #{Notify_pushover_yaml}.\",\n\t\t\t\t\t'notify_pushover_set_app_key'\t\t\t=> \"Sets pushover app API key.\",\n\t\t\t\t\t'notify_pushover_set_user_key'\t \t\t=> \"Sets pushover user(s) key.\",\n\t\t\t\t\t'notify_pushover_show_parms'\t\t\t=> \"Shows currently set parameters.\"\n\t\t\t\t}\n\t\t\tend", "def command_list\n collect_do - subcommand_list\n end", "def get_commands\n %w{ testchoosedir testchoosefile testnumberedmenu testdisplay_list testdisplay_text testdir }\n end", "def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end", "def previewed_commands\n @commands.map { |cmd| embed_command(cmd) }\n end", "def commands\n c = {\n \"?\" => \"Help menu\",\n \"background\" => \"Backgrounds the current session\",\n \"exit\" => \"Terminate the hardware bridge session\",\n \"help\" => \"Help menu\",\n \"irb\" => \"Drop into irb scripting mode\",\n \"load\" => \"Load one or more meterpreter extensions\",\n \"run\" => \"Executes a meterpreter script or Post module\",\n \"bgrun\" => \"Executes a meterpreter script as a background thread\",\n \"bgkill\" => \"Kills a background meterpreter script\",\n \"bglist\" => \"Lists running background scripts\",\n \"sessions\" => \"Quickly switch to another session\",\n \"status\" => \"Fetch bridge status information\",\n \"specialty\" => \"Hardware devices specialty\",\n \"reset\" => \"Resets the device (NOTE: on some devices this is a FULL FACTORY RESET)\",\n \"reboot\" => \"Reboots the device (usually only supported by stand-alone devices)\",\n \"load_custom_methods\" => \"Loads custom HW commands if any\"\n }\n\n if msf_loaded?\n c[\"info\"] = \"Displays information about a Post module\"\n end\n\n c\n end", "def commands\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end", "def commands\n\t\t\t\t{\n\t\t\t\t\t'twitt_help'\t\t\t\t\t=> \"Displays help\",\n\t\t\t\t\t'twitt_start'\t\t\t\t\t=> \"Start Twitter Plugin after saving settings.\",\n\t\t\t\t\t'twitt_stop'\t\t\t\t\t=> \"Stop monitoring for new sessions.\",\n\t\t\t\t\t'twitt_test'\t\t\t\t\t=> \"Send test message to make sure confoguration is working.\",\n\t\t\t\t\t'twitt_save'\t\t\t\t\t=> \"Save Settings to YAML File #{Twitter_yaml}.\",\n\t\t\t\t\t'twitt_set_consumer_key'\t\t=> \"Sets Twitter Consumer Key.\",\n\t\t\t\t\t'twitt_set_consumer_secret'\t \t=> \"Sets Consumer Secret.\",\n\t\t\t\t\t'twitt_set_oauth_token'\t\t \t=> \"Sets Oauth Token.\",\n\t\t\t\t\t'twitt_set_oauth_token_secret' => \"Sets Oauth Token Secret\",\n\t\t\t\t\t'twitt_set_user'\t\t\t\t=> \"Sets User to whom messages will be sent.\",\n\t\t\t\t\t'twitt_set_source'\t\t\t \t=> \"Sets Source Name from where the messages are sent.\",\n\t\t\t\t\t'twitt_show_parms'\t\t\t \t=> \"Shows currently set parameters.\"\n\n\t\t\t\t}\n\t\t\tend", "def printable_commands(*)\n item = []\n item << banner\n item << (desc ? \"# #{desc.gsub(/\\s+/m, ' ')}\" : \"\")\n [item]\n end", "def get_commands\n %w{ testchoose testnumberedmenu testdisplay_list testdisplay_text testdir saveas1 }\n end", "def commands\n @commands ||= [].tap do |c|\n commands_list.each do |command|\n if command.instance_of? String\n c << standard_commands[command].new\n else\n ret_command = send(command)\n c << (ret_command.instance_of?(Hash) ? ret_command.values : ret_command)\n end\n end\n end.flatten\n end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def valid_commands\n methods.grep(/_command$/).map {|c| c.to_s.gsub(\"_command\", \"\")}\n end", "def commands\n cmds = []\n command_groups = self.template.command_groups\n command_groups.each do |c|\n commands = c.command_group_commands\n commands.each do |cmd|\n cmds << OpenStruct.new( :cmd_id => cmd.id, :name => cmd.Description, :params => cmd.parameters )\n end\n end\n cmds\n end", "def handle_help\n self.methods.grep(/^handle_(.*?)/).map {|m| m.to_s.sub(/^(.*?)_/, '')}\n end", "def command_list\n options[:commands] || SimpleFormEpicEditor::EpicEditorInput.configuration.commands\n end", "def commands\n\t\t{\n\t\t\t\"cat\" => \"Read the contents of a file to the screen\",\n\t\t\t\"cd\" => \"Change directory\",\n\t\t\t\"download\" => \"Download a file or directory\",\n\t\t\t\"edit\" => \"Edit a file\",\n\t\t\t\"getwd\" => \"Print working directory\",\n\t\t\t\"ls\" => \"List files\",\n\t\t\t\"mkdir\" => \"Make directory\",\n\t\t\t\"pwd\" => \"Print working directory\",\n\t\t\t\"rmdir\" => \"Remove directory\",\n\t\t\t\"upload\" => \"Upload a file or directory\",\n\t\t\t\"lcd\" => \"Change local working directory\",\n\t\t\t\"getlwd\" => \"Print local working directory\",\n\t\t\t\"lpwd\" => \"Print local working directory\",\n\t\t\t\"rm\" => \"Delete the specified file\",\n\t\t\t\"del\" => \"Delete the specified file\",\n\t\t\t\"search\" => \"Search for files\"\n\t\t}\n\tend", "def commands\n\t\t{\n\t\t\t\"add_user\" => \"Attempt to add a user with all tokens\",\n\t\t\t\"add_localgroup_user\" => \"Attempt to add a user to a local group with all tokens\",\n\t\t\t\"add_group_user\" => \"Attempt to add a user to a global group with all tokens\",\n\t\t\t\"list_tokens\" => \"List tokens available under current user context\",\n\t\t\t\"impersonate_token\" => \"Impersonate specified token\",\n\t\t\t\"snarf_hashes\" => \"Snarf challenge/response hashes for every token\"\n\t\t}\n\tend", "def help\n @@commands.each do |command| \n puts command[0]\n puts \" `#{command[1]}\"\n end \n end", "def commands\n return [] unless options[\"commands\"]\n options[\"commands\"].map do |options|\n options['parents'] = parents + [name]\n Command.new options\n end\n end", "def subcommands\n Properties[self.class] ||= {}\n return Properties[self.class][:subcmds] || []\n end", "def subcommand_list\n return '' unless subcommand?\n\n invoking_command = File.basename($0) # could be rspec, etc\n command_list = subcommand_class.printable_commands\n .sort_by { |a| a[0] }\n .map { |a| a[0].sub!(invoking_command, cli_name); a } # replace with proper comand\n .reject { |a| a[0].include?(\"help [COMMAND]\") } # filter out help\n\n # dress up with markdown\n text = command_list.map do |a|\n command, comment = a[0], a[1].sub(/^# /,'')\n subcommand_name = command.split(' ')[2]\n full_command_path = \"#{cli_name}-#{@command_name}-#{subcommand_name}\"\n full_command_name = \"#{cli_name} #{@command_name} #{subcommand_name}\"\n link = \"_reference/#{full_command_path}.md\"\n\n # \"* [#{command}]({% link #{link} %})\"\n # Example: [lono cfn delete STACK]({% link _reference/lono-cfn-delete.md %})\n \"* [#{full_command_name}]({% link #{link} %}) - #{comment}\"\n end.join(\"\\n\")\n\n <<-EOL\n## Subcommands\n\n#{text}\nEOL\n end", "def commands\n {\n 'help' => 'Help menu',\n 'background' => 'Backgrounds the current shell session',\n 'sessions' => 'Quickly switch to another session',\n 'resource' => 'Run a meta commands script stored in a local file',\n 'shell' => 'Spawn an interactive shell (*NIX Only)',\n 'download' => 'Download files (*NIX Only)',\n 'upload' => 'Upload files (*NIX Only)',\n 'source' => 'Run a shell script on remote machine (*NIX Only)',\n 'irb' => 'Open an interactive Ruby shell on the current session',\n 'pry' => 'Open the Pry debugger on the current session'\n }\n end", "def available_commands_string\n @available_commands.join(', ')\n end", "def commands\n load_commands unless @commands\n @commands\n end", "def get_commands_message is_admin = false\n \n message = \"*JudeBot* - This bot helps you add assignments to your calendar.\\n\"\n message += \"*Commands:* \\n\"\n \n @@jude_bot_commands.each do |c|\n if c[:is_admin] == false or (c[:is_admin] == true and is_admin)\n message += c[:message] + \"\\n\"\n end\n end\n\n message\n end", "def command_help\n display_possible_actions\n end", "def client_commands\n @client_commands ||= []\n end", "def commands\n @@commands.dup\n end", "def help\n return PongBot::Messages.help_command_message\n end", "def check_command_plugins(msg)\n @command_plugins.each do |name, block, options|\n begin\n if name =~ /^!/\n if msg =~ /^#{name}\\b/\n msg = msg.gsub(/!\\S+\\s*/, \"\")\n block.call(msg)\n end\n else\n block.call(msg)\n end\n rescue Exception => e\n reply \"Error: #{e.class}\"\n e.dump(@current_server.logger)\n end\n end\n end", "def commands\n self.class.commands\n end", "def commands\n ensure_cache_up_to_date\n commands = self.redis.keys(\"bluster:objects:command:*\")\n commands.map! { |r| r.split(\":\")[3] }\n commands.uniq\n end", "def commands\n {\n }\n end", "def command_list\n options[:commands] || SimpleFormWysihtml::WysihtmlInput.configuration.commands\n end", "def subcommands_presentation\n return nil unless command.commands.size > 0\n command.commands.values.uniq.map(&:summarize).join(\"\\n\")\n end", "def printable_commands(all = true, subcommand = false)\n (all ? all_commands : commands).map do |_, command|\n next if command.hidden?\n item = []\n item << banner(command, false, subcommand)\n item << (command.description ? \"# #{command.description.gsub(/\\s+/m, ' ')}\" : \"\")\n item\n end.compact\n end", "def commands\n {\n \"power_shell\" => \"Execute a powershell command.\",\n \"power_view\" => \"Download and execute Veil's PowerView Framework\",\n \"power_up\" => \"Download and execute the PowerUp Framework\",\n \"power_katz\" => \"Invoke-Mimikatz into memory using PowerShell\",\n \"power_scan\" => \"Invoke-PortScan from meterpreter using PowerShell\"\n }\n end", "def help\n [['some command', 'description of some command'],\n ['some other command', 'description of some other command']]\n end", "def commands\n {\n # meta commands\n 'dradis_config' => \"Show Dradis API configuration (#{config_file})\",\n 'dradis_help'\t => 'Displays help',\n 'dradis_version' => 'Displays version information',\n\n # API commands\n 'dradis_add_node' => 'Add a new Node to dradis',\n 'dradis_nodes' => 'List all nodes'\n }\n end", "def help\n messages = ['- Help -']\n max_command_length = ConsoleProgram.scopes.active.map{|key| @@commands[key].keys }.flatten.map(&:length).max\n max_alias_length = ConsoleProgram.scopes.active\n .map{|key| @@commands[key].values }\n .flatten.uniq\n .map(&:alternate_commands)\n .compact.map{|alt| alt.join(', ') }\n .map(&:length).max\n ConsoleProgram.scopes.active.each_with_index do |key, index|\n messages << \"- #{key.to_s.titleize} Commands -\"\n @@commands[key].each do |name, klass|\n unless klass.hidden || (!klass.alternate_commands.nil? && klass.alternate_commands.include?(name))\n # /help - help - Help description.\n space = {}\n command = name\n space[:command] = ' ' * (max_command_length - name.length)\n aliases = klass.alternate_commands.nil? ? '' : klass.alternate_commands.join(', ')\n space[:alias] = ' ' * (max_alias_length - (klass.alternate_commands||[]).join(', ').length)\n help = klass.help\n messages << \"#{command}#{space[:command]} - #{aliases}#{space[:alias]} - #{help}\"\n end\n end\n messages << nil unless (index + 1) == ConsoleProgram.scopes.active.length\n end\n messages << nil\n end", "def undocumented_commands\n command_list - documented_commands\n end", "def find_all_commands (sCOMMAND)\n array = Array.new()\n @commands.each do |command|\n if (command.commandName == sCOMMAND)\n array.push(command)\n end\n end\n return array\n end", "def commands\n\t\t\t{\n\t\t\t\t\"wmap_website\" => \"List website structure\",\n\t\t\t\t\"wmap_targets\" => \"Targets in the database\",\n\t\t\t\t\"wmap_sql\" => \"Query the database\",\n\t\t\t\t\"wmap_run\" => \"Automatically test/exploit everything\",\n\t\t\t\t\"wmap_proxy\" => \"Run mitm proxy\",\n\t\t\t\t\"wmap_crawl\" => \"Crawl website\",\n\t\t\t\t\"wmap_attack\" => \"Crawl and Test\",\n\t\t\t}\n\t\tend", "def description\n\t\tdoCommandList.each do |commandItem|\n\t\t\tputs commandItem.description\n\t\tend\n\tend", "def command_presentation\n msg = []\n msg << command_header\n msg << \"Usage:\"\n msg << usage_presentation\n\n if opts = options_presentation\n msg << \"Options:\\n#{opts}\"\n end\n if subcommands = subcommands_presentation\n msg << \"Subcommands:\\n#{subcommands_presentation}\"\n end\n msg.join(\"\\n\\n\")\n end", "def available_subcommands\n self.class.available_subcommands\n end", "def available_subcommands\n self.class.available_subcommands\n end", "def list_commands\n puts UI_ARROW.light_yellow + \" \" + \"'fight', 'f', or 'battle' to view enemies and fight.\"\n puts UI_ARROW.light_yellow + \" \" + \"'armoury' or 'a' to go to the armoury.\"\n puts UI_ARROW.light_yellow + \" \" + \"'stats' to view your current status.\"\n puts UI_ARROW.light_yellow + \" \" + \"'clear' or 'cls' to clear the screen.\"\n puts UI_ARROW.light_yellow + \" \" + \"'quit', 'q', or 'exit' to abandon your journey.\"\nend", "def commands\n @commands.reject { |_, v| v.is_a? CommandLion::Option }\n end", "def help\n [['help', \"this message\"]]\n end", "def commands\n @aliases\n end", "def subcommands\n @subcommands ||= []\n end", "def subcommands\n @subcommands ||= []\n end", "def commands\n\t\t{\n\t\t\t\"idletime\" => \"Returns the number of seconds the remote user has been idle\",\n\t\t\t\"uictl\" => \"Control some of the user interface components\",\n\t\t\t\"enumdesktops\" => \"List all accessible desktops and window stations\",\n\t\t\t\"setdesktop\" => \"Move to a different workstation and desktop\",\n\t\t\t\"keyscan_start\" => \"Start capturing keystrokes\",\n\t\t\t\"keyscan_stop\" => \"Stop capturing keystrokes\",\n\t\t\t\"keyscan_dump\" => \"Dump they keystroke buffer\",\n\t\t\t\n\t\t\t# no longer needed with setdesktop\n\t\t\t# \"grabinputdesktop\" => \"Take over the active input desktop\",\n\t\t\t\n\t\t\t# not working yet\n\t\t\t# \"unlockdesktop\" => \"Unlock or lock the workstation (must be inside winlogon.exe)\",\n\t\t}\n\tend", "def list_categories\n msg(\"Classes of commands:\")\n CATEGORIES.keys.sort.each do |cat|\n msg(\"%-13s -- %s\" % [cat, CATEGORIES[cat]])\n end\n final_msg = '\nType \"help\" followed by a class name for a list of commands in that class.\nType \"help *\" for the list of all commands.\nType \"help REGEXP\" for the list of commands matching /^#{REGEXP}/\nType \"help CLASS *\" for the list of all commands in class CLASS.\nType \"help\" followed by command name for full documentation.\n'\n msg(final_msg) \n end", "def commands; end", "def list_commands(character, input=nil)\n \t\tcommands = COMMANDS.keys\n \t\t\n\t\tprint_line commands.join(?\\s)\n\t\tprint_line\n\tend", "def commands\n\t\t{\n\t\t\t\"idletime\" => \"Returns the number of seconds the remote user has been idle\",\n\t\t\t\"uictl\" => \"Control some of the user interface components\",\n\t\t\t\"enumdesktops\" => \"List all accessible desktops and window stations\",\n\t\t\t\"getdesktop\" => \"Get the current meterpreter desktop\",\n\t\t\t\"setdesktop\" => \"Change the meterpreters current desktop\",\n\t\t\t\"keyscan_start\" => \"Start capturing keystrokes\",\n\t\t\t\"keyscan_stop\" => \"Stop capturing keystrokes\",\n\t\t\t\"keyscan_dump\" => \"Dump the keystroke buffer\",\n\t\t\t\"screenshot\" => \"Grab a screenshot of the interactive desktop\",\n\n\t\t\t# not working yet\n\t\t\t# \"unlockdesktop\" => \"Unlock or lock the workstation (must be inside winlogon.exe)\",\n\t\t}\n\tend", "def registered_messages\n registered_methods = registers.map { |_, meth| meth if !meth.is_a?(Proc) }.compact\n all_registrations = registers.keys + instance_methods(false) - registered_methods\n\n all_registrations.map(&:to_s)\n end", "def help\n\tcommands = [\"I accept the following commands:\", \"- help : displays this help message\", \"- list : displays a list of songs you can play\", \"- play : lets you choose a song to play\", \"- exit : exits this program\"]\n\tcommands.each {|command| puts command}\nend", "def server_commands\n @server_commands ||= []\n end", "def commands\n\t\t{\n\t\t\t\"idletime\" => \"Returns the number of seconds the remote user has been idle\",\n\t\t\t\"uictl\" => \"Control some of the user interface components\"\n\t\t}\n\tend", "def commands\n {\n 'headers' => 'Show post headers.',\n 'body' => 'Show post body.',\n 'full_post' => 'Show full post, headers & body.'\n }\n end", "def commands\n\t\t{ }\n\tend", "def describe\n puts \"name: #{self.name}\"\n puts \"commands (#{self.commands.count}):\"\n\n self.commands.asc(:ordering_number).each do |command|\n puts \" ordering_number: #{command.ordering_number}\"\n puts \" job_name: #{command.job_name}\"\n puts \" input_from_command_with_number: #{command.input_from_command_with_number}\"\n puts \" create_media: #{command.create_media}\"\n command.options.each do |option|\n puts \"\\t key: #{option.key}\"\n puts \"\\t value: #{option.value}\"\n puts \"\\t param_key_name: #{option.params_key_name}\"\n end\n end\n nil\n end", "def help command\n puts \"\nThe command you entered, #{command}, is not supported.\nValid commands: \"\n @command_map.each_key{|key| puts \"\\t#{key}\\n\"}\n end", "def do_help(commands)\n return commands.usage\n end", "def matrix_command(message)\n pfx = @cmd_prefix\n cmd = message.content[:body].split(/\\s+/)[0].gsub(/#{pfx}/, '')\n\n res = 'Invalid command'\n\n res = case cmd\n when 'listcommands'\n \"Currently available commands: #{@all_commands.keys.sort.join(', ')}\"\n when 'help'\n if message.content[:body].split(/\\s+/).count <= 1\n '!help: Get help for a specific command' \\\n \"\\nUsage: !help COMMAND\"\n else\n second_cmd = message.content[:body].split(/\\s+/)[1]\n .gsub(/#{pfx}/, '')\n @all_commands[second_cmd.strip].help_command(message)\n end\n end\n\n room = @client.ensure_room(message.room_id)\n room.send_notice(res)\n end", "def get_help\n [self.class::DESCRIPTION, self.class::USAGE]\n end", "def help\n\t\tputs \"Avaiable commands for generator:\"\n\t\tself.methods - Object.new.methods\n\tend", "def get_events\n ConsoleDisplay.events_to_command\n end", "def commands\n\t\t{\n\t\t\t\"check\" => \"Check to see if a target is vulnerable\",\n\t\t\t\"exploit\" => \"Launch an exploit attempt\",\n\t\t\t\"rcheck\" => \"Reloads the module and checks if the target is vulnerable\",\n\t\t\t\"rexploit\" => \"Reloads the module and launches an exploit attempt\",\n\t\t}\n\tend", "def help\n [\n '',\n \"Use: #{me} COMMAND\",\n \" #{me} [help]\",\n '',\n ' down Stops and removes server containers',\n ' restart Runs down followed by up',\n ' sh Shell into the server container',\n ' up Creates and starts the server containers',\n '',\n ' backup Creates a tgz file of all practice sessions',\n ' catalog Lists all language images',\n ' clean Deletes dead images',\n ' images Lists pulled language images',\n ' pull [IMAGE|all] Pulls one language IMAGE or all images',\n ' remove IMAGE Removes a pulled language IMAGE',\n ' upgrade Pulls the latest server and language images',\n ''\n ].join(\"\\n\") + \"\\n\"\nend", "def names()\n\t\tnames = []\n\t\tnames.push \"help\"\n\t\treturn names\n\tend", "def inspect\n string_buff = [\"\\n------ Remote Control -------\\n\"]\n @on_commands.zip(@off_commands) \\\n .each_with_index do |commands, i|\n on_command, off_command = commands\n string_buff << \\\n \"[slot #{i}] #{on_command.class} \" \\\n \"#{off_command.class}\\n\"\n end\n string_buff << \"[undo] #{@undo_command.class}\\n\"\n string_buff.join\n end" ]
[ "0.7376699", "0.71981084", "0.7175714", "0.71377116", "0.7118447", "0.7076356", "0.69700766", "0.69661564", "0.69610155", "0.6958765", "0.6949494", "0.6937923", "0.6906225", "0.68263763", "0.68210495", "0.6768222", "0.67420834", "0.6732571", "0.6715132", "0.6713857", "0.6695254", "0.66917515", "0.6683164", "0.66737586", "0.6667755", "0.6662985", "0.6653607", "0.65788907", "0.6575046", "0.6558956", "0.6540236", "0.65067375", "0.64890933", "0.64839756", "0.64750457", "0.6467022", "0.64259547", "0.64259547", "0.6394633", "0.63934994", "0.63736326", "0.6359052", "0.63430333", "0.63345885", "0.6304946", "0.6302989", "0.6302191", "0.6281157", "0.6252232", "0.62442136", "0.6236554", "0.6235054", "0.6230321", "0.6220629", "0.62157935", "0.62143886", "0.6213656", "0.6201054", "0.62008524", "0.61997277", "0.61927253", "0.61799943", "0.616804", "0.61678576", "0.61678296", "0.61090976", "0.60979366", "0.609676", "0.60927767", "0.60913867", "0.60876954", "0.6086219", "0.6086219", "0.60702175", "0.6066109", "0.60563415", "0.60561943", "0.6037406", "0.6037406", "0.6027756", "0.60255134", "0.6020941", "0.5982727", "0.5975145", "0.5974459", "0.59468395", "0.5938366", "0.59230715", "0.59201545", "0.59128946", "0.5909881", "0.58984363", "0.5892618", "0.58893704", "0.58729833", "0.5865309", "0.5854833", "0.5851518", "0.5850435", "0.5832839", "0.58325183" ]
0.0
-1
Accessor for the store instance
def store connection.store end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store\n return self.class.store\n end", "def store\r\n return @store\r\n end", "def store\n self.class.store\n end", "def store\n @store\n end", "def store\n @store\n end", "def store\n @store ||= Store.new\n end", "def store\n @@store ||= Store.get_store(0)\n end", "def store\n @store ||= storage.new self\n end", "def store\n @store ||= Store.first || Store.create\n end", "def store\n @store ||= Globot::Plugins.store.proxy_for(self)\n end", "def store\n @store ||= Store.find(options[:store]).new(options[:source])\n end", "def store\n @store ||= MotionPrime::Store.shared_store\n end", "def store\n Model.model_store.store(self)\n end", "def store\n @store ||= {}\n end", "def store=(store)\n @store = store\n end", "def instance\n @@instance\n end", "def store\n @store ||= OpenStruct.new\n end", "def fetch_store\n @store ||= self.store || create_store!\n end", "def store\n @store ||= Hash.new\n end", "def get_store\n ActiveRecord::MemoryStore.new\n end", "def metafeta_store\n self.class.metafeta_store\n end", "def store\n raise NotImplementedError, \"You must implement #{self.class}##{__method__}\"\n end", "def store\n _store_id = store_id\n ::Spree::User.logger.debug \"| ByParameters: store_id #{_store_id}\"\n store = _store_id ? ::Spree::Store.where(id: _store_id).first : nil\n store || Spree::Store.new\n end", "def store; shrine_class.new(store_key); end", "def storage_instance; end", "def current_store\n @current_store = session[:store_id].nil? ? Sap::Store.first : Sap::Store.find(session[:store_id])\n end", "def app_store\n self.in(AppStore)\n end", "def initialize( store )\n @store = store\n end", "def store_information\n get('store')\n end", "def store\n @store ||= begin\n raise \"This is Maglev only\" unless defined?(Maglev)\n # In the future, it might be nice to use something\n # other than an IdentitySet. Set? Bag?\n Maglev::PERSISTENT_ROOT[self.to_s.intern] ||= IdentitySet.new\n end\n end", "def in(store)\n store_class = if store.is_a? Symbol\n MobileStores::STORES[store]\n elsif store.is_a? String\n Object.const_get(store) rescue nil\n elsif store.is_a? Class\n store\n end\n\n raise NotImplementedError, \"#{ store } is not implemented yet.\" if store.nil?\n\n store_class.new\n end", "def initialize(store)\n @store = store\n end", "def store\n @cache.compute_if_absent(current_store_id) { new_store }\n end", "def store name = nil\n name ? @store = name : @store\n end", "def store_key; @store.to_sym; end", "def new\n @store = Store.new\n end", "def initialize\n @store = {}\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def store\n @store ||= Globot::Store.new(Globot.config.for_plugin('database'))\n end", "def instance\n local.value\n end", "def initialize(value)\n @store = value\n end", "def store; end", "def store; end", "def store; end", "def set_store\n @store = Store.where(id: params[:id]).take\n end", "def get_instance\n @redis\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def set_store\n @store = Store.find(params[:id])\n end", "def getStoreAktiveMap\n return @xmlStoreMap\n end", "def current_store\n user = current_user\n return nil unless user\n return nil unless session[:store_id]\n user.stores.get(session[:store_id])\nend", "def [](key)\n @store[key]\n end", "def initialize(store: Store.new)\n @store = store\n end", "def instance_var\n @instance_var\n end", "def instance\n @controller.instance_variable_get(:\"@#{instance_name}\")\n end", "def set_store\n @store = current_account.stores.find(params[:id])\n end", "def set_store\n @store = current_account.stores.find(params[:id])\n end", "def store_opener\n @store.opener\n end", "def ___super___\n isolation_context.instance\n end", "def store(store_name, options = {})\n accessors = options.delete(:accessors)\n _orig_store(store_name, options)\n store_accessor(store_name, *accessors) if accessors\n end", "def new_store\n Cache.new\n end", "def configuration\n instance\n end", "def configuration\n instance\n end", "def instance\n @instance || self\n end", "def state\n State.instance\n end", "def set_store\n @store = Store.friendly.find(params[:id])\n end", "def set_store\n @store = Stock.find(params[:id])\n end", "def []( key )\n @store.transaction { @store[key] }\n end", "def store_path\n store_path ||= build_store_path\n end", "def get\n object\n end", "def instance; end", "def instance; end", "def instance; end", "def get(context = Context.current)\n context[self]\n end", "def post_store\n engine.post_store\n end", "def storage() @storage; end", "def index\n @store = store.index\n end", "def instance\n raise \"Instance is not set for #{self.klass}\" if self.inst.nil?\n self.inst\n end", "def windows_store\n self.in(WindowsStore)\n end", "def store?; end", "def store(model)\n model\n end", "def store\n $page.store\n end", "def store\n $page.store\n end", "def store options = {}, &block\n @store ||= store_clazz.new\n @store.adapter_class ||= default_adapter_class\n @store.default_options = options\n yield @store if block_given?\n @store\n end", "def set_store\n\t\t\t@store = Store.includes(stocks: :item).find(params[:id])\n\t\tend", "def instance_var\n @instance_var\n end", "def instance_var\n @instance_var\n end", "def instance_var\n @instance_var\n end", "def initialize\n @store = []\n end" ]
[ "0.8226905", "0.8001342", "0.7885092", "0.77482486", "0.77482486", "0.7727425", "0.7605554", "0.7543315", "0.7268862", "0.7232325", "0.71001565", "0.70652306", "0.7015164", "0.69960433", "0.6986383", "0.6943777", "0.6903568", "0.68448627", "0.67239094", "0.6713173", "0.6674364", "0.6669194", "0.66150635", "0.6564212", "0.655865", "0.6505462", "0.6495733", "0.6484256", "0.64756846", "0.643579", "0.6401566", "0.6372286", "0.6360222", "0.6334636", "0.6276485", "0.62466943", "0.6245451", "0.62222886", "0.62178504", "0.62164354", "0.62069744", "0.6160347", "0.6160347", "0.6160347", "0.6159863", "0.6156764", "0.6156331", "0.61419725", "0.61419725", "0.61419725", "0.61419725", "0.61419725", "0.61419725", "0.61419725", "0.61419725", "0.61419725", "0.61354005", "0.61354005", "0.61354005", "0.61354005", "0.61313033", "0.6130241", "0.6129549", "0.61158305", "0.61012655", "0.6086125", "0.6084397", "0.6084397", "0.6079368", "0.6076684", "0.6073555", "0.6066017", "0.6062447", "0.6062447", "0.60485566", "0.60478365", "0.60458434", "0.6040838", "0.60377806", "0.6021302", "0.6010685", "0.60049504", "0.60049504", "0.60049504", "0.60014147", "0.5998503", "0.5987666", "0.59841555", "0.5982676", "0.597964", "0.59538144", "0.59443694", "0.59302384", "0.59302384", "0.59288377", "0.5914734", "0.5905749", "0.5905749", "0.5905749", "0.5902023" ]
0.6671886
21
Find and run all the actions associated with matchers that match +message+.
def find_match(message) matchers.each do |regexp, options, action, description| if options[:sent_to_me] && !sent_to_me?(message) next end if match_data = without_nick(message).match(regexp) # Return true explicitly if this matcher explicitly returned true break true if instance_exec(*match_data[1..-1], &action) == true end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_message(message)\n @routes\n .reduce(Set.new) do |memo, (matcher, handlers)|\n memo = memo.merge(handlers) if matcher.matches_message?(message)\n memo\n end\n end", "def find_all_actions_matching(matcher)\n actions.find_all { |act| matcher === act.name }\n end", "def match(message)\n @block ? @block.call(message) : true\n end", "def run_matchers # :nodoc:\n matches = Matchers.run(phrase_without_matches)\n matches.each do |match|\n text, category = match\n if text\n @matches[category] << text\n end\n end\n end", "def perform_match message\n return false if reject_not_ack(message)\n return false unless type_match?(message)\n #@notifier.log \"#{identifier}: Looking at #{message.type} #{message.m_id_short}\", level: :collect\n if @block\n status = [@block.call(message)].flatten\n return unless collecting?\n keep message if status.include?(:keep)\n else\n keep message\n end\n end", "def handle(time, sender_nick, message)\n if matchers.empty?\n raise NotImplementedError, \"Implement me in #{self.class.name}!\"\n else\n find_match(message)\n end\n end", "def on_message(message)\n case message['action']\n when 'test1'\n { 'result' => 'test1' }\n when 'sleep'\n sleep message['duration'] || 1\n { 'result' => 'sleep' }\n when 'fail'\n if message['attempt'].to_i >= 2\n { 'result' => 'fail' }\n else\n nil\n end\n else\n { 'result' => \"Unknown action: #{message['action']}\" }\n end\n end", "def member_for(message)\n @members.find { |m| /#{m.pattern}/i =~ message }\n end", "def run(message, flags)\n log message\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n messages = find_messages\n\n next if messages.empty?\n\n message_count += messages.length\n\n unless @noop then\n mark messages, flags\n else\n log \"Noop - not marking\"\n end\n\n yield messages if block_given?\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end", "def scan_message(message)\n out = []\n out << 'recall_hold' if message =~ /Recall/i\n out << 'recall_hold' if message =~ /hold /\n out << 'borrow_direct' if message =~ /Borrow/\n out << 'ill' if message =~ /ILL/\n out << 'in_process' if message =~ /In Process/\n # ReCAP Partners\n out << 'offsite_valet' if message =~ /scsb/\n out\n end", "def execute(*messages)\n messages.each { |msg| self.send(msg) }\n end", "def on_matched_reply(regexp, &block)\n @matched_reply_actions ||= {}\n @matched_reply_actions[regexp] = block\n end", "def _test_message ; process_test_case(\"message\") ; end", "def meaning(message)\n WORDS_MEANS_ACTION.find {|words, action| words.match(Regexp.new(message))} || []\n end", "def receive(message)\n self.class.listeners.map do |matcher, block|\n match = matcher.match(message)\n block.call(match) if match\n end.compact\n end", "def dispatch(message)\n Turntabler.run { @handler.call(message) } if @handler\n end", "def parse_message(msg, user, room)\n if msg =~ REGEX\n execute_command(msg, user, room)\n elsif @afk_users.any?{ |i| msg =~ /#{i}/ }\n room.speak(\"[Status] #{user}: user #{@afk_users.select{ |i| msg =~ /#{i}/ }.first} is afk.\")\n end\n end", "def execute(m)\n if m.message.match(/^#{m.bot.nick}[:,-]? (.+?) is (also )?(.+)/i)\n learn(m, $1, $3)\n elsif m.message.match(/^#{m.bot.nick}[:,-]? (.+) =~ s\\/(.+)\\/(.*)\\//i)\n edit(m, $1, $2, $3)\n elsif m.message.match(/^#{m.bot.nick}[:,-]? forget (.+)/i)\n forget(m, $1)\n elsif m.message.match(/^#{m.bot.nick}[:,-]? literal (.+)/i)\n literal(m, $1)\n elsif m.message.match(/^#{m.bot.nick}[:,-]? ldap (.+)/i)\n # do nothing.\n elsif m.message.match(/^#{m.bot.nick}[:,-]? (.+)/i)\n teach(m, $1)\n elsif m.message.match(/^#{m.bot.nick}[:,-]?$/i)\n address(m)\n end\n end", "def match(chat_text,params,admin=nil)\n actions.select{|a| admin || a.public?}.sort.each do |a|\n if args = action_match?(a,chat_text,params)\n logger.debug(\"COMMAND: #{names.inspect} #{a} matched with params #{args.inspect}\")\n return [a,args] # stop at first action match\n end\n end\n # no matching commands found\n return nil\n end", "def =~(pattern)\n @message =~ message\n end", "def search(query, message)\n log \" Scanning for #{message}\"\n messages = @imap.search query\n log \" Found #{messages.length} messages\"\n return messages\n end", "def run_regex(regex, message)\n characters = regex.chars\n begin\n read_character(characters) while @cursor < characters.length\n rescue RuntimeError\n puts 'SYNTAX ERROR'\n return\n end\n\n # Check all groups ar closed\n if @depth.positive?\n puts 'SYNTAX ERROR'\n else\n verify_message(message)\n end\n end", "def ui_action(message)\n puts message\n yield\n end", "def handle_message(message)\n\t\tif(message.type == 'exception')\n\t\t\t@log.error(message.message)\n\t\t\treturn()\n\t\tend\n\n\t\t# If the message has a type of intention, then we have the chance to\n\t\t# basically say \"NO\" to the action. In this case we are going to\n\t\t# say no to any intention that references the filename 'notouch'. We could\n\t\t# in theory filter on any aspect of the message (the type, the tags, or\n\t\t# the content of the message itself), but in this case a simple regex hack\n\t\t# for example purposes will do nicely\n\t\tif(message.type == 'intention')\n\t\t\t# we can only really block intentions, so only bother checking if the message\n\t\t\t# is an intention\n\t\t\tif(message.message =~ /notouch/)\n\t\t\t\t@log.warn(\"Canceled - #{message.message}\")\n\t\t\t\treturn(false)\n\t\t\telse\n\t\t\t\t@log.info(message.message)\n\t\t\t\treturn(true)\n\t\t\tend\n\t\telse\n\t\t\t@log.info(message.message)\n\t\tend\n\tend", "def message(message)\n handler = handler_for_context\n return unless handler\n if handler.respond_to?(:call)\n instance_exec(message, &handler)\n else\n process(handler, *message['text'].split)\n end\n end", "def fire_triggers(msg)\r\n found = nil\r\n @loaded_triggers.each do |name, trigger|\r\n if trigger.matched?(msg.text) && (Time.now - @last_resp).to_i > Settings::DELAY\r\n @last_resp = Time.now\r\n found = trigger\r\n break\r\n #return say_to_chan(self.chan, trigger.send_response)\r\n end\r\n end\r\n say_to_chan(self.chan, found.send_response) if found\r\n end", "def each(message)\n run 'echo', message\n end", "def process_message(message)\n # TODO: May want to ignore some messages (say, if the community string is wrong)\n message.respond(dispatch(message))\n end", "def matches_message?(message)\n match_message(message).any?\n end", "def on_message(message)\n if message.is_a?(Array) && message.first == :spawn\n spawn message[1], &message[2]\n else\n # ignore\n end\n end", "def matches(interests, msg)\n\n action = msg['action']\n\n interests.each do |interest|\n\n satisfied = case interest\n\n when :or_error\n #\n # let's force an immediate reply\n\n interests.clear if action == 'error_intercepted'\n\n when :inactive\n\n (FINAL_ACTIONS.include?(action) && @context.worker.inactive?)\n\n when :empty\n\n (action == 'terminated' && @context.storage.empty?('expressions'))\n\n when Symbol\n\n (action == 'dispatch' && msg['participant_name'] == interest.to_s)\n\n when Fixnum\n\n interests.delete(interest)\n\n if (interest > 1)\n interests << (interest - 1)\n false\n else\n true\n end\n\n when Hash\n\n interest.all? { |k, v|\n k = 'tree.0' if k == 'exp_name'\n Ruote.lookup(msg, k) == v\n }\n\n when /^[a-z_]+$/\n\n (action == interest)\n\n else # wfid\n\n (FINAL_ACTIONS.include?(action) && msg['wfid'] == interest)\n end\n\n interests.delete(interest) if satisfied\n end\n\n if interests.include?(:or_error)\n (interests.size < 2)\n else\n (interests.size < 1)\n end\n end", "def execute(message)\n failure_wrap(message) do |event|\n new_payload(\n config[:name],\n :cfn_event => event\n )\n completed(event, message)\n end\n end", "def ui_sub_action(message)\n puts message\n yield\n end", "def run\n log \"Flagging tasty messages\"\n\n message_count = 0\n mailboxes = find_mailboxes\n\n mailboxes.each do |mailbox|\n @mailbox = mailbox\n @imap.select @mailbox\n log \"Selected #{@mailbox}\"\n\n message_count += process_unlearned_flagged\n message_count += process_tasty_unflagged\n message_count += process_bland_flagged\n message_count += process_unlearned\n end\n\n log \"Done. Found #{message_count} messages in #{mailboxes.length} mailboxes\"\n end", "def handle_message(message)\n\t\t\tif(message.type == 'exception')\n\t\t\t\t@logger.error(LOG_ERR,message.message)\n\t\t\t\treturn()\n\t\t\tend\n\n\t\t\t# If the message has a type of intention, then we have the chance to\n\t\t\t# basically say \"NO\" to the action. In this case we are going to\n\t\t\t# say no to any intention that references the filename 'notouch'. We could\n\t\t\t# in theory filter on any aspect of the message (the type, the tags, or\n\t\t\t# the content of the message itself), but in this case a simple regex hack\n\t\t\t# for example purposes will do nicely\n\t\t\tif(message.type == 'intention')\n\n\t\t\t\t# we can only really block intentions, so only bother checking\n\t\t\t\t# if the message is an intention\n\n\t\t\t\t@logger.notify(VERBOSE_MAJOR,message.message)\n\t\t\telsif (message.type == 'info')\n\t\t\t\tif(message.message =~ /^search|lock|backup/)\n\t\t\t\t\t# overrule status of these\n\t\t\t\t\t@logger.notify(VERBOSE_MINOR,message.message)\n\t\t\t\telse\n\t\t\t\t\t@logger.notify(VERBOSE_CRITICAL,message.message)\n\t\t\t\tend\n\t\t\telsif (message.type == 'verbose')\n\t\t\t\t@logger.notify(VERBOSE_MAJOR,message.message)\n\t\t\telsif (message.type == 'debug')\n\t\t\t\t@logger.notify(VERBOSE_MINOR,message.message)\n\t\t\telse\n\t\t\t\t@logger.notify(VERBOSE_MINOR,message.message)\n\t\t\tend\n\t\t\ttrue\n\t\tend", "def attempt actor, command, with_callbacks = false\r\n return nil if command.verb != verb\r\n tokens = command.arguments\r\n result = []\r\n matches = Gamefic::Query::Matches.new([], '', '')\r\n queries.each_with_index do |p, i|\r\n return nil if tokens[i].nil? && matches.remaining == ''\r\n matches = p.resolve(actor, \"#{matches.remaining} #{tokens[i]}\".strip, continued: (i < queries.length - 1))\r\n return nil if matches.objects.empty?\r\n accepted = matches.objects.select { |o| p.accept?(o) }\r\n return nil if accepted.empty?\r\n if p.ambiguous?\r\n result.push accepted\r\n else\r\n return nil if accepted.length != 1\r\n result.push accepted.first\r\n end\r\n end\r\n new(actor, result, with_callbacks)\r\n end", "def call(bot, message, &acceptor)\n @processors.map do |p|\n Concurrent::Future.execute do\n begin\n p.call(bot, message, &acceptor)\n rescue StandardError => e\n log_failure error: e, message: message,\n logger: bot.public_method(:log)\n end\n end\n end\n end", "def assertMatchWithMessageTest pattern, value, message\n assertMatch pattern, value, message\n end", "def _match(dir, message)\n return [false, nil] if @idx >= @exps.length\n matched = true\n matched = false if dir != @exps[@idx].direction\n if matched\n if dir == ::SipperUtil::ExpectationElement::Directions[2] # \"!\" \n matched = _match_neutral(message)\n elsif message.first_char(1).int?\n matched = _match_response(message)\n else\n matched = _match_request(message)\n end\n end\n if matched\n @match_count += 1\n return [true, nil] if @match_count < @exps[@idx].range.min\n return [false,_unmatched_expectation] if @match_count > @exps[@idx].range.max\n if @exps[@idx].range.include? @match_count\n @exps[@idx].satisfied = true \n return [true, nil]\n end\n else\n if (@exps[@idx].satisfied || @exps[@idx].range.min == 0)\n @idx += 1\n @match_count = 0\n return _match(dir, message) # match next\n else\n return [false,_unmatched_expectation]\n end\n end \n end", "def run_action(msg)\n ui.info(\"#{msg}... \", :nonewline)\n begin\n result = yield\n ui.puts ui.color('complete!', :green, :bold)\n if(result)\n ui.puts '---> Results:'\n case result\n when Hash\n result.each do |k,v|\n ui.puts ' ' << ui.color(\"#{k}: \", :bold) << v\n end\n else\n ui.puts result\n end\n end\n rescue => e\n ui.puts ui.color('error!', :red, :bold)\n ui.error \"Reason - #{e}\"\n raise\n end\n true\n end", "def match(regex, &action)\n append_action(regex, action)\n self\n end", "def run_action(msg)\n ui.info(\"#{msg}... \", :nonewline)\n begin\n result = yield\n ui.puts ui.color(\"complete!\", :green, :bold)\n if result\n ui.puts \"---> Results:\"\n case result\n when Hash\n result.each do |k, v|\n ui.puts \" \" << ui.color(\"#{k}: \", :bold) << v\n end\n else\n ui.puts result\n end\n end\n rescue\n ui.puts ui.color(\"error!\", :red, :bold)\n raise\n end\n true\n end", "def handle_item(msg)\n return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack\n return nil if msg[:user_name] == 'slackbot' # do not reply to self\n return nil unless msg[:text].is_a?(String) # skip empty messages\n\n ## loop things to look for and collect immediate responses\n ## rescue everything here so the bot keeps running even with a broken script\n responses = @regexes.map do |regex, proc|\n if mdata = msg[:text].strip.match(regex)\n begin\n Slackbotsy::Message.new(self, msg).instance_exec(mdata, &proc)\n rescue => err\n err\n end\n end\n end\n\n ## format any replies for http response\n if responses\n { text: responses.compact.join(\"\\n\") }.to_json\n end\n end", "def action(channel,nick,message)\n send_command(:action, nick: nick, channel: channel , message: \"#{Filter.new(message)}\")\n end", "def process_message(message)\n end", "def execute(message)\n options.keys.each do |key|\n case key\n when :nick, :nicks\n return unless validate(options[:nick] || options[:nicks], message.nick)\n when :host, :hosts\n return unless validate(options[:host] || options[:hosts], message.host)\n when :user, :users\n return unless validate(options[:user] || options[:users], message.user)\n when :channel, :channels\n if message.channel\n return unless validate(options[:channel] || options[:channels], message.channel)\n end\n end\n end\n\n callbacks.each do |blk|\n blk.call(message)\n end\n end", "def action_for_message\n val = message_context_session.delete(:context)\n context = val && val.to_s\n super || context && begin\n args = payload['text'].try!(:split) || []\n action = action_for_message_context(context)\n [[action, type: :message_context, context: context], args]\n end\n end", "def allow_action(msg, context)\n # puts \"CM\"\n modules_name = context[:full_modules_name]\n action = rules[:default] || :yield \n # puts \"modules_name: #{modules_name}\" \n rules[:modules].each do |_module|\n # get names of modules to match\n names = _module[:names]\n class_rules = _module[:class_rules]\n classes = _module[:classes]\n method_rules =_module[:method_rules]\n \n class_name = context[:class_name]\n method_name = context[:method_name]\n \n # puts \"module names to match: #{names}\"\n # puts \"context class_name: #{class_name}\"\n # puts \"context method_name: #{method_name}\"\n \n # test if current module name matches any of the module names for this rule\n next if !names.matches_any?(modules_name)\n # if name matches rule\n if classes && !class_name.blank?\n # puts \"CC filter\"\n composite_class_filter = CompositeClassFilter.new(_module)\n action = composite_class_filter.allow_action(msg, context)\n return action if (action == :include || action == :exclude) \n end\n if class_rules && !class_name.blank?\n # puts \"class filter\" \n class_filter = ClassFilter.new(_module)\n action = class_filter.allow_action(msg, context)\n return action if (action == :include || action == :exclude) \n end\n if method_rules && !method_name.blank?\n # puts \"method filter\" \n method_filter = MethodFilter.new(_module)\n action = method_filter.allow_action(msg, context)\n return action if (action == :include || action == :exclude)\n end\n end\n # puts \"action: #{action}\"\n return action\n end", "def handle(message)\n type, return_to, params = parse(message[:payload])\n begin\n m = handle_message(type, params)\n success(return_to, m)\n rescue Exception => e\n error(return_to, e)\n end\n end", "def run(with_message)\n raise \"Not implemented yet.\"\n end", "def call(action, message)\n timestamp = Time.now\n @to_process.put [timestamp, action, message, @from_process] if @to_process\n if @from_process\n response_timestamp = 0\n # The response timestamp can never be larger than the timestamp.\n # Therefore we can discard until we get \"our\" answer.\n # We assume that the search process will eventually answer.\n # -> This is optimistic code ;)\n until response_timestamp == timestamp\n response_timestamp, response = @from_process.get\n end\n response\n end\n rescue StandardError => e\n $stderr.puts \"[Warning] Calling #{action} with #{message} failed: #{e.message}\"\n end", "def process(channel, message)\n\n debug_me{[ :channel, :message ]}\n\n\n if message[:payload].start_with?(\"/\")\n parts = message[:payload].split(' ')\n method_name = parts.shift()[1..]\n params = parts.join(' ')\n\n if respond_to?(method_name)\n send(method_name, params)\n else\n puts \"Unknown command: #{command}\"\n end\n\n return true\n else\n username = message[:headers][\"username\"]\n @users << username unless @users.include?(username)\n \n show(channel, username, message[:payload])\n\n return false\n end\n end", "def process_message(message)\n msg = message.to_s\n\n if msg =~ /[\\.\\?!;]/\n msg.split(/[\\.\\?!;]/)\n if msg.is_a? String\n process_sentence(msg)\n else\n msg.each do |m|\n process_sentence(m)\n end\n end\n else\n process_sentence(msg)\n end\n end", "def _perform(text)\n lines = text.split(\"\\n\")\n lines.map! {|line|\n line.gsub(/\\[\\[(.)+\\]\\]/i){|found|\n /\\[\\[([a-z_]*): ([a-z_]*)\\]\\]/i =~ found\n _perform(self.send($1.to_sym, $2))\n }\n }\n lines.join(\"\\n\")\n end", "def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = ACTIONS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 142:11: 'actions'\n match( \"actions\" )\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__, 11 )\n\n end", "def post_match() end", "def call(message)\n if message.command == 'MESSAGE'\n handler.call(JSON.parse(message.body, symbolize_names: true))\n end\n rescue => e\n log.error(e.message) { \"\\n#{e.backtrace.inspect}\" }\n ensure\n ack(message)\n log.info('Processed') { %(#{message.headers['message-id']} from \"#{message.headers['destination']}\") }\n end", "def route!( message )\n @message = message\n process!\n rescue => err\n @last_error = err\n\n if errors(err.class).nil?\n raise( err, caller )\n else\n errors(err.class).each { |block| block.call(self) }\n end\n end", "def send_action(message, *recipients)\n normalize_message(message) { |message|\n recipients.each { |recipient|\n send_raw(PRIVMSG, recipient, \"\\001ACTION #{message}\\001\")\n }\n }\n end", "def process(message)\n if message[:payload].start_with?(\"/\")\n command, *params = message[:payload].split(\" \")\n method_name = command[1..-1]\n if respond_to?(method_name)\n send(method_name, *params)\n else\n puts \"Unknown command: #{command}\"\n end\n return true\n else\n username = message[:headers][\"username\"]\n @users << username unless @users.include?(username)\n return false\n end\n end", "def perform(messages = nil, params = {}, &block)\n logger.debug \"#{self}(#{params.inspect}) <- #{messages}\"\n return to_enum(:perform, messages, params) unless block_given?\n\n wrap_input(messages).each do |m|\n run_callbacks :perform do\n logger.debug \"#{object_id} -> #{m}\"\n result = perform_one(m, params)\n handle_result(m, result, &block)\n end\n end\n end", "def perform(message, user_id)\n build = RecastAI::Build.new(RECAST_TOKEN, 'en')\n response = build.dialog({ type: 'text', content: message.content }, user_id)\n response.messages.map do |message|\n Message.create!(author: nil, message_type: message.type, content: message.content)\n end\n end", "def run(test, &block)\n advice[:before].each do |matches, block|\n if matches.all?{ |match| test.match?(match) }\n scope.instance_exec(test, &block) #block.call(unit)\n end\n end\n\n block.call\n\n advice[:after].each do |matches, block|\n if matches.all?{ |match| test.match?(match) }\n scope.instance_exec(test, &block) #block.call(unit)\n end\n end\n end", "def action_match?(a,s,params)\n if names.map(&:to_s).include?(params.first) && a.match(s,params.rest)\n a.args(s,params.rest)\n end\n end", "def run(args) # :nodoc\n last_arg = @proc.cmd_argstr.end_with?(' ') ? '' : args[-1]\n @proc.complete(@proc.cmd_argstr, last_arg).each do |match|\n msg match\n end\n end", "def handle_channel_message(message)\n if (match = message.match(/^:(\\w+)!.*?:(.*)$/))\n captures = match.captures\n nickname = captures[0]\n message = captures[1].chomp\n\n if mentioned?(message) && message.downcase.include?('hello')\n send_channel_message(\"Why hello there, #{nickname}!\")\n elsif (match = message.match(/^!(\\w+) ?(.*)$/))\n captures = match.captures\n command = captures[0]\n arguments = captures[1]\n\n command_method_name = \"handle_command_#{command}\"\n\n if respond_to?(command_method_name, true)\n send(command_method_name, arguments)\n end\n else\n if @quiz_running\n process_quiz_guess(nickname, message)\n end\n end\n else\n # weird stuff is happening, we'll ignore this\n end\nend", "def notify message\n raise ArgumentError unless message\n raise RuntimeError.new(\"can't process message when status is :#{@status}, title: #{@title}, desc: #{describe}\") unless ready? || collecting?\n if perform_match message\n if done?\n complete\n else\n incomplete\n end\n end\n @status\n end", "def message_for(test); end", "def message_for(test); end", "def like_and_post_on_matching_feed( words_to_match, messages_array )\n regex = /#{words_to_match.map{|w|Regexp.escape(w)}.join('|')}/i\n \n messages = []\n \n posts = get_feed.each do |post|\n name = post[\"message\"]\n if regex === name\n message = \"#{messages_array.sample} #{post['from']['name']}\"\n messages << message\n add_comment_and_like_on_post( post[\"id\"], message )\n end\n end\n end", "def consider(message)\n payload = JSON.parse(message[:payload])\n event = payload['event']\n attributes = payload['attributes']\n klass = Pebblebed::Uid.raw_parse(payload['uid']).first\n handle(event, klass, attributes)\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 responds_to?(message)\n return true unless event_regex\n @match_data = event_regex.match(message)\n return @match_data\n end", "def on_message(message)\n search_for = message.event.split(\"/\")\n raise InvalidBackendEvent(message.event) if search_for.size < 2\n klass = @handlers[search_for[0]] and handler = klass.method(search_for[1])\n raise UndefinedHandler.new(message.event) unless handler\n logger.info(\"#{message.event}, #{message.inspect}\")\n handler.call(message)\n end", "def execute(message)\n failure_wrap(message) do |payload|\n cfn_resource = rekey_hash(payload.get(:data, :cfn_resource))\n properties = rekey_hash(cfn_resource[:resource_properties])\n parameters = rekey_hash(properties[:parameters])\n cfn_response = build_response(cfn_resource)\n case cfn_resource[:request_type].to_sym\n when :create\n create_stack(cfn_response, cfn_resource, properties, parameters, message)\n when :update\n update_stack(cfn_response, cfn_resource, properties, parameters, message)\n when :delete\n destroy_stack(cfn_response, cfn_resource, message)\n else\n error \"Unknown request type received: #{cfn_resource[:request_type].inspect}\"\n cfn_response['Status'] = 'FAILED'\n cfn_response['Reason'] = 'Unknown request type received'\n end\n respond_to_stack(cfn_response, cfn_resource[:response_url])\n job_completed(:jackal_cfn, payload, message)\n end\n end", "def process(message)\n end", "def answer(message)\n if message.text.start_with?(\"<@#{id}> please explain\")\n word = message.text.split(\"<@#{id}> please explain\")[1]\n msg = format(RI.find(word))\n elsif message.text.start_with?(\"<@#{id}>\")\n words = message.text.split\n msg = if words.length > 1\n format(RI.find(words[1]))\n else\n \"Hi <@#{message.user}>, how can I help you?\"\n end\n elsif message.text.include?('#')\n msg = format(RI.find(message.text))\n end\n\n msg = \"Sorry I couldn't find it.\" if msg.nil?\n\n mount_message(msg, message.channel)\n end", "def message_received(message)\n @message_handlers.each do |block|\n block.call(message)\n end\n end", "def work(message)\n if message.is_a?(Message)\n self.count = count + 1\n\n Concurrent::IVar.new(:ok)\n else\n expected_messages_received?\n end\n end", "def attempt(message, &block)\n perform_action(message, false, nil, false, &block)\nend", "def action_for_payload\n case payload_type\n when 'message'\n cmd, args = self.class.command_from_text(payload['text'], bot_username)\n cmd &&= self.class.action_for_command(cmd)\n [true, cmd, args] if cmd\n end || [false, payload_type, [payload]]\n end", "def got_MSG(message)\n @logger.info(\"got_MSG()\")\n @logger.info(\"got_MSG() - #{message['message']}\")\n self.fix_skiplist(message['channel'])\n @logger.info(\"got_MSG() - fix_skiplist()\")\n self.remove_from_skip_list(message['channel'], message['character'])\n @logger.info(\"got_MSG() - remove_from_skip_list()\")\n if message['message'] == '!skip'\n self.add_to_skip_list(message['channel'], message['character'])\n elsif message['message'] =~ /^!skip/\n person = message['message'].gsub(/^!skip/, '').strip\n self.add_to_skip_list(message['channel'], person)\n elsif message['message'] =~ /^!spin/\n @logger.info(\"got_MSG() - spinning the bottle\")\n players = self.spin_list(message['channel'], message['character'])\n @logger.info(\"got_MSG() - players: #{players}\")\n if players == []\n msg = \"/me can't find anyone to play with!\"\n else\n player = players.sample\n msg = \"/me spins around, and eventually lands on [b]#{player}[/b]\"\n end\n self.send('MSG',message['channel'],msg)\n else\n @logger.info(\"gotMSG() - parseFail\")\n end\n end", "def dispatch(messages)\n initialize_description!\n send_messages(messages)\n end", "def run\n handlers.each do |info, handler|\n matches = matches_options?(info[:type], info[:regexp])\n break if matches && handler.call(options)\n end\n end", "def processmessage(message)\n command = message.split(':')\n\n case command[0]\n when 'pin_assign'\n pin_assign(command[1])\n when 'pin_patternorder'\n pin_patternorder(command[1])\n when 'pin_cycle'\n pin_cycle(command[1])\n when 'pin_clear'\n pin_clear\n when 'pin_format'\n pin_format(command[1])\n when 'pin_timing'\n pin_timing(command[1])\n when 'pin_timingv2'\n pin_timingv2(command[1])\n when 'version'\n \"P:#{@version}\"\n else\n 'Error Invalid command: ' + command[0].to_s\n end\n end", "def route_command(message_body)\n route(\"#{robot.mention_name} #{message_body}\")\n end", "def process_message(message)\n with_retries(max_tries: retries, handler: retry_handler) do\n handler.call(parse_message(message.value))\n end\n rescue StandardError => e\n handle_exception(e)\n stop\n else\n store_offset(offset)\n self\n end", "def process(message)\n return message unless message[:service] == :groupme\n\n gid = message[:group].split('/').last\n map = Util.bot_map_for(bot)\n\n message if map.key? gid\n end", "def on_message(pre, message)\n\n m_wfid = message['wfid'] || (message['fei']['wfid'] rescue nil)\n m_error = message['error']\n\n m_action = message['action']\n m_action = \"pre_#{m_action}\" if pre\n\n msg = m_action == 'error_intercepted' ? message['msg'] : message\n\n ids_to_remove = []\n\n trackers.each do |tracker_id, tracker|\n\n # filter msgs\n\n t_wfid = tracker['wfid']\n t_action = tracker['action']\n\n next if t_wfid && t_wfid != m_wfid\n next if t_action && t_action != m_action\n\n next unless does_match?(message, tracker['conditions'])\n\n if tracker_id == 'on_error' || tracker_id == 'on_terminate'\n\n fs = msg['workitem']['fields']\n\n next if m_action == 'error_intercepted' && fs['__error__']\n next if m_action == 'terminated' && (fs['__error__'] || fs['__terminate__'])\n end\n\n # remove the message post-trigger?\n\n ids_to_remove << tracker_id if tracker['msg'].delete('_auto_remove')\n\n # OK, have to pull the trigger (or alter the message) then\n\n if pre && tracker['msg']['_alter']\n alter(m_wfid, m_error, m_action, msg, tracker)\n else\n trigger(m_wfid, m_error, m_action, msg, tracker)\n end\n end\n\n remove(ids_to_remove, nil)\n end", "def perform(message)\n \tActionCable.server.broadcast \"chatrooms:#{message.chatroom.id}\", {\n \t\tmessage: MessagesController.render(message),\n \t\tchatroom_id: message.chatroom.id\n \t}\n # Do something later\n end", "def search(pattern)\n Vimpack::Commands::Search.run(self, pattern)\n end", "def allow_action(msg, context)\n # puts \"CC\"\n # class name of context\n class_name = context[:class_name]\n action = rules[:default] || :yield\n rules[:classes].each do |clazz|\n names=clazz[:names]\n class_name_match = names.matches_any?(class_name)\n next if !class_name_match\n # if name matches rule\n method_filter = MethodFilter.new(clazz)\n action = method_filter.allow_action(msg, context)\n return action if (action == :include || action == :exclude)\n end\n return action\n end", "def tell_all(m, message)\r\n if_admin(m) do\r\n @bot.channels.each {|c| c.send(message) }\r\n end\r\n end", "def testExactMatch2Actions\n initTestCase do\n $Context[:SlaveActions] = [\n [ 'DummyTool', 'DummyAction', [] ],\n [ 'DummyTool', 'DummyAction2', [] ]\n ]\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySenderFilterDummyTool',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal( [\n [ 'sendMessage', [ 'DummyUser', {\n 'DummyTool' => {\n 'DummyAction' => [\n []\n ],\n 'DummyAction2' => [\n []\n ]\n }\n } ]\n ]\n ],\n $Variables[:DummySenderCalls]\n )\n assert_equal([], getSlaveClientQueue)\n end\n end\n end", "def receive_message(message)\n Pantry.logger.debug(\"[#{identity}] Received message #{message.inspect}\")\n\n if message_meant_for_us?(message)\n @last_received_message = message\n results = @commands.process(message)\n\n if message.requires_response?\n Pantry.logger.debug(\"[#{identity}] Responding with #{results.inspect}\")\n send_results_back_to_requester(message, results)\n end\n else\n Pantry.logger.debug(\"[#{identity}] Message discarded, not for us\")\n end\n end", "def run_actions\n catch_exceptions do\n @success = if block_given?\n result = yield\n actions.each {|action| results[action] = result}\n !!result\n else\n actions.compact.each {|action| !skip_actions && results[action] = object.send(action)}\n results.values.all?\n end\n end\n end", "def handle_command(message)\n text = period = tomorrow = subscribe = type = nil\n valid = false\n case message.text\n when CONST::COMMANDS[:lunch]\n valid = true\n period = :lunch\n when CONST::COMMANDS[:dinner]\n valid = true\n period = :dinner\n when CONST::COMMANDS[:tomorrow]\n valid = true\n tomorrow = true\n when CONST::COMMANDS[:next]\n valid = true\n when CONST::COMMANDS[:unsubscribe]\n valid = true\n subscribe = :destroy\n when CONST::COMMANDS[:subscribe]\n valid = true\n subscribe = :create\n when CONST::COMMANDS[:config]\n valid = true\n text = ''\n @bot.start_config message.from, message.chat\n when CONST::COMMANDS[:update]\n valid = true\n tag = @bandejao.update_pdf ? 'success' : 'error'\n text = CONST::TEXTS[:\"pdf_update_#{tag}\"]\n when CONST::COMMANDS[:feedback]\n valid = true\n text = send_feedback message\n when CONST::COMMANDS[:papoco]\n valid = true\n text = ''\n @bot.start_papoco message.chat\n else\n CONST::COMMANDS.each do |k, v|\n text = CONST::TEXTS[k] if v.match(message.text)\n end\n end\n if subscribe\n type = message.chat.type == 'private' ? :private : :group\n success = @bot.start_subscription subscribe, message\n text = CONST::SUBSCRIBE[subscribe][type][success]\n end\n tomorrow = CONST::COMMANDS[:tomorrow] =~ message.text\n unless valid\n text = '' unless message.chat.type == CONST::CHAT_TYPES[:private]\n end\n [text, period, tomorrow]\n end", "def actions(enemy)\n puts \"What will #{@name} do? They may:\"\n @actions.each_with_index{|a, i| puts \"#{i+1}) #{a.unCamelize}\"}\n #maybe instead of this, look at all the defined action method names and list them?\n userMethod = Rules.userInput\n (userMethod.to_i.to_s == userMethod) ? userMethod = @actions[userMethod.to_i-1] : userMethod = userMethod.camelize\n (@actions.include? userMethod) ? Actions.method(userMethod).call(self, enemy) : (puts \"#{@name} attempts to #{userMethod.unCamelize}... Nothing happens.\") \n end", "def process(process_id, plan, data)\n message = data[:message] || data[\"message\"] \n data[:matches] = []\n data[:misses] = []\n \n match_words.each do |match_word|\n filter = case match_type\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_ALL\n /^#{match_word}$/i\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_WORD\n /\\b#{match_word}\\b/i\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_BEGIN_WITH\n /^#{match_word}/i\n when RulesEngine::Rule::<%=rule_name.camelize%>::MESSAGE_MATCH_END_WITH\n /#{match_word}$/i\n end\n \n if filter =~ message\n RulesEngine::Process.auditor.audit(process_id, \"found #{match_word}\", RulesEngine::Process::AUDIT_INFO)\n data[:matches] << match_word\n else\n RulesEngine::Process.auditor.audit(process_id, \"missed #{match_word}\", RulesEngine::Process::AUDIT_INFO)\n data[:misses] << match_word\n end\n end\n \n unless data[:matches].empty?\n case workflow_action\n when 'stop_success'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_SUCCESS)\n when 'stop_failure'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::STOP_FAILURE)\n when 'start_workflow'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::START_WORKFLOW, workflow_code)\n else #'next'\n return RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT)\n end\n end\n \n RulesEngine::Rule::Outcome.new(RulesEngine::Rule::Outcome::NEXT)\n end", "def do_match(input)\n @matched = input.match(@on)\n end" ]
[ "0.6615374", "0.5999747", "0.5943788", "0.59328794", "0.5838377", "0.57649815", "0.5702747", "0.5565897", "0.55282384", "0.55019957", "0.54770076", "0.543302", "0.53932214", "0.5376062", "0.5372585", "0.5343184", "0.5332027", "0.529163", "0.52706647", "0.52423775", "0.5238046", "0.51983076", "0.519783", "0.5170125", "0.51596534", "0.5134634", "0.5115368", "0.5107239", "0.50867015", "0.50861335", "0.50841516", "0.5048463", "0.504621", "0.5043425", "0.50417", "0.5040251", "0.5039379", "0.5030081", "0.5023014", "0.5020322", "0.5017031", "0.5004248", "0.49724165", "0.49708217", "0.49680895", "0.49625593", "0.49624217", "0.49620903", "0.4953456", "0.49518287", "0.4951648", "0.49298295", "0.49272707", "0.49149007", "0.49061173", "0.48913586", "0.48717412", "0.48663262", "0.4851792", "0.48491198", "0.4839847", "0.48359007", "0.48297507", "0.4815337", "0.4814167", "0.48122668", "0.48017237", "0.47910935", "0.47910935", "0.47752935", "0.4768249", "0.47638053", "0.4748525", "0.47399485", "0.47399285", "0.4739876", "0.47389558", "0.47286972", "0.47232464", "0.4722641", "0.47163403", "0.4715997", "0.471432", "0.47136587", "0.47094652", "0.47037303", "0.47017157", "0.46988025", "0.46979508", "0.4695402", "0.4686899", "0.46844342", "0.46837983", "0.4680217", "0.4679825", "0.46754834", "0.46731475", "0.46700457", "0.46695808", "0.46691653" ]
0.63537383
1
The matchers defined by this plugin's class
def matchers self.class.matchers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matchers\n @matchers ||= []\n end", "def matchers\n @known_classes.select {|c| c <= ::Dat::Analysis::Matcher }\n end", "def matchers\n @matchers ||= {}\n end", "def matchers\n keywords[\"matchers\"] || {}\n end", "def matchers\n @components.values\n end", "def matchers\n cached_matchers\n end", "def matchers\n Argument::Matcher.subclasses.map { |subclass| subclass.new(@arguments) }\n end", "def initialize\n @matchers = []\n @matches = {}\n end", "def matcher_name; end", "def matcher_name; end", "def matcher; end", "def matcher; end", "def matches\n parse\n end", "def submatchers; end", "def run_matchers # :nodoc:\n matches = Matchers.run(phrase_without_matches)\n matches.each do |match|\n text, category = match\n if text\n @matches[category] << text\n end\n end\n end", "def matches\n @matches ||= []\n end", "def string_matchers()\n []\n end", "def underlying_matcher; end", "def underlying_matcher; end", "def methods_matching(re); end", "def allow_matcher; end", "def matched_by\n @filters.matches\n end", "def allquerymatchers(start_date, end_date, type, category)\n [\n QueryDateMatcher.new(start_date, end_date),\n QueryTypeMatcher.new(type),\n QueryCategoryMatcher.new(category)\n ]\n end", "def matches\n attributes.fetch(:matches)\n end", "def matching_types(&matcher)\n yield(self) ? [self] : []\n end", "def match_captures; end", "def setup_match_rules\n include_match << Regexp.new('.') if @include_match.flatten.size == 0\n $logger.debug \"include match rules:\"\n @include_match.each { |pm| $logger.debug \"+ #{pm.to_s}\" }\n $logger.debug \"exclude match rules:\"\n @exclude_match.each { |nm| $logger.debug \"+ #{nm.to_s}\" }\n end", "def matches_by\n Array(options_by_type(:matches_by))\n end", "def build_matcher(options, whitelist_option, blacklist_option); end", "def matches?\n raise NotImplementedError, 'You must override the matches? method in your matcher.'\n end", "def matches\n @subject.matches\n end", "def match()\n end", "def match(klass); end", "def match\n @match\n end", "def tests(subject)\n subject.match_expressions.each do |match_expression|\n tests = integration.all_tests.select do |test|\n match_expression.prefix?(test.expression)\n end\n return tests if tests.any?\n end\n\n EMPTY_ARRAY\n end", "def querymatchers(start_date, end_date, type, category)\n matchers = []\n matchers << QueryDateMatcher.new(start_date, end_date) unless start_date.nil? && end_date.nil?\n matchers << QueryTypeMatcher.new(type) unless type.nil?\n matchers << QueryCategoryMatcher.new(category) unless category.nil?\n matchers\n end", "def initialize(config)\n @config = config\n @matchers = []\n end", "def args_match(matchers, candidates, match_data = {})\n matchers.each do |m|\n case m.function\n when :'?'\n return false if candidates.empty?\n match_data[m.literal] = candidates.shift\n when :'_'\n return false if candidates.empty?\n return false unless candidates.shift.literal == m.literal\n when :'[]'\n return false if candidates.empty?\n match_data[m.literal] = candidates\n candidates = []\n else\n return false if candidates.empty?\n return false unless do_match(m, candidates.shift, match_data)\n end\n end\n candidates.empty?\n end", "def klass_matcher\n super do |d|\n (d[0] & STATUS_MASK) == STATUS && d[1] >= 120\n end\n end", "def match; end", "def match; end", "def doc_matches(matchers)\n matches = []\n matchers.each do |query|\n if query.is_a?(String)\n if el = doc.search(query).first\n if el.name.downcase == \"meta\"\n matches << el[\"content\"]\n else\n matches << el.inner_text\n end\n end\n elsif query.is_a?(Array)\n doc.search(query.first).map do |node|\n el = query.last.call(node)\n matches << el if el.present?\n end\n end\n end\n matches.flatten\n rescue => e\n puts \"#{e.message}\"\n []\n end", "def predicate_matchers\n @predicate_matchers ||= {:exist => :exist?, :an_instance_of => :is_a?}\n end", "def initialize(name, matchers = {}, options = {})\n @name, @matchers, @options = name, matchers, options\n end", "def compare_matchers(key, new_matcher, matcher)\n cmp = compare_matcher_properties(new_matcher[:block], matcher[:block])\n return cmp if cmp != 0\n\n cmp = compare_matcher_properties(new_matcher[:platform_version], matcher[:platform_version])\n return cmp if cmp != 0\n\n cmp = compare_matcher_properties(new_matcher[:platform], matcher[:platform])\n return cmp if cmp != 0\n\n cmp = compare_matcher_properties(new_matcher[:platform_family], matcher[:platform_family])\n return cmp if cmp != 0\n\n cmp = compare_matcher_properties(new_matcher[:os], matcher[:os])\n return cmp if cmp != 0\n\n cmp = compare_matcher_properties(new_matcher[:override], matcher[:override])\n return cmp if cmp != 0\n\n # If all things are identical, return 0\n 0\n end", "def matches\n @calls\n end", "def klass_matcher\n super do |d|\n (d[0] & STATUS_MASK) == STATUS && d[1] < 120\n end\n end", "def klass_matcher(&block)\n return @klass_matcher if defined?(@klass_matcher)\n\n unless block_given?\n val, mask = status_value_and_mask\n block = proc { |d| (d[0] & mask) == val }\n end\n\n @klass_matcher = Matcher.new(self, &block)\n end", "def matcher_name=(_arg0); end", "def all_be_a( expected_mod )\n\t\tEnumerableAllBeMatcher.new( expected_mod )\n\tend", "def matchers\n @find.chars.map { |char| char == '-' ? allowed_letters : \"#{char}{1}\" }.join ''\n end", "def matches\n process_events! unless @matches\n @matches\n end", "def association_matcher; end", "def have_all_of_selectors(...)\n Matchers::HaveAllSelectors.new(...)\n end", "def extended(base)\n base.matchers.concat(matchers)\n end", "def match\n self.class.match.with_instance(self)\n end", "def times_matcher\n definition.times_matcher\n end", "def have_any_of_selectors(...)\n Matchers::HaveAnySelectors.new(...)\n end", "def all\n match(nil)\n end", "def matched_words\n _matched_words\n end", "def to_proc\n if @array_matchers.empty?\n match_against_hash(@keyword_matchers)\n else\n match_against_array(@array_matchers)\n end\n end", "def match\n true\n end", "def team_matcher\n @teams_matcher ||= FuzzyStringMatcher.new( all_teams, :name )\n end", "def matches(ext); end", "def predicate_matchers\n @predicate_matchers ||= {}\n end", "def predicate_matchers\n @predicate_matchers ||= {}\n end", "def compare_matchers(key, new_matcher, matcher)\n # Priority arrays come before \"provides\"\n if new_matcher[:value].is_a?(Array) != matcher[:value].is_a?(Array)\n return new_matcher[:value].is_a?(Array) ? -1 : 1\n end\n\n cmp = super\n if cmp == 0\n # Sort by class name (ascending) as well, if all other properties\n # are exactly equal\n if new_matcher[:value].is_a?(Class) && !new_matcher[:override]\n cmp = compare_matcher_properties(new_matcher, matcher) { |m| m[:value].name }\n if cmp < 0\n Chef::Log.warn \"You are overriding #{key} on #{new_matcher[:filters].inspect} with #{new_matcher[:value].inspect}: used to be #{matcher[:value].inspect}. Use override: true if this is what you intended.\"\n elsif cmp > 0\n Chef::Log.warn \"You declared a new resource #{new_matcher[:value].inspect} for resource #{key}, but it comes alphabetically after #{matcher[:value].inspect} and has the same filters (#{new_matcher[:filters].inspect}), so it will not be used. Use override: true if you want to use it for #{key}.\"\n end\n end\n end\n cmp\n end", "def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end", "def find_all_actions_matching(matcher)\n actions.find_all { |act| matcher === act.name }\n end", "def expectation_keywords\n spec_keywords(\"should\").merge(spec_keywords(\"should_not\"))\n end", "def any_of(*matcher_names, &action)\n matcher_names.each do |name|\n append_action(matchers[name], action)\n end\n self\n end", "def &(matcher)\n AndMatcher.new([self,matcher])\n end", "def matcher=(_arg0); end", "def defclassmatch(method,*args,&block)\n @defclassmatch_dispatch_info ||= {} # setup the methods in an instance variable\n @defclassmatch_dispatch_info[method] ||= [] # setup the ordered array for the method the first time\n @defclassmatch_dispatch_info[method] << {:test => Defmatch.signiture_match(method,args), :block => block} # add the hash for the test proc and the run proc (block given) to the list of matchers\n\n # define dispatch method the first time\n unless respond_to?(method)\n eigenclass = class << self; self; end\n eigenclass.instance_eval do\n define_method(method) do |*args|\n self.instance_variable_get(:@defclassmatch_dispatch_info)[method].each do |hash|\n if hash[:test].call(*args)\n return self.instance_exec(*args,&hash[:block])\n end\n end\n raise ArgumentError, \"No function clause matching arguments\"\n end\n end\n end\n end", "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end", "def matches\n\t\t\tcompetition.matches\n\t\tend", "def regexps; end", "def match_fn(*qo_matchers)\n -> target { match(target, *qo_matchers) }\n end", "def rspec_matcher?(target)\n target.respond_to?(:matches?)\n end", "def matches(_ext); end", "def matches(_ext); end", "def match_selector(...)\n Matchers::MatchSelector.new(...)\n end", "def submatcher; end", "def submatcher; end", "def define_match_any_of\n klass.send(:define_method, :match_any_of) do |tags|\n if tags.empty?\n str(\"\")\n else\n tags.map { |tag| str(tag) }.inject do |tag_chain, tag|\n tag_chain.send :|, tag\n end\n end\n end\n end", "def initialize(matcher)\n @matcher = matcher\n end", "def method_missing(sym, *args, &block) # :nodoc:\n return Spec::Matchers::Be.new(sym, *args) if sym.to_s.starts_with?(\"be_\")\n return has(sym, *args) if sym.to_s.starts_with?(\"have_\")\n super\n end", "def matcher(*array_matchers, **keyword_matchers, &fn)\n Qo::Matchers::GuardBlockMatcher.new(*array_matchers, **keyword_matchers, &fn)\n end", "def patterns; end", "def class_rules\n [\n Rule.new(:error, 4..6, \"Description Markdown\", \"Above your class you need documentation that covers the scope, and the usage of your plugin.\", proc do |json|\n json[:body_md] && json[:body_md].empty?\n end),\n Rule.new(:warning, 30, \"Tags\", \"This plugin does not include `@tags tag1, tag2` and thus will be harder to find in search.\", proc do |json|\n json[:tags] && json[:tags].empty?\n end),\n Rule.new(:warning, 29, \"References\", \"Ideally, you have a reference implementation of your plugin that you can show to people, add `@see org/repo` to have the site auto link it.\", proc do |json|\n json[:see] && json[:see].empty?\n end),\n Rule.new(:error, 8..27, \"Examples\", \"You should include some examples of common use-cases for your plugin.\", proc do |json|\n json[:example_code] && json[:example_code].empty?\n end)\n ]\n end", "def matches?(klass); end", "def match\n @matches = attributes_enumerator.map do |(type, value), index|\n attribute_name = self.class.names[index]\n attributes.store(\n attribute_name, type.match(value, context: @context.dup)\n )\n end\n return if (failures = @matches.select(&:invalid?)).empty?\n failures.unshift(failure).reduce(:merge!)\n end", "def parse_matcher(matcher)\n matcher\n end", "def have_fields(fields)\n HaveFieldsMatcher.new(fields)\n end", "def matching_opts(arg, list, i)\n\t\t# Returns field of all exactly or abbreviated matching options.\n\t\tm = @option.values.select { |o| o.match?(arg, list, i) == :exact }\n\t\tif m.empty?\n\t\t\t@option.values.select { |o| o.match?(arg, list, i) == :abbrev }\n\t\telse\n\t\t\tm\n\t\tend \n\tend", "def have_css_classes(names) # rubocop:disable Style/PredicateName\n CustomMatchers::NodeCssClassMatcher.new names\nend", "def all_specs\n files_matching %r%^spec/.*_spec\\.rb$%\n end", "def package_id_matchers\n config.package_id_matchers\n end", "def build_matches rule_selectors: []\n exclude_default_roles = ENV.fetch(\n 'RISK_RULE_QUERY_EXCLUDE_DEFAULT_ROLES', RISK_RULE_QUERY_EXCLUDE_DEFAULT_ROLES\n ).to_s == 'true'\n\n role_attrs = exclude_default_roles ? \"{is_default: 'false'}\" : ''\n\n rule_selectors.collect.with_index do |selector, index|\n rule_selector = selector.map do |k,v|\n \"#{k}: '#{v}'\"\n end.join(', ')\n\n \"MATCH (ns:Namespace)<-[:SCOPE]-(ro#{index}:Role #{role_attrs})<-[:GRANT]-(:Rule {#{rule_selector}})\"\n end\n end", "def environment_matchers=(_arg0); end" ]
[ "0.8306234", "0.8095706", "0.7902726", "0.7770168", "0.77267176", "0.7543323", "0.7486974", "0.7264918", "0.70219404", "0.70219404", "0.7006018", "0.7006018", "0.68073285", "0.67789936", "0.64395064", "0.643461", "0.63800454", "0.6373047", "0.6373047", "0.6272541", "0.62189114", "0.62069833", "0.61810094", "0.6080648", "0.60495186", "0.6047498", "0.60324556", "0.6011664", "0.5954791", "0.5924461", "0.59189403", "0.58956546", "0.585498", "0.5838312", "0.58343345", "0.58213794", "0.5815456", "0.5787104", "0.57542306", "0.5749884", "0.5749884", "0.5747029", "0.5741618", "0.5726089", "0.5722", "0.5712009", "0.5697008", "0.5691408", "0.56899536", "0.56813645", "0.5675434", "0.5666948", "0.56605417", "0.5629917", "0.56281567", "0.5622368", "0.5622233", "0.5617612", "0.56069976", "0.56041235", "0.55762863", "0.55674195", "0.556013", "0.5552517", "0.55509454", "0.55509454", "0.5547849", "0.55460197", "0.5540834", "0.5533177", "0.5524808", "0.5501271", "0.54944706", "0.5493083", "0.5487008", "0.54806083", "0.54777014", "0.54602754", "0.5453496", "0.5444962", "0.5444962", "0.5444545", "0.5434326", "0.5434326", "0.5433975", "0.53746134", "0.5358667", "0.53571326", "0.5346739", "0.5345273", "0.534429", "0.5329409", "0.5325889", "0.53219557", "0.5313501", "0.5302267", "0.5298471", "0.5278675", "0.5260389", "0.5252981" ]
0.8092014
2
Performs a merge on the repository.
def merge(commits, no_ff: false) cmd = %w[merge --no-edit --no-log] cmd << '--no-ff' if no_ff cmd += Array(commits) GitCommandResult.new(*run_git(cmd)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(user_name, repo_name, params={})\n normalize! params\n filter! VALID_MERGE_PARAM_NAMES, params\n assert_required_keys REQUIRED_MERGE_PARAMS, params\n\n post_request(\"/repos/#{user_name}/#{repo_name}/merges\", params)\n end", "def merge_commit\n @org = Org.find(params[:id])\n authorize @org\n\n @target_org = Org.find_by(id: merge_params[:target_org])\n\n if @target_org.present?\n if @target_org.merge!(to_be_merged: @org)\n msg = \"Successfully merged '#{@org.name}' into '#{@target_org.name}'\"\n redirect_to super_admin_orgs_path, notice: msg\n else\n msg = _('An error occurred while trying to merge the Organisations.')\n redirect_to admin_edit_org_path(@org), alert: msg\n end\n else\n msg = _('Unable to merge the two Organisations at this time.')\n redirect_to admin_edit_org_path(@org), alert: msg\n end\n rescue JSON::ParserError\n msg = _('Unable to determine what records need to be merged.')\n redirect_to admin_edit_org_path(@org), alert: msg\n end", "def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end", "def merge(repo, base, head, options = {})\n params = {\n :base => base,\n :head => head\n }.merge(options)\n post \"#{Repository.path repo}/merges\", params\n end", "def merge!; end", "def merge(number)\n request = get_request_by_number(number)\n if request.head.repo\n message = \"Accept request ##{request.number} \" +\n \"and merge changes into \\\"#{local.target}\\\"\"\n command = \"merge -m '#{message}' #{request.head.sha}\"\n puts\n puts \"Request title:\"\n puts \" #{request.title}\"\n puts\n puts \"Merge command:\"\n puts \" git #{command}\"\n puts\n puts git_call(command)\n else\n print_repo_deleted(request)\n end\n end", "def merge(merge_branch, options = {})\n merge_analysis = rugged.merge_analysis(merge_branch.name)\n if merge_analysis.include?(:fastforward)\n rugged.references.update(helper.head_ref, merge_branch.target_id)\n rugged.checkout_head(strategy: :force)\n elsif merge_analysis.include?(:normal)\n ours = helper.head_target\n theirs = merge_branch.target\n merge_base = rugged.merge_base(ours, theirs)\n raise(NoCommonCommit) unless merge_base\n\n base = rugged.rev_parse(merge_base)\n index = ours.tree.merge(theirs.tree, base.tree)\n\n commit_message =\n if index.conflicts?\n raise(MergeConflict) unless block_given?\n\n message = yield(index, rugged, helper.working_directory)\n raise(MergeConflict) unless message\n\n index.conflict_cleanup\n message\n else\n \"Merge branch '#{helper.head_branch.name}' of #{helper.head_remote.url}\"\n end\n\n helper.commit_create(\n commit_message,\n index.write_tree(rugged),\n [ours, theirs],\n options\n )\n rugged.checkout_head(strategy: :force)\n end\n\n self\n end", "def git_merge(branch = \"origin/#{current_default_branch}\")\n mysystem(\"git merge #{branch}\")\n end", "def merge(build)\n Rails.logger.info(\"Trying to merge branch: #{build.branch} to master after build id: #{build.id}\")\n\n checkout_log, status = Open3.capture2e(\"git checkout master && git pull\")\n raise_and_log(\"Was unable checkout and pull master:\\n\\n#{checkout_log}\") if status.exitstatus != 0\n\n commit_message = \"Kochiku merge of branch #{build.branch} for build id: #{build.id} ref: #{build.ref}\"\n merge_log, status = Open3.capture2e(merge_env, \"git merge --no-ff -m '#{commit_message}' #{build.ref}\")\n abort_merge_and_raise(\"git merge --abort\",\n \"Was unable to merge your branch:\\n\\n#{merge_log}\") unless status.success?\n\n push_log, status = Open3.capture2e(\"git push origin master\")\n rebase_log, second_push_log = recover_failed_push unless status.success?\n\n [checkout_log, merge_log, push_log, rebase_log, second_push_log].join(\"\\n\")\n end", "def merge(source); end", "def merge(treeish=upstream_branch)\n sandbox do |git, work_tree, index_file|\n des, src = safe_rev_parse(branch, treeish)\n base = des.nil? ? nil : git.merge_base({}, des, src).chomp(\"\\n\")\n \n case\n when base == src\n break\n when base == des\n # fast forward situation\n grit.update_ref(branch, src)\n else\n # todo: add rebase as an option\n \n git.read_tree({\n :m => true, # merge\n :i => true, # without a working tree\n :trivial => true, # only merge if no file-level merges are required\n :aggressive => true, # allow resolution of removes\n :index_output => index_file\n }, base, branch, src)\n \n commit!(\"gitgo merge of #{treeish} into #{branch}\", \n :tree => git.write_tree.chomp(\"\\n\"),\n :parents => [des, src]\n )\n end\n \n reset\n end\n \n self\n end", "def merge; end", "def update\n # Reset --hard repo before update\n reset! if @settings[:reset_before_update]\n\n # Fetch changes from origin\n repo.fetch('origin', credentials: credentials)\n\n # Create the merged index in memory\n merge_index = repo.merge_commits(local_branch, remote_branch)\n\n # Complete the merge by comitting it\n opts = {\n parents: [local_branch, remote_branch],\n tree: merge_index.write_tree(repo),\n update_ref: update_ref,\n message: update_message,\n author: commit_author,\n committer: commit_author\n }\n Rugged::Commit.create(repo, opts)\n\n reload!\n end", "def merge(join_request)\n work = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n work.checkout(join_request.target_stream)\n work.fetch\n work.pull\n work.merge(join_request.source_stream)\n work.branch(join_request.source_stream).delete\n work.push\n work.fetch\n work.pull\n end", "def updateRepo()\n $repo.checkout(BRANCH)\n\n # fetch\n remote = $repo.remotes['' << REMOTE]\n remote.fetch()\n\n # merge\n distant_commit = $repo.branches['' << REMOTE << '/' << BRANCH].target\n $repo.references.update($repo.head, distant_commit.oid)\nend", "def merge\n @mergeit.merge_data(@input_files)\n end", "def merge(branch, message = 'merge', opts = {})\n self.lib.merge(branch, message, opts)\n end", "def merge_and_push\n Rails.logger.info(\"Trying to merge branch: #{@build.branch} to master after build id: #{@build.id}\")\n\n begin\n git_fetch_and_reset\n\n merge_log = merge_to_master\n\n push_log = push_to_remote\n rescue GitFetchFailedError, GitPushFailedError\n tries = (tries || 0) + 1\n if tries < 3\n sleep(10 * tries)\n retry\n else\n raise\n end\n end\n\n [merge_log, push_log].join(\"\\n\")\n end", "def persist_merge\n updater.update\n end", "def merge(branch_name)\n remote_commit = last_commit(remote_branch_from_local(branch_name))\n\n @rugged_repository.references.update(rugged_repository.head, remote_commit.oid)\n end", "def add_merge(options={})\n if message = options[:message]\n message = \"-m '#{message}'\"\n end\n branch = options[:branch] || \"foobar\"\n base = options[:base] || \"master\"\n sh(\"git checkout -b #{branch} 2>&1 && echo asd >> xxx && git commit -am 'xxx' && git checkout #{base} 2>&1 && git merge #{branch} --no-ff #{message}\")\n commits = last_commits\n return commits[0], commits[1]\n end", "def successfull_merge_or_nothing(i,j)\n # try a merge and determinize inside a transaction on the ufds\n @ufds.transactional do\n merge_and_determinize(i, j)\n end\n end", "def merge_pull(repo, pull_number, options = {})\n put \"#{Repository.path repo}/pulls/#{pull_number}/merge\", options\n end", "def merge_to_project(options = {})\n $merge = true \n @opt = {\n :proj_id => nil, \n :person_id => nil,\n :postfix_otu_names => false,\n :postfix_chr_names => false\n }.merge!(options.symbolize_keys)\n\n return false if !@opt[:proj_id] || !@opt[:person_id]\n return false if !@proj = Proj.find(@opt[:proj_id])\n return false if !@person = Person.find(@opt[:person_id])\n\n $proj_id = @proj.id \n $person_id = @person.id\n\n begin\n Proj.transaction do \n # try and do a little matching/transfer in a few cases (could also extend to Keywords)\n self.content_types.each do |o|\n if ct = ContentType.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n # update the templates \n self.content_templates_content_types.each do |ctct|\n if ctct.content_type.name == ct.name\n ctct.content_type = ct\n ctct.save\n end\n end\n \n # update the content\n self.contents.each do |c|\n if c.content_type.name == ct.name\n c.content_type = ct\n c.save\n end\n end \n\n # update the mapped_chr_groups\n self.chr_groups.each do |cg|\n if !cg.content_type.blank? && cg.content_type.name == ct.name\n cg.content_type = ct\n cg.save\n end\n end \n # we have to only delete the merged object below\n end\n end\n\n self.genes.each do |g|\n if g = Gene.find(:first, :conditions => {:proj_id => @proj.id, :name => g.name})\n self.primers.each do |p|\n p.gene = g\n p.save\n end\n self.seqs.each do |s|\n s.gene = g\n s.save\n end\n end\n end\n\n # loop the remaining types\n [:has_many, :has_one, :has_and_belongs_to_many].each do |rel|\n Proj.reflect_on_all_associations(rel).collect{|o| o.name}.each do |r| # r is the class name \n next if r == :text_content_types\n case r\n when :content_types \n self.send(r).each do |o|\n if @ct = ContentType.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n o.destroy \n else\n o.proj_id = @opt[:proj_id]\n o.save\n end \n end \n \n when :genes\n self.send(r).each do |o|\n if @g = Gene.find(:first, :conditions => {:proj_id => @proj.id, :name => o.name})\n o.destroy \n else\n o.proj_id = @opt[:proj_id]\n o.save\n end \n end \n \n when :people\n # do nothing, these remain in the project to be deleted later, otherwise they get touched an pwds get borked\n\n else \n t = self.send(r).each do |o|\n @o = o\n @r = r\n o.name = \"#{o.name} [from: #{o.proj_id}]\" if (@opt[:postfix_otu_names] && o.class == Otu) || (@opt[:postfix_chr_names] && o.class == Chr)\n o.proj_id = @opt[:proj_id]\n o.save\n end\n end\n end\n end # end rel types\n end # end transaction\n\n rescue Exception => e\n $merge = false\n raise \"#{e} o:(#{@o.to_yaml}) o_class: #{@o.class.to_s} r:(#{@r}) p:(#{@proj.id})\"\n end\n $merge = false\n true\n end", "def merge?(owner, repo, number)\n\t\t\tPullRequests.get(\"/repos/#{owner}/#{repos}/pulls/#{number}/merge\", headers: @auth)\n\t\tend", "def merge(options={})\n options.merge! :from => DEFAULT_REMOTE_BRANCH, :to => DEFAULT_LOCAL_REF\n theirs = repo.rev_parse options[:from]\n ours = repo.rev_parse options[:to]\n\n analysis = repo.merge_analysis(theirs)\n return analysis if analysis.include? :up_to_date\n\n base = repo.rev_parse(repo.merge_base(ours, theirs))\n index = ours.tree.merge(theirs.tree, base.tree)\n\n raise MergeConflict if index.conflicts?\n\n Rugged::Commit.create(repo, {\n parents: [ours, theirs],\n tree: index.write_tree(repo),\n message: \"Merged `#{options[:from]}` into `#{options[:to].sub(\"refs/heads/\", \"\")}`\",\n update_ref: options[:to]\n })\n end", "def merge_pull_request\n git.merge pull_request.branch\n end", "def merge_to(data)\n\n # prevent cross merging tickets\n target_ticket = Ticket.find_by(id: data[:ticket_id])\n raise 'no target ticket given' if !target_ticket\n raise Exceptions::UnprocessableEntity, 'ticket already merged, no merge into merged ticket possible' if target_ticket.state.state_type.name == 'merged'\n\n # check different ticket ids\n raise Exceptions::UnprocessableEntity, 'Can\\'t merge ticket with it self!' if id == target_ticket.id\n\n # update articles\n Transaction.execute do\n\n Ticket::Article.where(ticket_id: id).each(&:touch)\n\n # quiet update of reassign of articles\n Ticket::Article.where(ticket_id: id).update_all(['ticket_id = ?', data[:ticket_id]]) # rubocop:disable Rails/SkipsModelValidations\n\n # mark target ticket as updated\n # otherwise the \"received_merge\" history entry\n # will be the same as the last updated_at\n # which might be a long time ago\n target_ticket.updated_at = Time.zone.now\n\n # add merge event to both ticket's history (Issue #2469 - Add information \"Ticket merged\" to History)\n target_ticket.history_log(\n 'received_merge',\n data[:user_id],\n id_to: target_ticket.id,\n id_from: id,\n )\n history_log(\n 'merged_into',\n data[:user_id],\n id_to: target_ticket.id,\n id_from: id,\n )\n\n # create new merge article\n Ticket::Article.create(\n ticket_id: id,\n type_id: Ticket::Article::Type.find_by(name: 'note').id,\n sender_id: Ticket::Article::Sender.find_by(name: 'Agent').id,\n body: 'merged',\n internal: false,\n )\n\n # reassign links to the new ticket\n # rubocop:disable Rails/SkipsModelValidations\n Link.where(\n link_object_source_id: Link::Object.find_by(name: 'Ticket').id,\n link_object_source_value: id,\n ).update_all(link_object_source_value: data[:ticket_id])\n Link.where(\n link_object_target_id: Link::Object.find_by(name: 'Ticket').id,\n link_object_target_value: id,\n ).update_all(link_object_target_value: data[:ticket_id])\n # rubocop:enable Rails/SkipsModelValidations\n\n # link tickets\n Link.add(\n link_type: 'parent',\n link_object_source: 'Ticket',\n link_object_source_value: data[:ticket_id],\n link_object_target: 'Ticket',\n link_object_target_value: id\n )\n\n # set state to 'merged'\n self.state_id = Ticket::State.find_by(name: 'merged').id\n\n # rest owner\n self.owner_id = 1\n\n # save ticket\n save!\n\n # touch new ticket (to broadcast change)\n target_ticket.touch # rubocop:disable Rails/SkipsModelValidations\n end\n true\n end", "def merge(other); end", "def git_merge_base(target, source)\n status, out, err = exec!(\"git merge-base #{target} #{source}\")\n out.strip\n rescue Braid::Commands::ShellExecutionError\n nil\n end", "def merge(with); end", "def perform_additional_merge_operations!(other)\n end", "def include other_branch\n Dir.chdir @root do\n cmd = \"git merge --no-ff --no-commit \\\"#{other_branch}\\\"\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n if /Not a git repository/.match stderr\n raise NotARepositoryError\n elsif /Automatic merge failed/.match stdout\n return false\n else\n raise Error, stderr\n end\n end\n end\n return true\n end", "def pull()\n\n\t\tbegin\n\t\t\t@git.fetch('origin')\n\t\trescue Git::GitExecuteError => e\n\t\t\traise DownloadException, \"Error al bajar los cambios desde el servidor\" , caller\n\t\telse\n\t\t\tbegin\t\n\t\t\t\tmerge_message = @git.gcommit('FETCH_HEAD').message\n\t\t\t\t@git.merge(\"origin/master\",\"-m #{merge_message}: merge\")\n\t\t\trescue Git::GitExecuteError => e \n\t\t\t\tif(e.to_s.include?(\"not something we can merge\")) or (e.to_s.include?(\"Not a valid object name FETCH_HEAD\"))\n\t\t\t\t\tLogger::log(@carpeta, Logger::INFO,\"El repositorio esta vacio\") \n\t\t\t\telsif(e.to_s.include?(\"Automatic merge failed\")) #hay conflicto\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t@git.each_conflict{ |f| \n\n\t\t\t\t\t\tours_commit = @git.gcommit('ORIG_HEAD')\n\t\t\t\t\t\tours_author = ours_commit.author.name\n\n\t\t\t\t\t\ttheirs_commit = @git.gcommit('MERGE_HEAD')\n\t\t\t\t\t\ttheirs_author = theirs_commit.author.name\n\n\t\t\t\t\t\tif (ours_author == theirs_author)\n\t\t\t\t\t\tadd_ours = \" (\"+ours_author+\" v1)\"\n\t\t\t\t\t\tadd_theirs = \" (\"+theirs_author+\" v2)\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\tadd_ours = \" (\"+ours_author+\")\"\n\t\t\t\t\t\tadd_theirs = \" (\"+theirs_author+\")\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tnombre = f.chomp(File.extname(f))\n\n\t\t\t\t\t\tfno = nombre+add_ours+File.extname(f)\n\n\t\t\t\t\t\t@git.checkout_file(\"--ours\",f)\n\t\t\t\t\t\tFile.rename(@project_path+\"/\"+f,@project_path+\"/\"+fno)\n\n\t\t\t\t\t\tfnt = nombre+add_theirs+File.extname(f)\n\n\t\t\t\t\t\t@git.checkout_file(\"--theirs\",f)\n\t\t\t\t\t\tFile.rename(@project_path+\"/\"+f,@project_path+\"/\"+fnt)\n\t\t\t\t\n\t\t\t\t\t\t@git.add(fno)\n\t\t\t\t\t\t@git.add(fnt)\n\t\t\t\t\t\t@git.remove(f)\n\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t@git.commit(\"#{merge_message}: merge commit\")\n\t\t\t\telse\t\t\t\t\n\t\t\t\t\traise DownloadException, \"Error al bajar los cambios desde el servidor\" , caller \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def branch_and_merge(name=next_branch_tag(), actor=nil, &block)\n raise InvalidDbError if @stale\n\n # Force a commit before the merge\n # TODO: determine if this is really necessary\n staging.sync\n staging.commit('auto-commit before branch-and-merge', self.actor)\n\n # ensure staging index is nil [in case branch name was re-used]\n unstage\n\n # save old actor\n old_actor = self.actor\n self.actor = actor if actor\n\n sha = commits.last ? commits.last.id : nil\n tag = create_branch(name, sha)\n set_branch(tag, self.actor)\n\n # execute block in a transaction\n rv = true\n begin\n transaction(&block)\n merge_branch(tag, self.actor)\n rescue Exception =>e\n rv = false\n end\n\n # restore actor\n self.actor = old_actor if actor\n\n rv\n end", "def merge_if_exists!\n t = merge_if_exists || self\n t.save!\n end", "def merge_branch( tag=@current_branch, actor=nil )\n raise \"Invalid branch '#{tag}'\" if not is_head?(tag)\n\n tag.gsub!(/['\\\\]/, '')\n\n # switch to master branch\n set_branch(DEFAULT_BRANCH, actor)\n\n # merge target branch to master branch\n\n rv = nil\n begin\n rv = exec_git_cmd(\"git merge -n --no-ff --no-log --no-squash '#{tag}'\", \n actor)\n rescue CommandError => e\n $stderr.puts e.message\n end\n rv\n end", "def merge\n @user = User.find(params[:id])\n authorize @user\n\n if params[:id] == params[:merge_id]\n flash.now[:alert] = _(\"You attempted to merge 2 accounts with the same email address.\n Please merge with a different email address.\")\n else\n merge_accounts\n end\n\n # After merge attempt get departments and plans\n @departments = @user.org.departments.order(:name)\n @plans = Plan.active(@user).page(1)\n\n render :edit\n end", "def merge_trees(base_treeish, local_treeish, remote_treeish)\n invoke(:merge_recursive, base_treeish, \"-- #{local_treeish} #{remote_treeish}\")\n true\n rescue ShellExecutionError => error\n # 'CONFLICT' messages go to stdout.\n raise MergeError, error.out\n end", "def set_merge\n @merge = Merge.find(params[:id])\n end", "def process_pr(pr, cmd)\n head = pr[:head]\n repo = head[:repo]\n\n pending_status(pr, 'Merge in progress.')\n\n return true if skip_pr?(pr)\n\n begin\n cmd.run 'git fetch', repo[:ssh_url], head[:ref] if repo\n\n merge_status = cmd.run! 'git merge --no-ff --no-edit', head[:sha]\n\n if merge_status.success?\n success_status(pr, \"Merge with '#{@base_branch}' was successful.\")\n else\n cmd.run 'git merge --abort'\n\n message = \"Failed to merge '#{head[:ref]} with #{@base_branch}.\"\n failure_status(pr, message)\n end\n rescue => e\n failure_status(pr, \"Merge encountered an error: #{e.message}.\")\n\n return false\n end\n\n true\n end", "def merge_pull_request(repo, number, commit_message='', options = {})\n put \"#{Repository.path repo}/pulls/#{number}/merge\", options.merge({:commit_message => commit_message})\n end", "def update\n respond_to do |format|\n if @merge.update(merge_params)\n format.html { redirect_to @merge, notice: 'Merge was successfully updated.' }\n format.json { render :show, status: :ok, location: @merge }\n else\n format.html { render :edit }\n format.json { render json: @merge.errors, status: :unprocessable_entity }\n end\n end\n end", "def merge_builds merged_build\n FileUtils.mkdir_p @temp_root\n debug_msg \"Merging #{merged_build}\"\n require \"sdoc/merge\"\n \n tmp = temp_dir\n target = File.join @public_dir, merged_build.to_s\n \n title = merged_build.builds.map do |build| \n automation_by_name(build.name).name + \" v#{build.version}\"\n end.join(', ')\n names = merged_build.builds.map do |build| \n automation_by_name(build.name).short_name\n end.join(',')\n urls = merged_build.builds.map do |build|\n '../' + build.to_s\n end.join(' ')\n \n options = []\n options << \"-o\" << tmp\n options << '--title' << title\n options << '--names' << names\n options << '--urls' << urls\n merged_build.builds.each do |build|\n options << File.join(@public_dir, build.to_s)\n end\n SDoc::Merge.new.merge(options)\n \n FileUtils.rm_rf target if File.exists? target\n FileUtils.cp_r File.join(tmp, '.'), target, :preserve => true \n \n zip_tmp = merge_zip merged_build\n FileUtils.cp File.join(zip_tmp, 'rdoc.zip'), target, :preserve => true\n clean_up\n end", "def merge_branch_to_master(branch, tag, message, repo_path)\n\tDir.chdir(repo_path) do |path|\n\t\tcmds = [\n\t\t\t\t\"git checkout master\",\n\t\t\t\t\"git merge --no-ff -Xtheirs #{branch}\",\n\t\t\t\t\"git tag -a -f #{tag} -m '#{message}'\"\n\t\t\t\t]\n\t\tcmds.insert(0, \"git branch master origin/master\") unless branch_exists?(path, \"master\")\n\t\tapprove_and_execute(cmds, \"in #{path}\")\n\tend\nend", "def process!()\n # Regarding updates or deletions of :badge_id\n # --------------------------------------------------------------------\n # This has to change only if it refers to a duplicate row;\n # that is, a row that will become a duplicate (and it will have to\n # be deleted) once that the update (and translation) process has been\n # completed.\n #\n # Thus, each linked entity that has a reference to one of these\n # possibly duplicate IDs has to be updated with the new destination value\n # (of which they are the duplicate); else, the value for :badge_id can stay untouched.\n\n merge_done = false\n if check\n process_text_log << \"\\r\\nMerging '#{ @slave_swimmer.complete_name }' (id: #{ @slave_swimmer.id}) => '#{@master_swimmer.complete_name}' (id: #{@master_swimmer.id })...\\r\\n\\r\\n\"\n sql_diff_text_log << \"-- Merging '#{ @slave_swimmer.complete_name }' (id: #{ @slave_swimmer.id}) => '#{@master_swimmer.complete_name}' (id: #{@master_swimmer.id })...\\r\\n\\r\\n\"\n\n # Define merge schema (involved entities)\n @involved_entities = SwimmerMerger.get_involved_entities\n\n # Collect entity row to merge\n @involved_entities.each do |involved_entity|\n collect_swimmer_inolved_entity( involved_entity )\n end\n\n # Collect badges to merge (both swimmers have badges for the same season)\n collect_badges_to_merge\n\n # N.B. Checks for some recalculation needed should be performed before update and delete phases\n # Check if Goggle Cup standards needs recalculation\n needs_goggle_cup_recalculation = needs_goggle_cup_recalculation?\n\n # Check if seasonal personal standards needs recalculation\n needs_season_personal_standard_recalculation = needs_season_personal_standard_recalculation?\n\n # Perform the merge: update and delete phases\n # Bail out from any of these, if something goes wrong:\n merge_done = update_phase! && create_alias_phase! && delete_phase! && execute_delete!( Swimmer )\n\n if merge_done\n if @row_collectors[ MeetingIndividualResult.table_name ].non_duplicates_rows.size > 0\n # Recalculate personal bests\n process_text_log << \"\\r\\n\\r\\nPersonal-bests recalculation needed...\\r\\n\"\n swimmer_best_updater = SwimmerPersonalBestUpdater.new( @master_swimmer )\n swimmer_best_updater.scan_for_personal_best!\n sql_diff_text_log << swimmer_best_updater.sql_diff_text_log\n process_text_log << \"Personal-bests recalculation done!\\r\\n\"\n end\n\n # TODO if needed, also recalculate goggle_cup_standards\n if needs_goggle_cup_recalculation\n process_text_log << \"\\r\\n\\r\\n*** I M P O R T A N T ***\\r\\n\"\n process_text_log << \"Goggle-cup standards recalculation needed...\\r\\n\"\n end\n\n # TODO if needed, also recalculate season_personal_standards\n if needs_season_personal_standard_recalculation?\n process_text_log << \"\\r\\n\\r\\n*** I M P O R T A N T ***\\r\\n\"\n process_text_log << \"Season personal standards recalculation needed...\\r\\n\"\n end\n end\n end\n merge_done\n end", "def merge_with(master, ignored_attr = [])\n # Just in case a user tries to merge a contact with itself,\n # even though the interface prevents this from happening.\n return false if master == self\n\n merge_attr = self.merge_attributes\n # ------ Remove ignored attributes from this contact\n ignored_attr.each { |attr| merge_attr.delete(attr) }\n\n # Perform all actions in an atomic transaction, so that if one part of the process fails,\n # the whole merge can be rolled back.\n Contact.transaction do\n\n # ------ Merge attributes: ensure only model attributes are updated.\n model_attributes = merge_attr.dup.reject{ |k,v| !master.attributes.keys.include?(k) }\n master.update_attributes(model_attributes)\n\n # ------ Merge 'belongs_to' and 'has_one' associations\n {'user_id' => 'user', 'lead_id' => 'lead', 'assigned_to' => 'assignee'}.each do |attr, method|\n unless ignored_attr.include?(attr)\n master.send(method + \"=\", self.send(method))\n end\n end\n \n # ------ Merge address associations\n master.address_attributes.keys.each do |attr|\n unless ignored_attr.include?(attr)\n master.send(attr + \"=\", self.send(attr))\n end\n end\n\n # ------ Merge 'has_many' associations\n self.tasks.each { |t| t.asset = master; t.save! }\n self.emails.each { |e| e.mediator = master; e.save! }\n self.comments.each { |c| c.commentable = master; c.save! }\n\n # Find all AccountContact records with the duplicate contact,\n # and only add the master contact if it is not already added to the account.\n AccountContact.find_all_by_contact_id(self.id).each do |ac|\n unless ac.account.contacts.include?(master)\n ac.contact_id = master.id; ac.save!\n end\n end\n \n # Find all ContactOpportunity records with the duplicate contact,\n # and only add the master contact if it is not already added to the opportunity.\n ContactOpportunity.find_all_by_contact_id(self.id).each do |co|\n unless co.opportunity.contacts.include?(master)\n co.contact_id = master.id; co.save!\n end\n end\n\n # Merge tags\n all_tags = (self.tags + master.tags).uniq\n master.tag_list = all_tags.map(&:name).join(\", \")\n \n # Call the merge_hook - useful if you have custom actions that need to happen during a merge\n master.merge_hook(self)\n\n if master.save!\n # Update any existing aliases that were pointing to the duplicate record\n ContactAlias.find_all_by_contact_id(self.id).each do |ca|\n ca.update_attribute(:contact, master)\n end\n\n # Create the contact alias and destroy the merged contact.\n if ContactAlias.create(:contact => master,\n :destroyed_contact_id => self.id)\n # Must force a reload of the contact, and shake off all migrated assets.\n self.reload\n self.destroy\n end\n end\n end # transaction\n end", "def merge(*sources); end", "def commit_and_merge\n Dir.glob(\"**/*~\").each do |filename|\n if File.file?(filename)\n File.delete(filename)\n end\n end\n cd(@project_name) do\n now = Time.now.to_s\n g = Git.open('.')\n g.add('.')\n g.commit(\"generated #{now}\")\n g.branch('master').checkout\n\n # it's safer to have the user do the rebase so tell them how\n puts 'If the files on the \"generated\" branch are ok, then run:'\n puts\n puts ' git rebase generated master'\n puts\n puts 'to update your master branch with the new generated files.'\n puts 'Note, if there are merge problems, resolve them then run:'\n puts\n puts ' git rebase --continue'\n puts\n end\n end", "def _do_rh_merge(result, key, data, refuse_discordance = false)\n value = data[key]\n\n return if _rh_merge_do_add_key(result, key, value)\n\n return if _rh_merge_recursive(result, key, data)\n\n return if refuse_discordance\n\n return unless _rh_struct_changing_ok?(result, key, data)\n\n return unless _rh_merge_ok?(result, key)\n\n _rh_merge_do_upd_key(result, key, value)\n end", "def merge\n @parent_vendor = Vendor.find(params[:id])\n @child_vendor = Vendor.find(params[:vendor_id])\n\n if @parent_vendor.id != @child_vendor.id\n @parent_vendor.delay.merge!(@child_vendor, current_user)\n notice = \"Your sous chef is working to merge vendor #{@child_vendor.name}. It should be done soon.\"\n else\n notice = \"Sorry, could not merge the vendors.\"\n end\n\n redirect_to edit_admin_vendor_path(@parent_vendor), notice: notice\n end", "def merge(opts); end", "def merge(...)\n self.clone.merge!(...)\n end", "def gdal_merge(input_files, output_file, merge_strategy = :lossless)\n return nil if input_files.length == 0\n return CDBTool.link_output(input_files[0], output_file) if input_files.length == 1\n\n command = case merge_strategy\n when :lossless\n \"gdal_merge.py -o #{output_file} -co BIGTIFF=YES -co COMPRESS=LZW -co NUM_THREADS=ALL_CPUS -co TILED=YES -n 0 -a_nodata 0 #{input_files.join(\" \")}\"\n when :lossy\n \"gdal_merge.py -o #{output_file} -co BIGTIFF=YES -co COMPRESS=JPEG -co TILED=YES #{input_files.join(\" \")}\"\n end\n\n merge = Mixlib::ShellOut.new(command, live_stdout: $stdout, live_stderr: $stderr)\n\n if File.exists?(output_file)\n puts \"Output exists, skipping merge command.\"\n else\n puts command\n merge.run_command\n $mosaic.log(\"#{output_file},#{File.size(output_file)},#{merge.execution_time}s\")\n end\nend", "def do_update\n git = ::Git.open(@repo_dir)\n do_fetch(git)\n git.reset_hard\n do_checkout_revision(git)\n do_update_tag(git)\n end", "def perform_or_request_merge(src, dest)\n if in_admin_mode? || src.can_merge_into?(dest)\n perform_merge(src, dest)\n else\n request_merge(src, dest)\n end\n end", "def merge_version!\n _with_version_flag(:merge_version) do\n yield if block_given?\n end\n save!\n end", "def perform_merge\n src_notes = @src.all_notes\n dest_notes = @dest.all_notes\n result = false\n\n # Mergeable if there are no fields which are non-blank in\n # both descriptions.\n if @src.class.all_note_fields.none? \\\n { |f| src_notes[f].present? && dest_notes[f].present? }\n result = true\n\n # Copy over all non-blank descriptive fields.\n src_notes.each do |f, val|\n @dest.send(\"#{f}=\", val) if val.present?\n end\n\n # Save changes to destination.\n @dest.save\n\n # Copy over authors and editors.\n @src.authors.each { |user| @dest.add_author(user) }\n @src.editors.each { |user| @dest.add_editor(user) }\n\n # Delete old description if requested.\n delete_src_description_and_update_parent if @delete_after\n end\n\n result\n end", "def pull\n fetch\n merge\n end", "def pull_merged?(repo, number, options = {})\n boolean_from_response :get, \"#{Repository.path repo}/pulls/#{number}/merge\", options\n end", "def forcemerge(options = nil)\n request(:post, \"_forcemerge\", options)\n end", "def set_merge\n @admin_merge = Admin::Merge.find(params[:id])\n end", "def create\n @merge = Merge.new(merge_params)\n\n respond_to do |format|\n if @merge.save\n format.html { redirect_to @merge, notice: 'Merge was successfully created.' }\n format.json { render :show, status: :created, location: @merge }\n else\n format.html { render :new }\n format.json { render json: @merge.errors, status: :unprocessable_entity }\n end\n end\n end", "def merge(other = {})\n branch default_options.merge(other)\n end", "def merge_conflict?; end", "def merge!(with); end", "def do_merge\n\n return @workitem if @workitem\n\n list = if first?\n @workitems_by_arrival.reverse\n elsif last?\n @workitems_by_arrival\n elsif highest?\n @workitems_by_altitude.reverse\n elsif lowest?\n @workitems_by_altitude\n end\n\n list.inject(nil) do |result, wi|\n result = merge_workitems(result, wi, override?) if wi\n result\n end\n end", "def merge\n @primary = Client.find(params[:primary_id])\n @secondary = Client.find(params[:secondary_id])\n \n #merge primary_backup and secondary_backup\n @primary.attributes = @secondary.attributes.except(\"id\", \"created_at\", \"updated_at\")\n .delete_if { |k, v| v.blank? }\n #merge tickets\n @secondary.tickets.update_all(client_id: @primary.id)\n #merge backups\n @secondary.backups.update_all(client_id: @primary.id)\n #merge computers\n @secondary.computers.update_all(client_id: @primary.id)\n #merge parts\n @secondary.parts.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.dispatches.update_all(client_id: @primary.id)\n #merge items\n @secondary.items.update_all(client_id: @primary.id)\n #merge dispatches\n @secondary.anti_viri.update_all(client_id: @primary.id)\n #merge Contract_services\n @secondary.contract_services.update_all(client_id: @primary.id)\n #merge Contract_service_lines\n @secondary.contract_service_lines.update_all(client_id: @primary.id)\n #save backup merge\n @primary.save\n #remove secondary_backup\n @secondary.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully Merged then destroyed.' }\n format.json { head :no_content }\n \n end\n end", "def merge(*files)\n files.each do |f|\n f = check_for_file(f)\n @merged << f\n end\n end", "def merge_base(project, refs)\n get(\"/projects/#{url_encode project}/repository/merge_base\", query: { refs: refs })\n end", "def pull_merged?(repo, pull_number, options = {})\n boolean_from_response :get, \"#{Repository.path repo}/pulls/#{pull_number}/merge\", options\n end", "def merge(hash); end", "def merge(hash); end", "def merge(hash); end", "def update\n @work_merge_list = WorkMergeList.find(params[:id])\n\n respond_to do |format|\n if @work_merge_list.update_attributes(params[:work_merge_list])\n if params[:mode] == 'merge'\n if selected_work = Work.find(params[:selected_work_id]) rescue nil\n @work_merge_list.merge_works(selected_work)\n flash[:notice] = ('Works are merged successfully.')\n else\n flash[:notice] = ('Specify work id.')\n redirect_to work_merge_list_url(@work_merge_list)\n return\n end\n else\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.work_merge_list'))\n end\n format.html { redirect_to(@work_merge_list) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @work_merge_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sync\n unless params[\"repo\"].nil?\n ProvisionerService.new.synchronize_repositories(params[\"repo\"])\n end\n\n redirect_to repositories_path\n end", "def save_git_content\n MergeRequest\n .where('id = ? AND COALESCE(latest_merge_request_diff_id, 0) < ?', self.merge_request_id, self.id)\n .update_all(latest_merge_request_diff_id: self.id)\n\n ensure_commit_shas\n save_commits\n save_diffs\n save\n keep_around_commits\n end", "def merge\n @node = Node.find(params[:id])\n # we should somehow signal to the user that this is going to take some time?\n debugger\n merged = @node.merge_all_leaves\n # response.headers['Content-Type'] = 'text/xml' # I've also seen this for CSV files: 'text/csv; charset=iso-8859-1; header=present'\n # response.headers['Content-Disposition'] = 'attachment; filename=merged.otml'\n send_data merged, :type => 'text/xml', :disposition => 'attachment; filename=merged.otml'\n end", "def create\n @admin_merge = Admin::Merge.new(merge_params)\n\n respond_to do |format|\n if @admin_merge.save\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_merge }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_merge.errors, status: :unprocessable_entity }\n end\n end\n end", "def merge\n notify \"Importing...\"\n @importer.merge\n end", "def try_merge!(pin); end", "def merge\n frm.link(:text=>\"Merge\").click\n AnnouncementsMerge.new(@browser)\n end", "def merge(data)\n c = Context.new(data)\n @root.accept(c)\n MergeResult.new(c)\n end", "def merge_all\n merge_concurrent(0)\n end", "def merge!(other); end", "def merge_into(target)\n target_id = target.id\n # Find all the Entries attached to this name, that will need to be\n # reindexed after the merge\n entry_ids = entry_ids_to_index_on_update\n\n ids = EntryArtist.where(artist_id: self.id).pluck(:id)\n EntryArtist.where(artist_id: self.id).update_all({ artist_id: target_id })\n EntryArtist.where( id: ids ).each(&:update_bunny)\n\n ids = EntryAuthor.where(author_id: self.id).pluck(:id)\n EntryAuthor.where(author_id: self.id).update_all({ author_id: target_id })\n EntryAuthor.where( id: ids ).each(&:update_bunny)\n\n ids = EntryScribe.where(scribe_id: self.id).pluck(:id)\n EntryScribe.where(scribe_id: self.id).update_all({ scribe_id: target_id })\n EntryScribe.where( id: ids ).each(&:update_bunny)\n\n ids = SaleAgent.where(agent_id: self.id).pluck(:id)\n SaleAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SaleAgent.where( id: ids ).each(&:update_bunny)\n\n ids = SourceAgent.where(agent_id: self.id).pluck(:id)\n SourceAgent.where(agent_id: self.id).update_all({ agent_id: target_id })\n SourceAgent.where( id: ids ).each(&:update_bunny)\n\n ids = Provenance.where(provenance_agent_id: self.id).pluck(:id)\n Provenance.where(provenance_agent_id: self.id).update_all({ provenance_agent_id: target_id })\n Provenance.where( id: ids ).each(&:update_bunny)\n\n ids = DericciLink.where(name_id: self.id).pluck(:id)\n DericciLink.where(name_id: self.id).update_all({ name_id: target_id })\n DericciLink.where( id: ids ).each(&:update_bunny)\n\n ids = DericciRecord.where(verified_id: self.id).pluck(:id)\n DericciRecord.where(verified_id: self.id).update_all({verified_id: target_id})\n DericciRecord.where( id: ids ).each(&:update_bunny)\n\n # update flags on the target\n target.is_artist ||= self.is_artist\n target.is_author ||= self.is_author\n target.is_scribe ||= self.is_scribe\n target.is_provenance_agent ||= self.is_provenance_agent\n\n target.save\n\n # but ... CAN't SAVE when name is BLANK (nil)\n # self.name = nil\n self.viaf_id = nil\n self.deleted = true\n self.save!\n\n # slice into managable chunks to avoid running out of space in mysql\n entry_ids.each_slice(200) do |slice|\n SDBMSS::IndexJob.perform_later(Entry.to_s, slice)\n end\n\n Name.update_counters(target.id,\n :authors_count => target.author_entries.where(deprecated: false, draft: false).count - target.authors_count,\n :artists_count => target.artist_entries.where(deprecated: false, draft: false).count - target.artists_count,\n :scribes_count => target.scribe_entries.where(deprecated: false, draft: false).count - target.scribes_count,\n :sale_agents_count => target.sale_entries.where(deprecated: false, draft: false).count - target.sale_agents_count,\n :provenance_count => target.provenance_entries.where(deprecated: false, draft: false).count - target.provenance_count,\n :source_agents_count => target.agent_sources.count - target.source_agents_count\n )\n end", "def execute\n if (!self.pull_request_id)\n current = GitHub::PullRequest.current\n self.pull_request_id = current.number if current\n end\n self.pull_request_id ||= cli.prompt(\"Pull Request ID: \")\n GitHub.connect do\n if config.deployable_label\n with_labelling do\n merge\n end\n else\n merge\n end\n end\n end", "def perform\n git.if_clean do\n check_out_branch\n merge_pull_request\n comment_about_merge\n end\n rescue => e\n case e\n when GitHub::PullRequest::NotFound\n cli.say \"Unable to find pull request #{pull_request_id}. Please retry with a valid ID.\"\n when Git::MergeFailed\n cli.say \"Merge failed. Please identify the source of this merge conflict resolve this conflict in your pull request's branch. NOTE: Merge conflicts resolved in the #{branch_type} branch are NOT used when deploying.\"\n when Git::CheckoutFailed\n cli.say \"Checkout of #{branch_to_merge_into} failed. Please contact Infrastructure to determine the cause.\"\n when GitHub::PullRequest::CommentFailed\n cli.say \"Unable to write comment. Please navigate to #{pull_request.url} and add the comment, '#{comment_body}'\"\n else\n cli.say \"An unknown error occurred: #{e.inspect}\"\n end\n raise\n end", "def commit\n @repo.commit\n end", "def do_checkout\n super\n git = @logger.operation(:cloning, \"to #{@repo_dir}\") do\n ::Git.clone(@repository.url, @repo_dir)\n end\n do_fetch(git)\n do_checkout_revision(git)\n do_update_tag git\n end", "def scan_for_merges\n moves = []\n # prescan for merges in the list of actions.\n @actions.select {|act| act.is_a? Action::MergeAction}.each do |a|\n # destructure the list\n file, remote_file, filename_dest, flags, move = a.file, a.remote_file, a.file_dest, a.flags, a.move\n UI.debug(\"preserving #{file} for resolve of #{filename_dest}\")\n # look up our changeset for the merge state entry\n vf_local = working_changeset[file]\n vf_other = target_changeset[remote_file]\n vf_base = vf_local.ancestor(vf_other) || @repo.versioned_file(file, :file_id => Updating::NULL_REV)\n # track this merge!\n @repo.merge_state.add(vf_local, vf_other, vf_base, filename_dest, flags)\n\n moves << file if file != filename_dest && move\n end\n moves\n end", "def merge_base(target, source)\n invoke(:merge_base, target, source)\n rescue ShellExecutionError\n nil\n end", "def update\n respond_to do |format|\n if @admin_merge.update(merge_params)\n format.html { redirect_to @admin_merge, notice: 'Merge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_merge.errors, status: :unprocessable_entity }\n end\n end\n end", "def merge_analyze\n @org = Org.includes(:templates, :tracker, :annotations,\n :departments, :token_permission_types, :funded_plans,\n identifiers: [:identifier_scheme],\n guidance_groups: [guidances: [:themes]],\n users: [identifiers: [:identifier_scheme]])\n .find(params[:id])\n authorize @org\n\n # Let the OrgSelectable concern determine which org was selected\n @target_org = process_org!(user: current_user)\n\n # If the user selected the same org then nil it out so that it cancels the merge\n @target_org = nil if @org == @target_org\n end", "def find_merge\n \nend", "def merge(attributes)\n @service.merge_entity(self, attributes)\n end", "def merge(to_be_merged)\n scheme_ids = identifiers.pluck(:identifier_scheme_id)\n # merge logic\n # => answers -> map id\n to_be_merged.answers.update_all(user_id: id)\n # => notes -> map id\n to_be_merged.notes.update_all(user_id: id)\n # => plans -> map on id roles\n to_be_merged.roles.update_all(user_id: id)\n # => prefs -> Keep's from self\n # => auths -> map onto keep id only if keep does not have the identifier\n to_be_merged.identifiers\n .where.not(identifier_scheme_id: scheme_ids)\n .update_all(identifiable_id: id)\n # => ignore any perms the deleted user has\n to_be_merged.destroy\n end", "def merge(other)\n self.merge_actors(other)\n self.compress_history()\n end", "def rh_merge(data)\n _rh_merge(clone, data)\n end", "def merge(id_hash)\n if id_hash.has_key? :id and id_hash.has_key? :tid\n id = id_hash[:id]\n tid = id_hash[:tid]\n else\n raise \"RT_Client.merge requires a Ticket number in the 'id' key and a target ticket id in the 'tid' key.\"\n end\n @site[\"ticket/#{id}/merge/#{tid}\"].get\n end" ]
[ "0.6891649", "0.6853526", "0.67897743", "0.6756966", "0.6728625", "0.6727991", "0.6724148", "0.66722584", "0.6646858", "0.6584396", "0.65783495", "0.65542936", "0.6520926", "0.6506543", "0.6503335", "0.648635", "0.64468616", "0.63653654", "0.63375306", "0.6325263", "0.6287157", "0.624996", "0.62497866", "0.6243458", "0.61608535", "0.6090192", "0.6058677", "0.6051703", "0.60512227", "0.6038972", "0.6038562", "0.60330516", "0.60181624", "0.6016802", "0.59990704", "0.59871674", "0.59512144", "0.5928802", "0.5925206", "0.5916884", "0.5915452", "0.591192", "0.5904235", "0.58909535", "0.58648604", "0.5811312", "0.5792209", "0.5786618", "0.57797676", "0.57722646", "0.5762095", "0.5755129", "0.5744337", "0.5741535", "0.5706524", "0.5699642", "0.5688964", "0.56854093", "0.56819147", "0.5663715", "0.5640326", "0.559428", "0.55910045", "0.5535447", "0.55239064", "0.5512765", "0.5507997", "0.55030584", "0.5498358", "0.54973865", "0.5491665", "0.54915875", "0.54915875", "0.54915875", "0.54724264", "0.5464655", "0.5447591", "0.54468465", "0.5443992", "0.5441421", "0.5432698", "0.5432262", "0.5427113", "0.5426332", "0.5419085", "0.5412713", "0.541184", "0.5403559", "0.5382606", "0.5378007", "0.537754", "0.5366522", "0.5361809", "0.53597385", "0.53586304", "0.5354221", "0.5347009", "0.5304885", "0.5303491", "0.52998763" ]
0.5928583
38
NOTE: This has been made private, as it's no longer used publicly, but the tests for other methods in this class currently depend on it.
def log(format: nil) format_pattern = case format when :author '%aN' when :message '%B' end cmd = %w[log --topo-order] cmd << "--format='#{format_pattern}'" if format_pattern output, = run_git(cmd) output&.squeeze!("\n") if format_pattern == :message output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internal; end", "def probers; end", "def spec; end", "def spec; end", "def private_method\n end", "def implemented_in; end", "def schubert; end", "def used?; end", "def internal?; end", "def refutal()\n end", "def identify; end", "def from; end", "def from; end", "def from; end", "def from; end", "def custom; end", "def custom; end", "def original; end", "def missing; end", "def wrapper; end", "def missing?; end", "def isolated; end", "def isolated; end", "def overrides; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def same; end", "def offences_by; end", "def internship_passed; end", "def anchored; end", "def reflector; end", "def reflector; end", "def loc; end", "def loc; end", "def loc; end", "def initialize\n\n end", "def initialize\n\n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def origin; end", "def origin; end", "def origin; end", "def original_result; end", "def tell()\n #This is a stub, used for indexing\n end", "def reflection; end", "def reflection; end", "def used\n raise NotImplementedError\n end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def base; self; end", "def called_from; end", "def called_from; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end" ]
[ "0.77232206", "0.62547386", "0.62547386", "0.6213682", "0.6213682", "0.6213682", "0.6213682", "0.5989635", "0.5921189", "0.5841518", "0.5841518", "0.5762026", "0.57382655", "0.57127005", "0.5686586", "0.56837904", "0.56354177", "0.5612077", "0.5594109", "0.5594109", "0.5594109", "0.5594109", "0.5588956", "0.5588956", "0.55773723", "0.5556668", "0.55534446", "0.55384517", "0.55168647", "0.55168647", "0.5515015", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.55084676", "0.5496366", "0.54556286", "0.5451268", "0.5408206", "0.5408206", "0.53939235", "0.53939235", "0.53939235", "0.53624314", "0.53624314", "0.5351901", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.53356475", "0.53356475", "0.53356475", "0.5331061", "0.53247285", "0.5308332", "0.5308332", "0.53080595", "0.5307929", "0.5307929", "0.5307929", "0.5302085", "0.5283998", "0.5283998", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372" ]
0.0
-1
NOTE: This has been made private, as it's no longer used publicly, but the tests for other methods in this class currently depend on it.
def commit(files, no_edit: false, amend: false, message: nil, author: nil) run_git ['add', *Array(files)] if files cmd = %w[commit] cmd << '--no-edit' if no_edit cmd << '--amend' if amend cmd << %[--author="#{author}"] if author cmd += ['--message', %["#{message}"]] if message output, status = run_git(cmd) status.success? || raise(CannotCommitError.new(output)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internal; end", "def probers; end", "def spec; end", "def spec; end", "def private_method\n end", "def implemented_in; end", "def schubert; end", "def used?; end", "def internal?; end", "def refutal()\n end", "def identify; end", "def from; end", "def from; end", "def from; end", "def from; end", "def custom; end", "def custom; end", "def original; end", "def missing; end", "def wrapper; end", "def missing?; end", "def isolated; end", "def isolated; end", "def overrides; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def same; end", "def offences_by; end", "def internship_passed; end", "def anchored; end", "def reflector; end", "def reflector; end", "def loc; end", "def loc; end", "def loc; end", "def initialize\n\n end", "def initialize\n\n end", "def initialize() end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def origin; end", "def origin; end", "def origin; end", "def original_result; end", "def tell()\n #This is a stub, used for indexing\n end", "def reflection; end", "def reflection; end", "def used\n raise NotImplementedError\n end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def base; self; end", "def called_from; end", "def called_from; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end" ]
[ "0.77232206", "0.62547386", "0.62547386", "0.6213682", "0.6213682", "0.6213682", "0.6213682", "0.5989635", "0.5921189", "0.5841518", "0.5841518", "0.5762026", "0.57382655", "0.57127005", "0.5686586", "0.56837904", "0.56354177", "0.5612077", "0.5594109", "0.5594109", "0.5594109", "0.5594109", "0.5588956", "0.5588956", "0.55773723", "0.5556668", "0.55534446", "0.55384517", "0.55168647", "0.55168647", "0.5515015", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.5510937", "0.55084676", "0.5496366", "0.54556286", "0.5451268", "0.5408206", "0.5408206", "0.53939235", "0.53939235", "0.53939235", "0.53624314", "0.53624314", "0.5351901", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.5349616", "0.53356475", "0.53356475", "0.53356475", "0.5331061", "0.53247285", "0.5308332", "0.5308332", "0.53080595", "0.5307929", "0.5307929", "0.5307929", "0.5302085", "0.5283998", "0.5283998", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372", "0.5282372" ]
0.0
-1
Input: Two arrays as arguments Output: An array that contains all of the values from the argument arrays Rules: All duplicates must be removed even if there are duplicates in the original arrays EXAMPLES: merge([1, 3, 5], [3, 6, 9]) == [1, 3, 5, 6, 9] ALGORITHM: Initialize empty combined array Iterate through each element in array for both given arrays Shovel each element into the combined array Return combined array with duplicates removed
def merge(arr1, arr2) merged = [] arr1.each { |el| merged << el } arr2.each { |el| merged << el } merged.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(array1, array2)\n # (array1 + array2).uniq\n array1 | array2\nend", "def merge(array_1, array_2)\n (array_1 + array_2).uniq\nend", "def merge(array_1, array_2)\n (array_1 + array_2).uniq\nend", "def merge(array1, array2)\n (array1 + array2).uniq\nend", "def merge(arr1, arr2)\r\n merged_array = []\r\n arr1.each do |x|\r\n merged_array << x unless merged_array.include?(x)\r\n end\r\n arr2.each do |x|\r\n merged_array << x unless merged_array.include?(x)\r\n end\r\n merged_array\r\nend", "def merge(arr_1, arr_2)\n (arr_1 + arr_2).uniq\nend", "def merge(arr1, arr2)\n result = []\n arr1.each {|i| result << i if !result.include?(i)}\n arr2.each {|i| result << i if !result.include?(i)}\n result\nend", "def merge(array1, array2)\n array2.each { |element| array1 << element unless array1.include?(element)}\n array1\nend", "def merge_array(input_array1, input_array2)\n\toutput_array = []\n\toutput_array = input_array1 + input_array2\n\treturn output_array.uniq\nend", "def merge(arr1, arr2)\n arrays = (arr1 + arr2).flatten\n one_array = []\n arrays.each { |n| one_array << n unless one_array.include?(n) }\n one_array\nend", "def merge(arr1, arr2)\n merged_arr = []\n\n arr1.each { |el| merged_arr << el }\n arr2.each { |el| merged_arr << el }\n\n merged_arr.uniq\nend", "def merge(arr1, arr2)\n new_array = []\n arr2.each { |e| arr1 << e} \n arr1.each { |e| new_array << e unless new_array.include?(e)}\n new_array\nend", "def merge(arr1, arr2)\n (arr1+arr2).uniq\nend", "def merge(arr1, arr2)\n arr1.concat(arr2).uniq!\nend", "def merge(arr1, arr2)\n (arr1 + arr2).uniq\nend", "def merge(arr1, arr2)\n (arr1 + arr2).uniq\nend", "def merge(arr_1, arr_2)\n temp = arr_1.dup\n for el in arr_2\n temp << el unless temp.include? el\n end\n temp\nend", "def merge(arr1, arr2)\n return (arr1 + arr2).uniq\nend", "def merge(arr1, arr2)\n array = arr1 + arr2\n array.uniq!\nend", "def merge(arr1, arr2)\n arr1 << arr2\n arr1.flatten(1).uniq\nend", "def merge(arr1, arr2)\n arr1.concat(arr2).uniq\nend", "def merge(arr1, arr2)\n arr1.concat(arr2).uniq\nend", "def merge(array1, array2)\n new_array = []\n\n array1.each do |v|\n new_array << v\n end\n array2.each do |v|\n new_array << v\n end\n\n new_array.uniq!.sort\nend", "def merge(ary1, ary2)\n results = ary1.uniq\n ary2.each {|el| results << el unless results.include?(el)}\n results\nend", "def merge(ary_1, ary_2)\r\n ary_2.uniq.each_with_object(ary_1.uniq){ |element, merged| merged << element unless merged.include?(element) }\r\nend", "def merge(array1, array2)\n array1.zip(array2).flatten.uniq.sort\nend", "def merge(array_1, array_2)\n new_array = array_1 + array_2\n new_array.flatten.uniq.sort\nend", "def merge(ary1, ary2)\n new_array = []\n [ary1, ary2].each do |ary|\n ary.each { |v| new_array << v unless new_array.include?(v) }\n end\n new_array\nend", "def merge(arr1, arr2)\n new_arr = (arr1 + arr2).uniq\nend", "def merge(arr1, arr2)\n new_arr = arr1 + arr2\n new_arr.uniq\nend", "def custom_union(arr1, arr2)\n final = []\n arr1.each { |item| final << item unless final.include?(item) }\n arr2.each { |item| final << item unless final.include?(item) }\n final\nend", "def custom_union(arr1, arr2)\n arr1.concat(arr2).uniq\nend", "def merge(array1, array2)\n array2.reverse!\n \n loop do\n break if array2 == []\n array1 << array2.pop\n end\n array1.uniq!\nend", "def custom_union(arr1, arr2)\n arr1.dup.concat(arr2).uniq # dup is make orizal array not changed\nend", "def merged(array1, array2) # doesn't fully work\n result = []\n counter = 0\n array1b = array1.dup.sort\n array2b = array2.dup.sort\n \n loop do \n if array1b.empty? == false\n array1b.each do |value1| #finds the smallest value and adds it if in array1\n if array2b.all? { |value2| value1 < value2}\n result << value1\n array1b.delete_at(array1b.find_index(value1))\n end \n end \n end\n \n if array2b.empty? == false\n array2b.each do |value2| #finds the smallest value and adds it if in array2\n if array1b.all? { |value1| value2 < value1}\n result << value2\n array2b.delete_at(array2b.find_index(value2))\n end \n end \n end \n \n counter +=1\n break if counter == array1.size + array2.size\n end \n result\nend", "def merge_arrays(arr_one, arr_two)\n ret = []\n while arr_one.length > 0 || arr_two.length > 0\n if arr_one[0] < arr_two[0]\n ret << arr_one.shift\n elsif arr_two[0] < arr_one[0]\n ret << arr_two.shift\n elsif arr_two.empty?\n ret += arr_one\n elsif arr_one.empty?\n ret += arr_two\n else\n ret\n end\n end\n ret\nend", "def merge(array1, array2, merged_array=[])\n len_of_a1 = array1.length #Get length of arrays and compare to the array's index\n len_of_a2 = array2.length\n index1 = 0 #Set the starting index for both arrays - always 0 since we are going left to right.\n index2 = 0\n\n while index1 < len_of_a1 and index2 < len_of_a2 #This loop continues until the end of one of the arrays is reached\n if array1[index1] < array2[index2] #It compares the index values of both arrays, and appends the one that is lower in value\n merged_array << array1[index1]\n index1 += 1\n else\n merged_array << array2[index2]\n index2 += 1\n end\n end\n\n if index1 < len_of_a1 #Appends any remaining values to the merged array\n merged_array += array1[index1..-1] \n elsif index2 < len_of_a2\n merged_array += array2[index2..-1]\n end\n merged_array #Returns the merged array\n end", "def merge(array1, array2, merged_array=[])\n len_of_a1 = array1.length #Get length of arrays and compare to the array's index\n len_of_a2 = array2.length\n index1 = 0 #Set the starting index for both arrays - always 0 since we are going left to right.\n index2 = 0\n\n while index1 < len_of_a1 and index2 < len_of_a2 #This loop continues until the end of one of the arrays is reached\n if array1[index1] < array2[index2] #It compares the index values of both arrays, and appends the one that is lower in value\n merged_array << array1[index1]\n index1 += 1\n else\n merged_array << array2[index2]\n index2 += 1\n end\n end\n\n if index1 < len_of_a1 #Appends any remaining values to the merged array\n merged_array += array1[index1..-1] \n elsif index2 < len_of_a2\n merged_array += array2[index2..-1]\n end\n merged_array #Returns the merged array\n end", "def merge(array1, array2)\n array1 | array2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def merge(arr1, arr2)\n arr1 | arr2\nend", "def union(*arrays)\n arrays.flatten.inject([]) { |acc, element| acc << element }\nend", "def inst_custom_union(arr1, arr2)\n arr1.dup.concat(arr2).uniq # yes thats really it!!\nend", "def merge(first, second)\n (first + second).uniq\nend", "def merge(array1, array2)\n merged = []\n\n iterator1 = ArrayIterator.new(array1)\n iterator2 = ArrayIterator.new(array2)\n\n while (iterator1.has_next? and iterator2.has_next?)\n if iterator1.item < iterator2.item\n merged << iterator1.next_item\n else\n merged << iterator2.next_item\n end\n end\n\n # Pick up the leftovers from array1\n while (iterator1.has_next?)\n merged << iterator1.next_item\n end\n\n # Pick up the leftovers from array2\n while (iterator2.has_next?)\n merged << iterator2.next_item\n end\n\n merged\nend", "def merge(a,b)\n (a + b).uniq\nend", "def array_concat(array_1, array_2)\n # Your code here\n \n new_array = Array.new\n array_1.each do |entry|\n if array_1.empty? == false\n new_array.push(entry)\n end\n end\n \n array_2.each do |entry|\n if array_2.empty? == false\n new_array.push(entry)\n end\n end\n \n new_array\nend", "def union(*arrays)\n arrays.flatten\nend", "def merge(array_1, array_2)\r\n new_array = []\r\n array_1_pointer = 0\r\n array_2_pointer = 0\r\n\r\n # Run the loop until we've reached end of both arrays:\r\n while array_1_pointer < array_1.length || \r\n array_2_pointer < array_2.length\r\n\r\n # If we already reached the end of the first array,\r\n # add item from second array:\r\n if !array_1[array_1_pointer]\r\n new_array << array_2[array_2_pointer]\r\n array_2_pointer += 1\r\n # If we already reached the end of the second array,\r\n # add item from first array:\r\n elsif !array_2[array_2_pointer]\r\n new_array << array_1[array_1_pointer]\r\n array_1_pointer += 1\r\n # If the current number in first array is less than current\r\n # number in second array, add from first array:\r\n elsif array_1[array_1_pointer] < array_2[array_2_pointer]\r\n new_array << array_1[array_1_pointer]\r\n array_1_pointer += 1\r\n # If the current number in second array is less than or equal\r\n # to current number in first array, add from second array:\r\n else\r\n new_array << array_2[array_2_pointer]\r\n array_2_pointer += 1\r\n end\r\n end\r\n\r\n return new_array\r\nend", "def merge(array_a, array_b)\n a_index = 0\n b_index = 0\n result = []\n\n while a_index < array_a.size && b_index < array_b.size do\n if array_a[a_index] > array_b[b_index]\n result << array_b[b_index]\n b_index += 1\n else\n result << array_a[a_index]\n a_index += 1\n end\n end\n\n (a_index...array_a.size).each { |index| result << array_a[index] }\n (b_index...array_b.size).each { |index| result << array_b[index] }\n\n return result\nend", "def merge(array1, array2)\n ptr1 = 0\n ptr2 = 0\n high1 = array1.length - 1 \n high2 = array2.length - 1 \n array_final = []\n while (ptr1 <= high1) && (ptr2 <= high2) do\n if (array1[ptr1] < array2[ptr2])\n array_final << array1[ptr1]\n ptr1 += 1\n else\n array_final << array2[ptr2]\n ptr2 += 1\n end\n end\n if ptr1 <= high1\n while (ptr1 <= high1) do\n array_final << array1[ptr1]\n ptr1 += 1\n end\n elsif ptr2 <= high2\n while (ptr2 <= high2) do\n array_final << array2[ptr2]\n ptr2 += 1\n end\n end\n return array_final\nend", "def merge(arr1, arr2)\n return arr2 if arr1.size < 1\n return arr1 if arr2.size < 1\n\n merged_lists = []\n counter1 = 0\n counter2 = 0\n iterations = arr1.size + arr2.size\n\n iterations.times do |n|\n if arr1[counter1] == nil\n merged_lists << arr2[counter2]\n elsif arr2[counter2] == nil\n merged_lists << arr1[counter1]\n elsif arr1[counter1] <= arr2[counter2]\n merged_lists << arr1[counter1]\n counter1 += 1\n else\n merged_lists << arr2[counter2]\n counter2 += 1\n end\n end\n\n merged_lists\nend", "def combine(left, right)\n\t# create a results array\n results = []\n\t# counters pointing to the index of the smallest elements in each array\n\t# check that we have elements to compare\n while right.length > 0 && left.length > 0\n\t\t# push the smaller element onto the result array\n if right[0] <= left[0]\n results.push(right[0])\n right.delete_at(0)\n elsif left[0] < right[0]\n results.push(left[0])\n left.delete_at(0)\n end\n end\n # if there are elements left over in a, move them to result\n if !right.empty?\n results.push(right)\n # if there are elements left over in b, move them to result\n elsif !left.empty?\n results.push(left)\n end\n return results.flatten\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\nend", "def merge_sorted_arrays2(arr1, arr2)\n arr1_item = arr1[0]\n arr2_item = arr2[0]\n merged = []\n i = 1\n j = 1\n\n while arr1_item || arr2_item\n if !arr2_item || arr1_item < arr2_item\n merged << arr1_item\n arr1_item = arr1[i]\n i +=1\n else\n merged << arr2_item\n arr2_item = arr2[j]\n j +=1\n end\n end\n merged\nend", "def merge(arr1, arr2)\n arr1 = arr1.dup\n arr2 = arr2.dup # duplicate to prevent mutation of original array\n result = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n result << arr2.shift\n elsif arr2.empty?\n result << arr1.shift\n else\n if arr1[0] <arr2[0]\n result << arr1.shift\n else\n result << arr2.shift\n end\n end\n end\n result\nend", "def merge(array1, array2)\n merged = []\n\n iterator1 = ArrayIterator.new(array1)\n iterator2 = ArrayIterator.new(array2)\n\n while iterator1.has_next? && iterator2.has_next?\n if iterator1.item < iterator2.item\n merged << iterator1.next_item\n else\n merged << iterator2.next_item\n end\n end\n\n while iterator1.has_next?\n merged << iterator1.next_item\n end\n\n while iterator2.has_next?\n merged << iterator2.next_item\n end\n\n merged\nend", "def merger(arr1, arr2)\n merged = []\n\n until arr1.empty? || arr2.empty? # this is an interesting way to do it\n if arr1.first <= arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n\n merged + arr1 + arr2\nend", "def merge(arr1, arr2)\n new_arr = arr1 + arr2\n return new_arr if arr1.empty? || arr2.empty?\n index = 0\n loop do\n current = new_arr[index]\n while new_arr[index+1..-1].include? current\n new_arr.delete_at(new_arr.rindex(current))\n end\n index += 1\n break if index >= new_arr.size\n end\n new_arr\nend", "def merge(array1, array2)\n composite_array = []\n index1 = 0\n index2 = 0\n \n loop do\n if index1 == array1.size\n index2.upto(array2.size - 1) { |index| composite_array << array2[index] }\n break\n elsif index2 == array2.size\n index1.upto(array1.size - 1) { |index| composite_array << array1[index] }\n break\n end\n \n first_item = array1[index1]\n second_item = array2[index2]\n if first_item <= second_item\n composite_array << first_item\n index1 += 1\n else\n composite_array << second_item\n index2 += 1\n end\n end\n \n composite_array\nend", "def merge_sort(array1, array2)\n # third array to store the merged elements\n result = []\n # index for the first array\n i = 0\n # index for the second array\n j = 0\n # iterate until one of them is completely traversed\n while i < array1.length && j < array2.length\n # if the first array holds the smaller element in its current index,\n # store it in the result array then increment the index of the first array\n if array1[i] <= array2[j]\n result << array1[i]\n i += 1\n # otherwise, store the element from the second array in the result array,\n # then increment the index of the second array\n else\n result << array2[j]\n j += 1\n end\n end\n # after the loop above, one of the arrays is completely traversed but the other is not\n # this means that elements remain\n \n # append all remaining elements from the first array to the result array, if they exist\n while i < array1.length\n result << array1[i]\n i += 1\n end\n\n # append all remaining elements from the second array to the result array, if they exist\n while j < array2.length\n result << array2[j]\n j += 1\n end\n result\nend", "def merge(first_arr, second_arr)\n return_arr = []\n\n loop do\n break if first_arr.empty? || second_arr.empty?\n if first_arr[0] <= second_arr[0]\n return_arr << first_arr.shift\n else\n return_arr << second_arr.shift\n end\n end\n\n loop do\n break if first_arr.empty? && second_arr.empty?\n if first_arr.empty?\n return_arr << second_arr.shift\n else\n return_arr << first_arr.shift\n end \n end\n\n return_arr\nend", "def union(*arrays)\n arrays.inject { |all_elements, arr| all_elements + arr }\nend", "def unite(arr1, arr2, *arr3)\n unique_values = arr1\n\n arr2.select do |number|\n next if (unique_values.include?(number))\n unique_values << number\n end\n\n arr3.select do |number|\n number.select do |value|\n next if (unique_values.include?(value))\n unique_values << value\n end\n end\n unique_values\nend", "def merge(a, b)\n new_array = []\n i, j = 0, 0\n loop do\n if i >= a.size\n new_array << b[j..]\n break\n elsif j >= b.size\n new_array << a[i..]\n break\n elsif a[i] <= b[j]\n new_array << a[i]\n i += 1\n else\n new_array << b[j]\n j += 1\n end\n end\n new_array.flatten\nend", "def merge(arr1, arr2)\n #check if there are any non numbers in either array\n return nil if !(arr1.all? { |num| num.is_a? Numeric })\n return nil if !(arr2.all? { |num| num.is_a? Numeric })\n\n # set up a results array\n sorted_arr = []\n #measure the length of each array\n len1 = arr1.length\n len2 = arr2.length\n #set up a counter for each array\n i = 0\n j = 0\n\n #loop stops when one array is checked fully\n while i < len1 && j < len2\n #compare values of array 1 and array 2\n if arr1[i] <= arr2[j]\n #if value in array 1 is less, push it\n sorted_arr << arr1[i]\n #increment counter\n i += 1\n else\n sorted_arr << arr2[j]\n j += 1\n end\n end\n\n #are there are remaining items in either array?\n #if so push the remaining item of one into final sorted array\n if i < len1\n sorted_arr += arr1[i..-1]\n else\n sorted_arr += arr2[j..-1]\n end\n # implicit return\n sorted_arr\nend", "def merge_helper(arr1, arr2)\n merged = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n merged << arr2.shift\n elsif arr2.empty?\n merged << arr1.shift\n elsif arr1.first < arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n merged\nend", "def merge(arr1, arr2)\n arr = [] \n\n (arr2.length > arr1.length)? max = arr2.length : max = arr1.length\n a1_idx = 0\n a2_idx = 0 \n while a1_idx < max || a2_idx < max \n if arr2[a2_idx] == nil \n arr += arr1[a1_idx..-1] \n break \n elsif arr1[a1_idx] == nil \n arr += arr2[a2_idx..-1] \n break \n end \n\n a1 = arr1[a1_idx]\n a2 = arr2[a2_idx]\n\n if a1 < a2 \n arr << a1\n a1_idx += 1 \n \n else \n arr << a2\n a2_idx += 1 \n end\n end\n arr\nend", "def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend", "def merge(arr1, arr2)\n new_arr = arr1.merge(arr2)\nend", "def merge(arr1, arr2)\n to_add = arr2.select{|element| arr1.include?(element) == false}\n arr1 + to_add\nend", "def merge(first, second)\n\tmerged = []\n\t\n\tfirst_length = first.length\n\tsecond_length = second.length\n\n\t# compare the first items of both input arrays\n\t# slice the lowest value off the front and stick it in the merged array\n\t# repeat until the merged array is filled up\n\tloop do\t\n\t\tif ( min(first[0], second[0]) == first[0] )\t\t\t\t\n\t\t\tmerged << first.shift\n\t\telsif ( min(first[0], second[0]) == second[0] )\n\t\t\tmerged << second.shift\n\t\tend\n\n\t\tbreak if merged.length == first_length + second_length\n\tend\n\n\tmerged\nend", "def merge(arr1, arr2=[])\n ind1 = ind2 = 0\n new_arr = []\n\n loop do\n break if arr1 == [] || arr2 == []\n if arr1[ind1] > arr2[ind2]\n new_arr << arr2[ind2]\n ind2 += 1\n else\n new_arr << arr1[ind1]\n ind1 += 1\n end\n break if ind1 >= arr1.size || ind2 >= arr2.size\n end\n\n if ind1 == arr1.size\n temp = arr2[ind2..-1]\n else\n temp = arr1[ind1..-1]\n end\n\n temp.each {|element| new_arr << element}\n\n new_arr\nend", "def merge(left_array, right_array)\n new_array = Array.new()\n i = 0\n j = 0\n while i < left_array.length && j < right_array.length\n\n if left_array[i] < right_array[j]\n new_array.push(left_array[i])\n i = i +1\n else\n new_array.push(right_array[j])\n j = j + 1\n end\n\n end\n\n # add remaining elements to new array\n new_array += left_array[i..-1]\n new_array += right_array[j..-1]\n return new_array\n end", "def array_concat(array_1, array_2)\n # Your code here\n combined_array = []\n\n array_1.each { |i| \n combined_array.push(i)\n }\n\n array_2.each do |j| \n combined_array.push(j)\n end\n\n return combined_array\nend", "def merge(arr1, arr2)\n merged = []\n\n until arr1.empty? || arr2.empty?\n if arr1.first < arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n\n merged + arr1 + arr2\nend", "def combine(a, b)\n # create a results array\n results = []\n # counters pointing to the index of the smallest elements in each array\n ai = 0\n bi = 0\n # check that we have elements to compare\n # push the smaller element onto the result array\n\n #a#4,6,8 #b#3,5,7\n while ai < a.length && bi < b.length\n if a[ai] < b[bi]\n results << a[ai]\n ai = ai + 1\n else\n results << b[bi]\n bi = bi + 1\n end\n end\n # if there are elements left over in a, move them to result\n # if there are elements left over in b, move them to result\n if ai < a.length\n results << a[ai..a.length]\n elsif\n results << b[bi..b.length]\n end\n\n return results.flatten!\nend", "def merge_again(arr1, arr2)\n\tfinal_array = []\n\twhile(arr1.size > 0 && arr2.size > 0)\n\t\tif arr1[0] < arr2[0]\n\t\t\tfinal_array << arr1[0]\n\t\t\tarr1 = arr1[1...arr1.length]\n\t\telse\n\t\t\tfinal_array << arr2[0]\n\t\t\tarr2 = arr2[1...arr2.length]\n\t\tend\n\n\tend\n\n\tif arr1.length == 0\n\t\tfinal_array.concat arr2\n\telsif arr2.length == 0\n\t\tfinal_array.concat arr1\n\tend\n\n\tfinal_array\nend", "def combine_arrays(nums, other_nums)\n \n return nums if other_nums.empty? # not necessary, but good to have\n return other_nums if nums.empty? # not necessary, but good to have\n \n res= []\n \n i, j = 0, 0\n \n while i < nums.length && j < other_nums.length\n a, b = nums[i], other_nums[j]\n \n if a <= b\n res << a\n i+= 1\n else\n res << b\n j+= 1\n end\n end\n \n if j == other_nums.length\n # other_nums was exhausted, but there still remain\n # elements in nums to process\n res.push( *nums[i..-1] )\n elsif i == nums.length\n # nums was exhausted, but there still remain\n # elements in nums to process\n res.push( *other_nums[j..-1] )\n end\n \n res\nend", "def merge(left, right)\n\tresult = []\n\n\tuntil left.empty? and right.empty?\n\t\t# Remove next minimum element from the corresponding\n\t\t# array and add it to result\n\t\tif right.empty? or (left.any? and left.first <= right.first)\n\t\t\tresult << left.shift\n\t\telse\n\t\t\tresult << right.shift\n\t\tend\n\tend\n\n\tresult\nend", "def merge1(array1, array2)\r\n index2 = 0\r\n result = []\r\n\r\n array1.each do |value|\r\n while index2 < array2.size && array2[index2] <= value\r\n result << array2[index2]\r\n index2 += 1\r\n end\r\n result << value\r\n end\r\n\r\n result.concat(array2[index2..-1])\r\nend", "def merge(left, right)\n\tleft_i = 0\n\tright_i = 0\n\tresult = []\n\twhile left_i < left.length && right_i < right.length\n\t\t# conditional adds the smallest element of either array\n\t\tif left[left_i] < right[right_i]\n\t\t\tresult << left[left_i]\n\t\t\tleft_i += 1\n\t\telse\n\t\t\tresult << right[right_i]\n\t\t\tright_i += 1\n\t\tend\n\tend\n\t# constuct the result from the left and right arrays, adding them in the correct order\n\treturn result.concat(left[left_i...left.length]).concat(right[right_i...right.length])\nend", "def merging(multi_array)\n multi_array.sort_by! { |x| x.length } # Sorting: E.g. arrays of lengths 7, 8, 9, 10: in the next step (15,9,10) we want to merge 9 and 10!\n temp = merge(multi_array[0], multi_array[1])\n 2.times { multi_array.shift }\n multi_array.unshift(temp)\n unless multi_array.length == 1\n merging(multi_array) # Recursive\n end\n multi_array\nend", "def combine_two_lists(array1, array2)\n combined_array = []\n index = 0\n\n loop do\n combined_array << array1[index]\n combined_array << array2[index]\n index += 1\n break if index == array1.size\n \n end\n combined_array\nend", "def array_concat(array_1, array_2)\n concat_arrays = []\n array_1.each do |x|\n \tconcat_arrays << x\n end\n array_2.each do |x|\n \tconcat_arrays << x\n end\n concat_arrays\nend", "def intersect(array1, array2)\n hash_table = {}\n mergedArray = []\n\n array1.each do |a1|\n hash_table[a1] = true\n end\n\n array2.each do |a2|\n mergedArray << a2 if hash_table[a2]\n end\n\n return mergedArray\nend", "def merge(arr_1, arr_2) # works because arr_1 and arr_2 are always sorted\n array = []\n while !arr_1.empty? && !arr_2.empty?\n if arr_1.first <= arr_2.first\n array << arr_1.shift\n else\n array << arr_2.shift\n end\n end\n array += arr_1 + arr_2\nend", "def merge_2_array_of_hashes(a_arr, b_arr)\n merge_hash = a_hash = array_of_hashes_2_hash(a_arr) if a_arr\n merge_hash = b_hash = array_of_hashes_2_hash(b_arr) if b_arr\n merge_hash = a_hash.merge!(b_hash) if (a_arr and b_arr)\n merge_hash\nend", "def merge_and_sort_array(array_one, array_two)\n return (array_one + array_two).sort\nend", "def array_concat(array_1, array_2)\n concat_array = []\n array_1.each {|value| concat_array << value}\n array_2.each {|value| concat_array << value}\n concat_array\nend", "def join_arrays array_one, array_two\n\t\tarray_one.shift\n\t\tarray_two.pop\n\t\tarray_one & array_two\n\tend", "def merge(ary1, ary2)\n merge = ary1 + ary2\n result = []\n\n merge.size.times do\n result << merge.delete_at(merge.index(merge.min))\n end\n \n result\nend", "def merge(arr1, arr2)\n new_arr = []\n i1=0\n i2=0\n while i1 < arr1.length\n if i2 == arr2.length\n new_arr.concat(arr1[i1..-1])\n break\n elsif (arr1[i1] < arr2[i2])\n new_arr << arr1[i1]\n i1 += 1\n else\n new_arr << arr2[i2]\n i2 += 1\n end\n end\n if i2 != arr2.length\n (i2...arr2.length).each { |idx2| new_arr << arr2[idx2] }\n end\n return new_arr\n end", "def combine_arrays(arr1, arr2)\r\n combo = arr1 + arr2 # and unsorted combo of arr1 and arr2\r\n length = combo.length\r\n sort = [] # set up array variable for eventual return.\r\n\r\n while sort.length < length # loops until an equal amount of elements are pushed to sort as exist in combo. this is unncessary.\r\n combo.each.with_index do |x, i| # loop through all elements in combo. again, could have used #each_index without x.\r\n if combo[i + 1] != nil && combo[i] > combo[i + 1] # safeguarding against nil comparison, checking if the element above combo[i] is smaller\r\n combo[i], combo[i + 1] = combo[i + 1], combo[i] # if so, the values are exchanged using the indices within combo.\r\n end\r\n end\r\n\r\n sort.unshift(combo.pop) # add as the first element of sort the last element of the already sorted combo array\r\n end # upon review, this may violate the exercises restrictions.\r\n\r\n sort # returns the sorted array after sort.length == combo.length\r\nend", "def merge(a1, a2)\n ret = []\n\n while (true)\n if a1.empty?\n return ret.concat(a2)\n end\n if a2.empty?\n return ret.concat(a1)\n end\n\n if a1[0] < a2[0]\n ret << a1[0]\n a1 = a1[1...a1.size]\n else\n ret << a2[0]\n a2 = a2[1...a2.size]\n end\n end\nend", "def merge(left, right)\n results = []\n\n while (left.length > 0 && right.length > 0)\n if (left[0] < right[0])\n results.push( left.shift() )\n else\n results.push( right.shift() )\n end\n end\n # return a new array. Take everything in results and add it to the array.\n # Take everything in left and add them in.\n # Take everything in right and add them as well.\n # One array will be empty after while loop finishes\n return [*results, *left, *right]\nend", "def merge(list_a, list_b)\n result = Array.new\n\n while list_a.length > 0 or list_b.length > 0\n if list_a.length > 0 and list_b.length > 0\n if list_a[0] <= list_b[0]\n result << list_a[0]\n list_a.slice!(0)\n else\n result << list_b[0]\n list_b.slice!(0)\n end\n elsif list_a.length > 0\n result << list_a[0]\n list_a.slice!(0)\n elsif list_b.length > 0\n result << list_b[0]\n list_b.slice!(0)\n end\n end\n return result\n\nend", "def combine_arrays(arr1, arr2)\n\tcombo = arr1 + arr2\n\tswapped = true\n\n\twhile swapped\n\t\tswapped = false\n\t\t(combo.length-1).times do |i|\n\t\t\tif combo[i] > combo[i+1]\n\t\t\t\tcombo[i], combo[i+1] = combo[i+1], combo[i]\n\t\t\t\tswapped= true\n\t\t\tend\n\t\tend\n\tend\n\tcombo\nend", "def merge(array1, array2)\n merged = []\n\n iterator1 = EnumeratorAdaptor.new(array1.to_enum)\n iterator2 = EnumeratorAdaptor.new(array2.to_enum)\n\n while (iterator1.has_next? and iterator2.has_next?)\n if iterator1.item < iterator2.item\n merged << iterator1.next_item\n else\n merged << iterator2.next_item\n end\n end\n\n # Pick up the leftovers from array1\n while (iterator1.has_next?)\n merged << iterator1.next_item\n end\n\n # Pick up the leftovers from array2\n while (iterator2.has_next?)\n merged << iterator2.next_item\n end\n\n merged\nend", "def merge(array1, array2)\n index2 = 0\n result = []\n\n array1.each do |value|\n while index2 < array2.size && array2[index2] <= value\n result << array2[index2]\n index2 += 1\n end\n result << value\n end\n\n result.concat(array2[index2..-1])\nend" ]
[ "0.772638", "0.7712564", "0.7712564", "0.7669934", "0.7624815", "0.7519792", "0.7515528", "0.74978894", "0.7487255", "0.74742985", "0.7473642", "0.7438787", "0.74316174", "0.74158764", "0.7400684", "0.7400684", "0.7379904", "0.7378722", "0.7364808", "0.7360046", "0.73570305", "0.73570305", "0.73221344", "0.7314754", "0.72931236", "0.7278827", "0.7278814", "0.7270226", "0.7235253", "0.71504205", "0.714564", "0.70566213", "0.70104474", "0.6988642", "0.6974198", "0.6953834", "0.694335", "0.69430816", "0.68823385", "0.6872031", "0.6872031", "0.6872031", "0.6788029", "0.67772067", "0.6767103", "0.67599654", "0.67531973", "0.6717982", "0.67047167", "0.6698386", "0.6696737", "0.6660998", "0.66565955", "0.66439444", "0.6642942", "0.66308475", "0.66037303", "0.659295", "0.658425", "0.656924", "0.6560464", "0.6552229", "0.6548768", "0.6542718", "0.6530407", "0.65270054", "0.65179175", "0.65019715", "0.6498566", "0.6489503", "0.64815146", "0.64727867", "0.64712363", "0.6471206", "0.646605", "0.6453826", "0.6452305", "0.6450503", "0.6449199", "0.64382464", "0.6436973", "0.6436539", "0.6431883", "0.6431726", "0.6422885", "0.6421951", "0.64191914", "0.6418432", "0.6416401", "0.6408933", "0.64087677", "0.6397582", "0.6390994", "0.63698155", "0.6368452", "0.63622266", "0.635929", "0.63576835", "0.6347317", "0.63453674" ]
0.7567011
5
GET /disatance_and_times GET /disatance_and_times.json
def index @disatance_and_times = DisatanceAndTime.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end", "def set_disatance_and_time\n @disatance_and_time = DisatanceAndTime.find(params[:id])\n end", "def index\n @timecards = TimeCard.all\n render :json => @timecards.to_json(:include => :time_entry), status: :ok\n end", "def index\n @dis_durations = DisDuration.all\n end", "def index\n @announces = Announce.not_finished.order(\"stime DESC\")\n\t\t@pannounces = Announce.finished.last_24_hours.limit(20).order(\"etime DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announces }\n end\n end", "def show\n @nursing_time = NursingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nursing_time }\n end\n end", "def show\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_gap }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end", "def show\n @order = Order.find(params[:id])\n @order_dishes = @order.order_dishes.includes(:dish).order(\"order_dishes.time\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def destroy\n @disatance_and_time.destroy\n respond_to do |format|\n format.html { redirect_to disatance_and_times_url, notice: 'Disatance and time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @timecard = Timecard.find(params[:timecard_id])\n render :json => Hour.timecard_hours(@timecard)\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clock_time }\n end\n end", "def show\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_off_request }\n end\n end", "def show\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def index \n misses = Miss.all.order(created_at: :desc)\n render json: misses \n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def create\n @disatance_and_time = DisatanceAndTime.new(disatance_and_time_params)\n\n respond_to do |format|\n if @disatance_and_time.save\n format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully created.' }\n format.json { render :show, status: :created, location: @disatance_and_time }\n else\n format.html { render :new }\n format.json { render json: @disatance_and_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end", "def index\n @trades = Trade\n .only(:created_at, :is_fair, :ash_pokemons, :brock_pokemons)\n respond_to do |format|\n format.json { render json: @trades }\n end\n end", "def index\n @time_charges = TimeCharge.all\n end", "def show\n @time_balance = TimeBalance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @time_balance }\n end\n end", "def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end", "def show\n @doctor_timing = DoctorTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doctor_timing }\n end\n end", "def index\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end", "def show\n @hurdle_time = HurdleTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hurdle_time }\n end\n end", "def available_trends\n get(\"/trends/available.json\")\n end", "def index\n @rides = Ride.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @rides\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 respond_with DisIndiastate.find(params[:id])\n end", "def index\n render json: {time: Time.now}\n end", "def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end", "def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end", "def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def get_rated_disabilities\n if @headers['va_eauth_birlsfilenumber'].blank?\n Rails.logger.info('Missing `birls_id`', edipi: @headers['va_eauth_dodedipnid'])\n end\n with_monitoring_and_error_handling do\n Rails.cache.fetch(\"evss_rated_disabilities/#{@headers['va_eauth_dodedipnid']}-#{@headers['va_eauth_pnid']}\",\n expires_in: 30.minutes) do\n raw_response = perform(:get, 'ratedDisabilities')\n RatedDisabilitiesResponse.new(raw_response.status, raw_response)\n end\n end\n end", "def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end", "def index\n @time_entry ||= current_user.time_entries.build(\n :tdate => Date.today\n )\n \n @time_entries = current_firm.all_time_entries\n\n respond_to do |format|\n format.html { render :index }# index.html.erb\n format.json { render json: @time_entries }\n end\n end", "def show\n @student = Student.find(params[:id])\n @times = times\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end", "def disatance_and_time_params\n params.require(:disatance_and_time).permit(:start_id, :end_id, :cost_time, :distance)\n end", "def all_rated_disabilities\n settings = Settings.lighthouse.veteran_verification.form526\n icn = UserAccount.where(id: user_account_id).first&.icn\n service = ApiProviderFactory.rated_disabilities_service_provider(\n { auth_headers:, icn: }\n )\n @all_rated_disabilities ||= begin\n response = service.get_rated_disabilities(settings.access_token.client_id, settings.access_token.rsa_key)\n response.rated_disabilities\n end\n end", "def show\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytime }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def trends_available\n get(\"/trends/available.json\")\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def index\n @datings = Dating.all\n end", "def get_disputes(opts = {})\n data, _status_code, _headers = get_disputes_with_http_info(opts)\n data\n end", "def showtimes_json(day)\n showtimes_by_cinemas_json(CONST::WORD_DAY_HASH[day]).to_json\n end", "def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def index\n @clock = @employee.clock_in_out\n render json: @clock\n end", "def index\n @stay_times = StayTime.all\n end", "def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end", "def index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end", "def district_events\n start = Time.now\n\n # action is in app controller\n\t\tjson = get_district_events\n\n respond_to do |format|\n format.json { render json: json}\n end\n\t\tlogger.debug \"@ time to render district events json: #{Time.now-start} seconds\"\n end", "def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end", "def index\n @cooking_times = CookingTime.all\n end", "def index\n\n @hurdle_times = HurdleTime.order('time, hurdle_match_id, lane')\n\n if params[:hurdle_match_id]\n @hurdle_times = @hurdle_times.where(:hurdle_match_id => params[:hurdle_match_id])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hurdle_times }\n end\n end", "def chatting_time(*args)\n @client.get \"#{@path}/chatting_time\", Hash[*args]\n end", "def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end", "def index\n set_user\n @time_offs = TimeOff.all\n end", "def dates\n render json: @standings\n end", "def index\r\n @clocks = ClockResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @clocks }\r\n end\r\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def show\n\n \t\t\trespond_with @teetime\n\n \t\tend", "def get_data_for_time_span()\n set_schedule_query_params\n\n @t1 = Time.at(@t1.to_i)\n @t2 = Time.at(@t2.to_i)\n\n @rsrcs = @config.resource_list # ScheduledResource.resource_list\n\n @blockss = ScheduledResource.get_all_blocks(@config, @t1, @t2, @inc)\n\n json_adjustments\n end", "def index\n @class_times = ClassTime.all\n end", "def index\n @taxis = Taxi.where(:open_for_bidding => true).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxis }\n end\n end", "def show\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stop_time }\n end\n end", "def index\n if params[:user_id]\n @clock_events = ClockEvent.where(user_id: params[:user_id]).order(event_time: :desc)\n end\n render json: @clock_events\n end", "def show\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeentry }\n end\n end", "def show\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end", "def update\n respond_to do |format|\n if @disatance_and_time.update(disatance_and_time_params)\n format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully updated.' }\n format.json { render :show, status: :ok, location: @disatance_and_time }\n else\n format.html { render :edit }\n format.json { render json: @disatance_and_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @clock_event\n end", "def nsewc\n\t\tif params[\"type\"] == \"three\"\n\t\t\ttime = Time.zone.now.hour\n\t\t\tdoc2 = Nokogiri::HTML(open('http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/past-24-hour-psi-readings'))\n\t\t\tarray = doc2.css('td').to_a\n\t\t\tarrayResult = Array.new\n\t\t\tarrayResult.push(array[1].content.strip)\n\t\t\tarrayResult.push(array[4].content.strip)\n\t\t\tarrayResult.push(array[7].content.strip)\n\t\t\tarrayResult.push(array[10].content.strip)\n\t\t\tarrayResult.push(array[13].content.strip)\n\n\t\t\trender :json => arrayResult\n\t\telsif params[\"type\"] == \"twofive\"\n\t\t\ttime = Time.zone.now.hour\n\t\t\tdoc2 = Nokogiri::HTML(open('http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/past-24-hour-psi-readings'))\n\t\t\tarray = doc2.css('td').to_a\n\t\t\tarrayResult = Array.new\n\t\t\tarrayResult.push(array[2].content.strip)\n\t\t\tarrayResult.push(array[5].content.strip)\n\t\t\tarrayResult.push(array[8].content.strip)\n\t\t\tarrayResult.push(array[11].content.strip)\n\t\t\tarrayResult.push(array[14].content.strip)\n\t\t\trender :json => arrayResult\n\t\telse\n\t\t\ttime = Time.zone.now.hour\n\t\t\tdoc2 = Nokogiri::HTML(open('http://app2.nea.gov.sg/anti-pollution-radiation-protection/air-pollution/psi/past-24-hour-psi-readings'))\n\t\t\tarray = doc2.css('td').to_a\n\t\t\tarrayResult = Array.new\n\t\t\tarrayResult.push(array[2].content.strip)\n\t\t\tarrayResult.push(array[5].content.strip)\n\t\t\tarrayResult.push(array[8].content.strip)\n\t\t\tarrayResult.push(array[11].content.strip)\n\t\t\tarrayResult.push(array[14].content.strip)\n\t\t\trender :json => arrayResult\n\t\tend\n\tend", "def hours\n render json: Pings::Selector.new.hours(params)\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def show\n @schedule = Schedule.includes(:pill_times).find(params[:id])\n @patient = @schedule.patient\n @statistic = SchedulePresenter.new(@schedule)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedules }\n end\n end", "def show\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_track }\n end\n end", "def index\n @timings = Timing.all\n end", "def getTimingDetails\n labels = [] # store links accessed during review\n percentages = [] # store percentage time per link for pie chart\n tables = [] # store timing data breakdown per link\n stats = [] # store class stat data\n\n # get total time spent on review\n totalTime = getTotalTime(params[:reponse_map_id], params[:round])\n\n # push relevant data for each row into arrays used to fill in JSON\n SubmissionViewingEvent.where(map_id: params[:reponse_map_id], round: params[:round]).each do |entry|\n labels.push(entry.link)\n percentages.push(entry.total_time.to_f / totalTime)\n tables.push({\n \"subject\" => entry.link,\n \"timeCost\" => secondsToHuman(entry.total_time.to_i),\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round], entry.link))\n })\n end\n\n tables.push({\n \"subject\" => \"Total\",\n # contains total time spent in human format\n \"timeCost\" => secondsToHuman(totalTime),\n # contains average review time for this submission in human format\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Class Average',\n \"value\" => secondsToHuman(getClassAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Median',\n \"value\" => secondsToHuman(getMedianRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Standard Deviation',\n \"value\" => secondsToHuman(getStdDevRevTime(params[:reponse_map_id], params[:round]))\n })\n\n # create JSON\n @timingDetails = {\n # contains links accessed in review\n 'Labels'=> labels,\n # contains percentage time spent per link\n 'Data' => percentages,\n # contains link name and time spent for display table\n 'tables' => tables,\n # contains class stats\n 'stats' => stats\n }\n\n # respond to request with JSON containing all data\n respond_to do |format|\n format.json { render json: @timingDetails }\n end\n end", "def index\n @dis_doseperiods = DisDoseperiod.all\n end", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def index\n @timecards = @member.timecards.all\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def index\n @showdowns = Showdown.unscoped.order(\"created_at DESC\").page(params[:page]).per(CONFIG[:memories_per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @showdowns }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n @show_cat = @restaurant.categories.collect {|cat| cat.category}\n @rest_days_open = @restaurant.restaurant_hours.map {|h| Date::ABBR_DAYNAMES[h.day - 6]}\n @rest_time_open = @restaurant.restaurant_hours.map {|h| h.open}\n @rest_time_closed = @restaurant.restaurant_hours.map {|h| h.close}\n end", "def index\n @admission_types = AdmissionType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @admission_types }\n end\n end", "def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end", "def show\n render json: @timer\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @pricings = Pricing.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @pricings\n end", "def index\n @discipline = Discipline[params[\"discipline\"]]\n @discipline_names = Discipline.names\n @calculations = Calculations::V3::Calculation.where(year: @year).includes(:event)\n\n respond_to do |format|\n format.html\n format.xml do\n fresh_when RacingAssociation.current, public: true\n all_events\n end\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end" ]
[ "0.64136195", "0.6285597", "0.62769437", "0.62163085", "0.6099392", "0.60022205", "0.5944305", "0.5899647", "0.58721507", "0.58182645", "0.5808619", "0.5808281", "0.57819", "0.5777804", "0.57705355", "0.57500273", "0.57400453", "0.5731615", "0.56889737", "0.5687546", "0.565705", "0.5656814", "0.56402075", "0.5630305", "0.5615124", "0.55931693", "0.55901164", "0.5585789", "0.5570202", "0.55645436", "0.5544385", "0.55427134", "0.5540281", "0.5532623", "0.55305564", "0.55253375", "0.55253375", "0.5523267", "0.5519436", "0.5503424", "0.5500126", "0.5492418", "0.5492152", "0.5489215", "0.5482885", "0.54790753", "0.5476987", "0.5475093", "0.54717004", "0.54715466", "0.5463438", "0.5460638", "0.5450646", "0.54453534", "0.54409707", "0.54359865", "0.5435002", "0.54321563", "0.5430789", "0.542867", "0.54266834", "0.5423921", "0.54171854", "0.5415061", "0.54086924", "0.540484", "0.5404725", "0.5403364", "0.5403304", "0.5401545", "0.5400192", "0.5396384", "0.5386471", "0.5381486", "0.5381038", "0.53773844", "0.53744215", "0.53642386", "0.5360651", "0.5341251", "0.5337633", "0.5336278", "0.5329739", "0.5321586", "0.5319999", "0.5319253", "0.53190863", "0.5316471", "0.5313958", "0.5303859", "0.5299257", "0.529084", "0.52907515", "0.528222", "0.52813053", "0.527841", "0.526888", "0.5268635", "0.52658606", "0.5264581" ]
0.7489211
0
GET /disatance_and_times/1 GET /disatance_and_times/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @disatance_and_times = DisatanceAndTime.all\n end", "def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end", "def show\n @nursing_time = NursingTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nursing_time }\n end\n end", "def set_disatance_and_time\n @disatance_and_time = DisatanceAndTime.find(params[:id])\n end", "def index\n @timecards = TimeCard.all\n render :json => @timecards.to_json(:include => :time_entry), status: :ok\n end", "def show\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_gap }\n end\n end", "def index\n @dis_durations = DisDuration.all\n end", "def show\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_off_request }\n end\n end", "def index\n @announces = Announce.not_finished.order(\"stime DESC\")\n\t\t@pannounces = Announce.finished.last_24_hours.limit(20).order(\"etime DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announces }\n end\n end", "def show\n @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinic_timing }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clock_time }\n end\n end", "def show\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def show\n @doctor_timing = DoctorTiming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doctor_timing }\n end\n end", "def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end", "def show\n @time_balance = TimeBalance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @time_balance }\n end\n end", "def show\n @hurdle_time = HurdleTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hurdle_time }\n end\n end", "def index\n @timecard = Timecard.find(params[:timecard_id])\n render :json => Hour.timecard_hours(@timecard)\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def show\n @order = Order.find(params[:id])\n @order_dishes = @order.order_dishes.includes(:dish).order(\"order_dishes.time\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @order }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json {\n\n render :json => TimeOff.joins('LEFT OUTER JOIN request_types ON time_offs.request_type_id = request_types.id')\n .joins('INNER JOIN users ON time_offs.user_id = users.id')\n .select(\n 'time_offs.id,\n time_offs.request_start_date,\n time_offs.request_end_date,\n time_offs.status,\n time_offs.comments,\n users.name as users_name,\n request_types.name as request_type_name') }\n end\n end", "def show\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daytime }\n end\n end", "def show\n @breadcrumb = 'read'\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def index\n render json: {time: Time.now}\n end", "def index \n misses = Miss.all.order(created_at: :desc)\n render json: misses \n end", "def show\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeentry }\n end\n end", "def show\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @my_time_trial }\n end\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\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 @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_track }\n end\n end", "def show\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stop_time }\n end\n end", "def show\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one_time_stop }\n end\n end", "def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end", "def create\n @disatance_and_time = DisatanceAndTime.new(disatance_and_time_params)\n\n respond_to do |format|\n if @disatance_and_time.save\n format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully created.' }\n format.json { render :show, status: :created, location: @disatance_and_time }\n else\n format.html { render :new }\n format.json { render json: @disatance_and_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @disatance_and_time.destroy\n respond_to do |format|\n format.html { redirect_to disatance_and_times_url, notice: 'Disatance and time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end", "def show\n @student = Student.find(params[:id])\n @times = times\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student }\n end\n end", "def show\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service_time }\n end\n end", "def index\n @time_charges = TimeCharge.all\n end", "def show\n respond_with DisIndiastate.find(params[:id])\n end", "def show\n @time_report = TimeReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_report }\n end\n end", "def show\n @offset_time = OffsetTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offset_time }\n end\n end", "def index\n @time_entry ||= current_user.time_entries.build(\n :tdate => Date.today\n )\n \n @time_entries = current_firm.all_time_entries\n\n respond_to do |format|\n format.html { render :index }# index.html.erb\n format.json { render json: @time_entries }\n end\n end", "def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end", "def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end", "def index\n @rides = Ride.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @rides\n end", "def show\n @timechart = Timechart.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timechart }\n end\n end", "def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end", "def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end", "def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def show\n @time_record = TimeRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_record }\n end\n end", "def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def show\n @receiver_time = ReceiverTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receiver_time }\n end\n end", "def show\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_section }\n end\n end", "def show\n @disaster_type = DisasterType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disaster_type }\n end\n end", "def index\n @trades = Trade\n .only(:created_at, :is_fair, :ash_pokemons, :brock_pokemons)\n respond_to do |format|\n format.json { render json: @trades }\n end\n end", "def show\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_time }\n end\n end", "def show\n @breadcrumb = 'read'\n @timerecord_type = TimerecordType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timerecord_type }\n end\n end", "def index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end", "def show\n render json: @timer\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\n @dtpic = Dtpic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dtpic }\n end\n end", "def index\n @tea_times = TeaTime.all\n respond_to do |format|\n format.html { render layout: !request.xhr? }\n format.json { render json: @tea_times }\n end\n end", "def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end", "def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end", "def show\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_type }\n end\n end", "def show\n render json: @duration\n end", "def show\n @duration_frequency = DurationFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @duration_frequency }\n end\n end", "def show\n\n \t\t\trespond_with @teetime\n\n \t\tend", "def show\n @schedule = Schedule.includes(:pill_times).find(params[:id])\n @patient = @schedule.patient\n @statistic = SchedulePresenter.new(@schedule)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedules }\n end\n end", "def show\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipy }\n end\n end", "def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end", "def time_entry(id)\n object_from_response(:get, \"time_entries/#{id}\", \"time-entry\")\n end", "def show\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_point }\n end\n end", "def index\n @disabilities = Disability.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @disabilities }\n end\n end", "def show\n @heart_rate_type = HeartRateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heart_rate_type }\n end\n end", "def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def show\n @time_episode = TimeEpisode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_episode }\n end\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def show\n render json: @clock_event\n end", "def show\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timetable }\n end\n end", "def show\n @timetable = Timetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timetable }\n end\n end", "def index\r\n @clocks = ClockResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @clocks }\r\n end\r\n end", "def index\n @clock = @employee.clock_in_out\n render json: @clock\n end", "def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def index\n @disciplines = Discipline.all\n #respond_to do |format|\n # format.json { render json: @disciplines, status: :ok }\n #end\n #render json: @disciplines, status: :ok\n respond_with @disciplines\n end", "def index\n @timecharts = Timechart.find(:all, order: \"stop_time DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timecharts }\n end\n end", "def index\n @timings = Timing.all\n end", "def show\n @tripdate = Tripdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tripdate }\n end\n end", "def show\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timer }\n end\n end", "def index\n\n @hurdle_times = HurdleTime.order('time, hurdle_match_id, lane')\n\n if params[:hurdle_match_id]\n @hurdle_times = @hurdle_times.where(:hurdle_match_id => params[:hurdle_match_id])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hurdle_times }\n end\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def show\n @member_time = MemberTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @member_time }\n end\n end", "def index\n @class_times = ClassTime.all\n end", "def show\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closing_day }\n end\n end", "def index\n \n # if params[:dress_id]\n # @dress = Dress.find(params[:dress_id])\n @ratings = Rating.all\n render json: @ratings, except:[:created_at, :updated_at] ,status: 200\n \n # else \n # @ratings= Rating.all\n # binding.pry \n # end\n end", "def index\n @taxis = Taxi.where(:open_for_bidding => true).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxis }\n end\n end", "def index\n set_user\n @time_offs = TimeOff.all\n end", "def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end" ]
[ "0.7261556", "0.6566656", "0.63707715", "0.6319267", "0.6292924", "0.62879294", "0.6216548", "0.61538696", "0.61334884", "0.60958594", "0.60204345", "0.6000614", "0.59909314", "0.59870553", "0.59870553", "0.59599185", "0.5956315", "0.59465414", "0.59288746", "0.5889409", "0.58776104", "0.5865123", "0.585965", "0.5852511", "0.5841311", "0.58404815", "0.58270806", "0.58247155", "0.5813452", "0.58123744", "0.5801056", "0.5765112", "0.5739709", "0.5738571", "0.57133216", "0.5709706", "0.57077503", "0.5695429", "0.5688466", "0.568134", "0.56812346", "0.56797636", "0.56770164", "0.5671151", "0.56680095", "0.5667218", "0.56573653", "0.56480783", "0.56398183", "0.5639814", "0.5639814", "0.5631444", "0.5629578", "0.56265104", "0.5620606", "0.5619819", "0.5617237", "0.5616208", "0.5603797", "0.5592499", "0.5590998", "0.5581418", "0.5579986", "0.5578885", "0.55772656", "0.5572048", "0.55676395", "0.5566912", "0.5563117", "0.55604887", "0.5559473", "0.5559148", "0.5551142", "0.55414987", "0.55405694", "0.5538767", "0.55333364", "0.55299085", "0.55271876", "0.5520354", "0.55189776", "0.55189776", "0.55128556", "0.5511691", "0.5507329", "0.55024266", "0.5497956", "0.5489601", "0.54864866", "0.54855335", "0.5483715", "0.54819596", "0.5474278", "0.5469076", "0.54682887", "0.54677427", "0.54552203", "0.5452422", "0.545073", "0.54502034", "0.5447198" ]
0.0
-1
POST /disatance_and_times POST /disatance_and_times.json
def create @disatance_and_time = DisatanceAndTime.new(disatance_and_time_params) respond_to do |format| if @disatance_and_time.save format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully created.' } format.json { render :show, status: :created, location: @disatance_and_time } else format.html { render :new } format.json { render json: @disatance_and_time.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disatance_and_time_params\n params.require(:disatance_and_time).permit(:start_id, :end_id, :cost_time, :distance)\n end", "def set_disatance_and_time\n @disatance_and_time = DisatanceAndTime.find(params[:id])\n end", "def index\n @disatance_and_times = DisatanceAndTime.all\n end", "def destroy\n @disatance_and_time.destroy\n respond_to do |format|\n format.html { redirect_to disatance_and_times_url, notice: 'Disatance and time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_time_request\n TimeRequest.create(\n time: [ Time.new(2000, 1, 1, 14, 0, 0, \"+00:00\").utc, Time.new(2000, 1, 1, 13, 0, 0, \"+00:00\").utc, Time.new(2000, 1, 1, 12, 0, 0, \"+00:00\").utc ].sample,\n reservation: Reservation.all.sample,\n check_in: [true, false].sample,\n status: 'pending'\n )\nend", "def update\n respond_to do |format|\n if @disatance_and_time.update(disatance_and_time_params)\n format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully updated.' }\n format.json { render :show, status: :ok, location: @disatance_and_time }\n else\n format.html { render :edit }\n format.json { render json: @disatance_and_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n attendance_params[:checkin] = attendance_params[:checkin].to_time\n attendance_params[:checkout] = attendance_params[:checkout].to_time\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date\n\n r = @api.create_attendance(attendance_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n end", "def create\n @timing = Timing.new(params[:timing].slice(:start, :stop, :days, :parent_class, :parent_id, :active))\n if @timing.save\n render json: @timing\n else\n render json: { error: 'error: could not save timing' }\n end\n end", "def create\n @nursing_time = NursingTime.new(params[:nursing_time])\n\n respond_to do |format|\n if @nursing_time.save\n format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully created.' }\n format.json { render json: @nursing_time, status: :created, location: @nursing_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nursing_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def descoverly_params\n params.require(:descoverly).permit(:descovery_time, :type, :description)\n end", "def create\n @mood_datum = MoodDatum.new(mood_datum_params)\n \n respond_to do |format|\n if @mood_datum.save \n params['significant_events'].each do |key,value| \n PatientSignificantEvent.create(:patient_id =>@mood_datum.user_id ,:doctor_id => @mood_datum.doctor_id ,:mood_data_id =>@mood_datum.id ,:comments => value )\n end \n format.html { redirect_to new_mood_datum_path(:patient => current_user.id), notice: 'Mood datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @mood_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ride = Ride.new(ride_params)\n @ride.assembly_time = params[:ride][:assembly_time]\n @ride.destination_time = params[:ride][:destination_time]\n @ride.check_points = params[:ride][:check_points]\n if @ride.save\n @ride.delay.call_notification(I18n.t('Notification.ride_created'), I18n.t('Email.ride_created'))\n render json: @ride, status: :created\n else\n render json: @ride.errors, status: :unprocessable_entity\n end\n end", "def create\n @dis_duration = DisDuration.new(dis_duration_params)\n\n respond_to do |format|\n if @dis_duration.save\n format.html { redirect_to @dis_duration, notice: 'Dis duration was successfully created.' }\n format.json { render :show, status: :created, location: @dis_duration }\n else\n format.html { render :new }\n format.json { render json: @dis_duration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @downtime = Downtime.new(downtime_params)\n\n respond_to do |format|\n if @downtime.save\n format.html { redirect_to @downtime, notice: 'Downtime was successfully created.' }\n format.json { render action: 'show', status: :created, location: @downtime }\n else\n format.html { render action: 'new' }\n format.json { render json: @downtime.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_gap = TimeGap.new(params[:time_gap])\n\n respond_to do |format|\n if @time_gap.save\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully created.' }\n format.json { render json: @time_gap, status: :created, location: @time_gap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_gap.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n cnt = params[:tutor_availability][:repeat].to_i - 1\n params[:tutor_availability].delete :repeat\n @tutor_availability = TutorAvailability.new(params[:tutor_availability])\n\n respond_to do |format|\n if @tutor_availability.save\n if cnt > 0\n for i in 1..cnt\n new_ta = TutorAvailability.new(params[:tutor_availability])\n new_ta.start_time = @tutor_availability.start_time + 604800*i\n new_ta.save\n end\n end\n format.html { redirect_to tutor_availabilities_path, notice: 'Tutor availability was successfully created.' }\n format.json { render json: @tutor_availability, status: :created, location: @tutor_availability }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor_availability.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end", "def create\n @time_registration = TimeRegistration.create(time_registration_params)\n respond_to do |format|\n if @time_registration.save\n format.json { render :show, status: :created, location: @time_registration }\n else\n format.json { render json: @time_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n heart_beat= DateTime.new(params[\"heart_beat\"][\"heart_beat(1i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(2i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(3i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(4i)\"].to_i,\n params[\"heart_beat\"][\"heart_beat(5i)\"].to_i)\n @heart_beat = HeartBeat.new({heart_beat: heart_beat, intensity: params[\"heart_beat\"][\"intensity\"].to_i})\n @heart_beat.person = Person.first\n\n respond_to do |format|\n if @heart_beat.save\n format.html { redirect_to @heart_beat, notice: 'Heart beat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @heart_beat }\n else\n format.html { render action: 'new' }\n format.json { render json: @heart_beat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cooking_time = CookingTime.new(cooking_time_params)\n\n respond_to do |format|\n if @cooking_time.save\n format.html { redirect_to cooking_times_path, notice: 'Cooking time was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cooking_time }\n else\n format.html { render action: 'new' }\n format.json { render json: @cooking_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @indiastate = DisIndiastate.new(indiastate_params)\n\n\n if @indiastate.save\n flash[:notice] = \"Task was successfully created.\"\n respond_with(@indiastate)\n else\n flash[:notice] = \"Task was not created.\"\n end\n end", "def discount_activity_params\n params.require(:discount_activity).permit(:discount_id, :activity_type_id, :date, :time)\n end", "def create\n mod_params = entrant_params\n date = entrant_params[:date].to_datetime\n date = date.change(hour: params[:time].split(':')[0].to_i, minute: params[:time].split(':')[1].to_i)\n mod_params[:guess] = date\n mod_params.delete('date')\n mod_params.delete('time')\n @entrant = Entrant.create(mod_params)\n\n # respond_to do |format|\n # if @entrant.save\n # format.html { redirect_to @entrant, notice: 'Entrant was successfully created.' }\n # format.json { render :show, status: :created, location: @entrant }\n # else\n # format.html { render :new }\n # format.json { render json: @entrant.errors, status: :unprocessable_entity }\n # end\n # end\n render json: {entrant: @entrant}, status: 200\n end", "def collected_datum_params\n params.require(:collected_datum).permit(:turtle_id, :temperature, :deep, :light, :latitude, :longitude, :date)\n end", "def dischargue_params\n params.require(:dischargue).permit(:liters, :date, :station_id, :load_id)\n end", "def create\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.create(params[:schedule])\n\n # TODO can improve it to use nested attributes\n params[:pill_time].each do |pill_time|\n @schedule.pill_times.build(pill_time)\n end\n\n @pill_times = @schedule.pill_times\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule,\n status: :created,\n location: [@patient, @schedule] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n require 'time'\n str1 = params[:injury][:when]\n if(str1 == '')\n str1 = '01/01/2017'\n end\n params[:injury][:when] = Time.parse(str1).to_i\n\n\n str1 = params[:injury][:datetrain]\n if(str1 != '')\n params[:injury][:datetrain] = Time.parse(str1).to_i\n end\n\n str1 = params[:injury][:datematch]\n if(str1 != '')\n params[:injury][:datematch] = Time.parse(str1).to_i\n end\n\n str1 = params[:injury][:dateperf]\n if(str1 != '')\n params[:injury][:dateperf] = Time.parse(str1).to_i\n end\n\n @injury = Injury.new(injury_params)\n\n\n respond_to do |format|\n if @injury.save\n format.html { redirect_to user_path(@injury.user_id), notice: 'Injury was successfully created.' }\n format.json { render :show, status: :created, location: @injury }\n end\n end\n end", "def solicitar_lista_entregas_pdd pdd,kind,start_time,end_time\n require \"rubygems\"\n require 'json'\n require \"net/http\"\n require 'yaml'\n \n \n uri=URI( 'http://162.243.215.24/PDV/PDD_list_deliveries')\n \n resp = Net::HTTP.post_form(uri,'pddid'=>pdd,'kind'=>kind,'startime'=>start_time,'endtime'=>end_time,'token'=>\"mentira\")\n @record=JSON.parse(resp.body)\n @record\n #função ok\n \n end", "def create\n @doctor_timing = DoctorTiming.new(params[:doctor_timing])\n\n respond_to do |format|\n if @doctor_timing.save\n format.html { redirect_to @doctor_timing, notice: 'Doctor timing was successfully created.' }\n format.json { render json: @doctor_timing, status: :created, location: @doctor_timing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @doctor_timing.errors, status: :unprocessable_entity }\n end\n end\n end", "def time_tracker_params\n params.require(:time_tracker).permit(:time, :desc)\n end", "def create\n set_user\n @time_off = TimeOff.new(time_off_params)\n\n respond_to do |format|\n if @time_off.save\n format.html { redirect_to user_time_off_path(@user, @time_off), notice: 'Time off was successfully created.' }\n format.json { render action: 'show', status: :created, location: @time_off }\n else\n format.html { render action: 'new' }\n format.json { render json: @time_off.errors, status: :unprocessable_entity }\n end\n end\n end", "def lession_time_params\n params.require(:lession_time).permit(:day, :start_at, :end_at)\n end", "def create\n @t_correcteddatum = TCorrecteddatum.new(t_correcteddatum_params)\n @t_correcteddatum.attributes = { m_user_id: current_user.id }\n if params[:punchdata]\n @t_correcteddatum.corrected_time = nil\n end\n\n respond_to do |format|\n if @t_correcteddatum.save\n format.html { redirect_to root_path, notice: 'T correcteddatum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @t_correcteddatum }\n else\n format.html { render action: 'new' }\n format.json { render json: @t_correcteddatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def discharge_params\n params.require(:discharge).permit(:discharge_date,:final_diagnoses,:visit_id,:reason_for_addmission)\n end", "def create\n @downtime_type = DowntimeType.new(downtime_type_params)\n\n respond_to do |format|\n if @downtime_type.save\n format.html { redirect_to downtime_types_url, notice: '成功添加.' }\n format.json { render :show, status: :created, location: @downtime_type }\n else\n format.html { render :new }\n format.json { render json: @downtime_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_treinador = TimeTreinador.new(time_treinador_params)\n @time_treinador.treinador = @treinador\n\n respond_to do |format|\n if @time_treinador.save\n format.html { redirect_to @time_treinador, notice: 'Time criado com sucesso' }\n format.json { render :show, status: :created, location: @time_treinador }\n else\n format.html { render :new }\n format.json { render json: @time_treinador.errors, status: :unprocessable_entity }\n end\n end\n end", "def occasion_params\n params.require(:occasion).permit(:name, :date, :time)\n end", "def test_empty_distance_and_duration\n post \"/rides/add\", {date: \"2010-05-05\", distance: \"0\", duration: \"00:00\"}\n\n assert_equal(422, last_response.status)\n error_message = \"You must enter a distance or a duration.\"\n assert_includes(last_response.body, error_message)\n\n get \"/home\"\n assert_equal(200, last_response.status)\n assert_includes(last_response.body, \"<h2>Ride History</h2>\")\n refute_includes(last_response.body, \"0\")\n refute_includes(last_response.body, \"00:00\")\n end", "def ride_params\n params.fetch(:ride).permit(:trail_id, :day, :time)\n end", "def timecard_params\n params.require(:timecard).permit(:date, :return, :placements, :hours)\n end", "def timecard_params\n params.require(:timecard).permit(:time_in, :time_out, :tasks, :notes)\n end", "def create\n @test_ride = TestRide.new(test_ride_params)\n @control = BookingTimeControl.book_time_control_method(params)\n \n if @control == true\n if @test_ride.save\n render json: @test_ride, status: :created\n # Create Notifications\n @test_ride.delay.test_ride_booking_notification(I18n.t('Notification.test_ride_booking'), I18n.t('Email.test_ride_booking_dealer'), I18n.t('Email.test_ride_booking_user'), params)\n else\n render json: @test_ride.errors, status: :unprocessable_entity\n end\n else\n render json: @control\n end\n end", "def create\n\n \t\t\t@teetime = Teetime.new teetime_params\n\n \t\t\tif @teetime.save\n\n \t\t\t\trender json: @teetime,status: :created\n\n \t\t\telse\n\n \t\t\t\trender json: {error: true,errors: @teetime.errors},status: :unprocessable_entity\n\n \t\t\tend\n\n \t\tend", "def create\n @timeslot = Timeslot.new(timeslot_params)\n @timeslot.save!\n render :json => @timeslot.as_json\n end", "def create\n @stay_time = StayTime.new(stay_time_params)\n\n respond_to do |format|\n if @stay_time.save\n format.html { redirect_to @stay_time, notice: 'Stay time was successfully created.' }\n format.json { render :show, status: :created, location: @stay_time }\n else\n format.html { render :new }\n format.json { render json: @stay_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timing = Timing.new(timing_params)\n\n if @timing.save\n render :show, status: :created, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end", "def create_day\n trip = Trip.find(params[:id])\n offset = 0\n trip.days.all.each do |day|\n offset += 1\n end\n @day = Day.new({\"date\" => trip.beginning + offset , \"trip\" => trip})\n trip.update_attribute(:duration, trip.attributes['duration'] + 1)\n trip.save\n respond_to do |format|\n if @day.save\n format.html { redirect_to trip, notice: 'Day was successfully created.' }\n format.json { render :show, status: :created, location: @day }\n else\n format.html { render home_path }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n end", "def evening_nautical_twilight\n create_time @data['evening']['twilight']['nautical']\n end", "def create\n @mat_turma = MatTurma.new(mat_turma_params)\n disciplinas = Disciplina.where(\"disciplinas.turma_id=\"+@mat_turma.turma_id.to_s)\n disciplinas.each do |disciplina|\n matriculadisc = @mat_turma.mat_discs.build\n matriculadisc.disciplina_id = disciplina.id\n end\n respond_to do |format|\n if @mat_turma.save\n format.html { redirect_to @mat_turma, notice: 'Mat turma was successfully created.' }\n format.json { render :show, status: :created, location: @mat_turma }\n else\n format.html { render :new }\n format.json { render json: @mat_turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @daytime = Daytime.new(params[:daytime])\n\n respond_to do |format|\n if @daytime.save\n format.html { redirect_to @daytime, notice: 'Daytime was successfully created.' }\n format.json { render json: @daytime, status: :created, location: @daytime }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daytime.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n description = params[:description]\n \n timestamp = params[:timestamp]\n total_sleep_seconds = params[:total_sleep]\n deep_sleep_seconds = params[:deep]\n light_sleep_seconds = params[:light]\n awake_seconds = params[:awake]\n \n if timestamp.nil? || total_sleep_seconds.nil?\n \n puts 'timestamp is nil or total_sleep_seconds is nil :('\n \n else\n \n total_sleep = total_sleep_seconds / 60.0\n deep = deep_sleep_seconds / 60.0\n light = light_sleep_seconds / 60.0\n awake = awake_seconds / 60.0\n \n post_to_twitter = false\n post_to_facebook = false\n \n # FellAsleepAt is formatted: August 23, 2013 at 11:01PM\n # Convert to Runkeeper's preferred format: Sat, 1 Jan 2011 00:00:00\n timestamp_datetime = DateTime.parse(timestamp)\n formatted_timestamp = timestamp_datetime.strftime(\"%a, %d %b %Y %H:%M:%S\")\n \n json_hash['timestamp'] = formatted_timestamp\n json_hash['total_sleep'] = deep\n json_hash['deep'] = deep\n json_hash['light'] = light\n json_hash['awake'] = awake\n json_hash['post_to_twitter'] = post_to_twitter\n json_hash['post_to_facebook'] = post_to_facebook\n \n url = 'https://api.runkeeper.com/sleep'\n \n uri = URI.parse(url)\n \n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri)\n request[\"Authorization\"] = \"Bearer \" + RUNKEEPER_ACCESS_TOKEN\n request[\"Content-Type\"] = \"application/vnd.com.runkeeper.NewSleep+json\"\n request.body = json_hash.to_json\n \n response = http.request(request)\n \n puts response.body\n \n end\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n \n end", "def attendance_params\n params.require(:attendance).permit(:clock_in_time, :clock_out_time, :date, :division)\n end", "def heartrate_params\n params.require(:heartrate).permit(:time, :value, :patient_id)\n end", "def create\n @awareness = Awareness.new(awareness_params)\n @awareness.insert_time=Time.now\n @awareness.update_time=Time.now\n respond_to do |format|\n if @awareness.save\n format.html { redirect_to @awareness, notice: '気づきが正常に登録されました' }\n format.json { render :show, status: :created, location: @awareness }\n \n @awarenesses_has_information = AwarenessesHasInformation.new(awarenesses_id:@awareness.id,information_id:params[:awareness][:information_id])\n @awarenesses_has_information.save \n\n else\n format.html { render :new }\n format.json { render json: @awareness.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end", "def create\n @dis_duplicate_therapy = DisDuplicateTherapy.new(dis_duplicate_therapy_params)\n\n respond_to do |format|\n if @dis_duplicate_therapy.save\n format.html { redirect_to @dis_duplicate_therapy, notice: 'Dis duplicate therapy was successfully created.' }\n format.json { render :show, status: :created, location: @dis_duplicate_therapy }\n else\n format.html { render :new }\n format.json { render json: @dis_duplicate_therapy.errors, status: :unprocessable_entity }\n end\n end\n end", "def cooking_time_params\n params.require(:cooking_time).permit(:title, :order)\n end", "def new\n @time_gap = TimeGap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @time_gap }\n end\n end", "def create\n\n user_from_api_key = User.find_by(api_key: request.headers[:apiKey])\n return render json: {rides: [], message: \"Access denied\"}, status: :unauthorized if user_from_api_key.nil?\n\n departure_place = params[:departure_place]\n departure_threshold = params[:departure_place_threshold].to_i\n destination = params[:destination]\n destination_threshold = params[:destination_threshold].to_i\n if params.has_key?(:departure_time)\n departure_time = Time.zone.parse(params[:departure_time])\n end\n user = User.find_by(api_key: request.headers[:apiKey])\n ride_type = params[:ride_type].to_i\n\n if user.nil?\n return render json: {:message => \"User not found\"}, status: :not_found\n else\n # add this search to table ride_searches which is displayed as a timeline\n user.ride_searches.create!(departure_place: departure_place, destination: destination,\n departure_time: departure_time, ride_type: ride_type)\n end\n\n rides = Ride.rides_nearby departure_place, departure_threshold, destination,\n destination_threshold, departure_time, ride_type\n\n\n if rides.count > 0\n render json: {:rides => rides, each_serializer: RideSerializer}, status: :ok\n else\n render json: {:rides => []}, status: :no_content\n end\n\n end", "def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @patient = Patient.new(patient_params)\n # @numOfPatients = \"number of patients\"\n \n # respond_to do |format|\n # if @patient.save\n # @count = Patient.count-1\n # flash[:numOfPatients] = \"number of patients in the front: #{@count}\"\n # format.html { redirect_to patients_url, notice: \"Estimated wait time : #{@count} hours\"}\n # format.json { render :show, status: :created, location: @patient }\n # else\n # format.html { render :new }\n # format.json { render json: @patient.errors, status: :unprocessable_entity }\n # end\n # end\n time = Time.new.in_time_zone('Central Time (US & Canada)')\n flag = false\n flag1 = true\n res_hour = -1\n res_min = -1\n p_hour = -1\n p_minute = -1\n \n @patients = Patient.order(:id)\n @patients.each do |patient|\n p_time = patient.time.split(\":\")\n p_hour = p_time[0].to_i\n p_minute = p_time[1].to_i\n \n if ((p_hour > time.hour.to_i) or (p_hour == time.hour.to_i and p_minute > time.min.to_i)) and (patient.name.eql? \"_name\")\n flag = true\n res_hour = p_hour - time.hour.to_i\n res_min = p_minute - time.min.to_i\n \n if(res_min < 0)\n res_hour = res_hour - 1\n res_min = 60 + res_min\n end\n \n flag1 = patient.update(patient_params)\n # patient.update_attribute(:name, patient_params[:patient][:name])\n # patient.update_attribute(:number, patient_params[:patient][:number])\n break\n end\n end\n \n respond_to do |format|\n if flag and flag1\n format.html { redirect_to patients_url, notice: \"Estimated wait time : #{res_hour} hours, #{res_min} minutes / tiempo estimado : #{res_hour} horas, #{res_min} minutos\"}\n elsif !flag1\n flash[:notice] = \"ERROR: No Duplicate entry allowed. Number can contain only 10 digits from 0-9.\"\n format.html { render :new}\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to patients_url, notice: \"No more patient accepted, please come tomorrow\"}\n end\n end\n end", "def party_time(options)\n self.class.post(\"/open311/v2/requests.json\", query: options, headers: {'api_key' => ENV['API_KEY']})\n end", "def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end", "def create\n @time_entry = TimeEntry.new(time_entry_params)\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render :show, status: :created, location: @time_entry }\n else\n format.html { render :new }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n @transaction.update(user_id: session[:user_id])\n @transaction.update(status: 'Scheduled')\n\n @timingsList = []\n @datesList = []\n @timings = Timing.find_by_sql(\"SELECT day, hours, minutes, ampm FROM timings\")\n @timings.each do |timing|\n timing.day = date_of_next(timing.day).strftime(\"%d %b %Y\") + \" - \" + timing.hours + \":\" + timing.minutes + \" \" + timing.ampm\n @timingsList.push([timing.day, timing.day])\n end\n for i in 0..9\n @datesList.push([(Date.today+i).strftime(\"%d %b %Y\"), (Date.today+i).strftime(\"%d %b %Y\")])\n end\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @my_time_trial = MyTimeTrial.new(params[:my_time_trial])\n\n respond_to do |format|\n if @my_time_trial.save\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully created.' }\n format.json { render :json => @my_time_trial, :status => :created, :location => @my_time_trial }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def ride_params\n params.require(:ride).permit(\n :time,\n :ride_type,\n :from_location,\n :destination,\n :info,\n :seats,\n :status\n )\n end", "def create\n\n params[:refill_type] = params[:refill_type].to_i\n params[:status] = params[:status].to_i\n params[:cost_basis] = params[:cost_basis].to_i\n params[:other_coverage_code] = params[:other_coverage_code].to_i\n params[:reason_for_delay] = params[:reason_for_delay].to_i\n params[:partial_fill_status] = params[:partial_fill_status].to_i\n params[:reported_to_pmp] = params[:reported_to_pmp].to_i\n\n @dispense = Dispense.new(dispense_params)\n\n respond_to do |format|\n if @dispense.save\n format.html { redirect_to @dispense, notice: 'Dispense was successfully created.' }\n format.json { render :show, status: :created, location: @dispense }\n else\n format.html { render :new }\n format.json { render json: @dispense.errors, status: :unprocessable_entity }\n end\n end\n end", "def tombstone_timehold_params\n params.require(:tombstone_timehold).permit(:tombstoneJSON, :permanent, :rating)\n end", "def create\n @workSegment = @workday.workSegments.last\n puts @workSegment.workday.dayDate\n # if @workSegment.timePunches.count == 0\n # @currentStatus = false\n # else\n # @lastTimePunch = @workSegment.timePunches.last\n # @currentStatus = @lastTimePunch.status\n # end\n\n @time_punch = @workSegment.timePunches.new(punch: Time.current, status: true)\n\n respond_to do |format|\n if @time_punch.save\n format.html { redirect_to dashboard_path, notice: 'Time punch was successfully created.' }\n # format.json { render :show, status: :created, location: @time_punch }\n else\n format.html { redirect_to dashboard_path, notice: 'clock record was not created(from tp controller).' }\n # format.json { render json: @time_punch.errors, status: :unprocessable_entity }\n end\n end\n end", "def getTimingDetails\n labels = [] # store links accessed during review\n percentages = [] # store percentage time per link for pie chart\n tables = [] # store timing data breakdown per link\n stats = [] # store class stat data\n\n # get total time spent on review\n totalTime = getTotalTime(params[:reponse_map_id], params[:round])\n\n # push relevant data for each row into arrays used to fill in JSON\n SubmissionViewingEvent.where(map_id: params[:reponse_map_id], round: params[:round]).each do |entry|\n labels.push(entry.link)\n percentages.push(entry.total_time.to_f / totalTime)\n tables.push({\n \"subject\" => entry.link,\n \"timeCost\" => secondsToHuman(entry.total_time.to_i),\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round], entry.link))\n })\n end\n\n tables.push({\n \"subject\" => \"Total\",\n # contains total time spent in human format\n \"timeCost\" => secondsToHuman(totalTime),\n # contains average review time for this submission in human format\n \"avgTime\" => secondsToHuman(getAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Class Average',\n \"value\" => secondsToHuman(getClassAvgRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Median',\n \"value\" => secondsToHuman(getMedianRevTime(params[:reponse_map_id], params[:round]))\n })\n\n stats.push({\n \"title\" => 'Standard Deviation',\n \"value\" => secondsToHuman(getStdDevRevTime(params[:reponse_map_id], params[:round]))\n })\n\n # create JSON\n @timingDetails = {\n # contains links accessed in review\n 'Labels'=> labels,\n # contains percentage time spent per link\n 'Data' => percentages,\n # contains link name and time spent for display table\n 'tables' => tables,\n # contains class stats\n 'stats' => stats\n }\n\n # respond to request with JSON containing all data\n respond_to do |format|\n format.json { render json: @timingDetails }\n end\n end", "def create\n @timeentry = Timeentry.new(params[:timeentry])\n\n respond_to do |format|\n if @timeentry.save\n format.html { redirect_to @timeentry, notice: 'Timeentry was successfully created.' }\n format.json { render json: @timeentry, status: :created, location: @timeentry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timeentry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reparacion = Reparacion.new(reparacion_params)\n @reparacion.rep_estado = 'Espera'\n @reparacion.rep_fecha_in=Time.new\n @reparacion.rep_fecha_term=\"0000/00/00\"\n respond_to do |format|\n if @reparacion.save\n format.html { redirect_to @reparacion, notice: 'Reparacion was successfully created.' }\n format.json { render :show, status: :created, location: @reparacion }\n else\n format.html { render :new }\n format.json { render json: @reparacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #not sure why this was here...? @trips = Trip.all\n\n @expense_report = ExpenseReport.new(expense_report_params)\n authorize @expense_report\n @expense_report.submitter = current_account.accountable\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.save\n format.html { redirect_to home_index_path, notice: 'Expense report was successfully created.' }\n format.json { render :show, status: :created, location: @expense_report }\n else\n format.html { render :new }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def multi_create\n my_params = params.dup\n my_params.delete :action\n my_params.delete :controller\n recorded_at = begin\n time_code = my_params.delete(:time_code)\n Time.at time_code\n rescue\n Time.new\n end\n family = my_params.delete(:collection)\n my_params.each do |name, value|\n DataPoint.save family, name, value, recorded_at\n end\n\n render :text => 'ok'\n end", "def create\n @interview = Interview.new(params[:interview])\n if params[:minute]==\"\"\n params[:minute]=\"00\"\n end\n if params[:minute1]==\"\"\n params[:minute1]=\"00\"\n end\n if params[:minute2]==\"\"\n params[:minute2]=\"00\"\n end\n date1 = params[:date]+ \" \" + params[:hour] + \":\" +params[:minute] + \" \" +params[:ampm]\n date2 = params[:alternateDate]+ \" \" + params[:hour1] + \":\" +params[:minute1] + \" \" +params[:ampm1]\n date3 = params[:alternateDate2]+ \" \" + params[:hour2] + \":\" +params[:minute2] + \" \" +params[:ampm2]\n begin\n date=Time.strptime(date1, \"%m/%d/%Y %I:%M %p\")\n rescue\n redirect_to :back, :notice => \"There was something wrong with with your first date\"\n return\n end\n begin\n date_alternate=Time.strptime(date2, \"%m/%d/%Y %I:%M %p\")\n rescue\n date_alternate=date\n end\n begin\n date_alternate_second= Time.strptime(date3, \"%m/%d/%Y %I:%M %p\")\n rescue\n date_alternate_second=date\n end\n\n\n @interview.date = date\n @interview.date_alternate = date_alternate\n @interview.date_alternate_second = date_alternate_second\n @interview.teacher_id = params[:interview][:teacher_id]\n @interview.job_id = params[:interview][:job_id]\n \n respond_to do |format|\n if @interview.save\n UserMailer.interview_notification(@interview.teacher_id, @interview.job_id).deliver\n \n format.html { redirect_to session[:return_to], notice: 'Interview request has been sent.' }\n format.json { render json: @interview, status: :created, location: @interview }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.find(params[:event_id])\n @eventtime = @event.eventtimes.create(params[:eventtime])\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to(@event, :notice => 'Eventtime was successfully created.') }\n format.xml { render :xml => @eventtime, :status => :created, :location => @eventtime }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @eventtime.errors, :status => :unprocessable_entity }\n end\n end\n end", "def timetrack_params\n params.require(:timetrack).permit(:costortime, :jahrmonat, :user_id, :mobject_id, :activity, :amount, :datum)\n end", "def create\n @new_trip = Trip.create(trip_params)\n @trip = Trip.new(trip_params)\n @trip_types = [[\"Weekend Getaway\", 1], [\"Boys Trip\", 2], [\"Bachelorette\", 3], [\"Road Trip\", 4], [\"Adventure\", 5], [\"Other\", 6]]\n # @first_attendee -> add the current user as an attendee automatically - when creating a trip\n @first_attendee = Attendee.create!([{trip_id: @new_trip.id, user_id: current_user.id, balance: 0}])\n # @attendees -> list of attendees only for current trip\n @attendees = Attendee.where(trip_id: params[:trip_id])\n @number_of_possible_attendees = @new_trip.number_of_possible_attendees\n @price_per_night = @new_trip.price_per_night\n @trip_length_night = (@new_trip.end_date - @new_trip.start_date).to_i\n @total_cost = @price_per_night.to_i * @trip_length_night.to_i\n respond_to do |format|\n @attendees_amount = @attendees.size\n if @new_trip.save\n # calculating total possible trip cost after trip has been created!\n @total_possible_accomodation_cost_per_person = @total_cost.to_i / @number_of_possible_attendees.to_i\n @new_trip.update_attribute(:total_possible_cost, @total_possible_accomodation_cost_per_person)\n @new_trip.update_attribute(:total_confirmed_cost, @total_confirmed_accomodation_cost_per_person)\n format.html { redirect_to \"/trips/#{@new_trip.id}\", notice: \"Welcome to your trip's page!\" }\n format.json { render :show, status: :created, location: @trip }\n else\n # format.html { redirect_to @new_trip }\n format.html { redirect_back(fallback_location: root_path) }\n format.json { render json: @new_trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stime = Stime.new(stime_params)\n\n respond_to do |format|\n if @stime.save\n format.html { redirect_to @stime, notice: 'Stime was successfully created.' }\n format.json { render :show, status: :created, location: @stime }\n else\n format.html { render :new }\n format.json { render json: @stime.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nursing_time = NursingTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nursing_time }\n end\n end", "def create\n @meteo_datum = MeteoDatum.new(meteodatum_params)\n @meteo_datum.weather_station_id = params[:weather_station_id]\n\n if @meteo_datum.save\n render json: @meteo_datum, status: :created\n else\n render json: @meteo_datum.errors, status: :unprocessable_entity\n end\n end", "def create\n @downtime_record = DowntimeRecord.new(downtime_record_params)\n\n respond_to do |format|\n if @downtime_record.save\n format.html { redirect_to downtime_records_url, notice: '成功添加.' }\n format.json { render :show, status: :created, location: @downtime_record }\n else\n format.html { render :new }\n format.json { render json: @downtime_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dis_alcohol_interaction = DisAlcoholInteraction.new(dis_alcohol_interaction_params)\n\n\n if @dis_alcohol_interaction.save\n flash[:notice] = \"Task was successfully created.\"\n respond_with(@dis_alcohol_interaction)\n else\n flash[:notice] = \"Task was not created.\"\n end\n end", "def dial_road dials={}\n raise \"Set exactly two dials.\" if dials.keys.size != 2\n\n # convert to proper timestamp\n unless dials[\"goaldate\"].nil?\n dials[\"goaldate\"] = @user.convert_to_timezone dials[\"goaldate\"] if @user.enforce_timezone?\n dials[\"goaldate\"] = dials[\"goaldate\"].strftime('%s')\n end\n \n @user.post \"users/me/goals/#{@slug}/dial_road.json\", dials\n end", "def open_appointments\n date = Date.parse(params[:date])\n clinic = Clinic.find(params[:clinic_id])\n doctor = Doctor.find(params[:doctor_id])\n # @times = doctor.open_appointment_times(date)\n @times = clinic.open_appointment_times(date, doctor)\n if @times.is_a?(Hash)\n render json: {status: 1, error: @times[:error]}\n else\n render json: { status: 0, times: @times }\n end\n #@appointment = Appointment.new\n #render json: {open_times: @open_times}\n # render json: {times: [\n # {time: '8:00 AM', enabled: true, selected: false, index: 0},\n # {time: '8:30 AM', enabled: false, selected: false, index: 1},\n # {time: '9:00 AM', enabled: true, selected: false, index: 2},\n # {time: '9:30 AM', enabled: true, selected: false, index: 3},\n # {time: '10:00 AM', enabled: false, selected: false, index: 4},\n # {time: '10:30 AM', enabled: false, selected: false, index: 5},\n # {time: '11:00 AM', enabled: false, selected: false, index: 6},\n # {time: '11:30 AM', enabled: true, selected: false, index: 7},\n # {time: '12:00 PM', enabled: true, selected: false, index: 8},\n # {time: '12:30 PM', enabled: true, selected: false, index: 9},\n # {time: '1:00 PM', enabled: false, selected: false, index: 10},\n # {time: '1:30 PM', enabled: true, selected: false, index: 11},\n # {time: '2:00 PM', enabled: false, selected: false, index: 12},\n # {time: '2:30 PM', enabled: false, selected: false, index: 13},\n # {time: '3:00 PM', enabled: true, selected: false, index: 14},\n # {time: '3:30 PM', enabled: true, selected: false, index: 15},\n # {time: '4:00 PM', enabled: true, selected: false, index: 16},\n # {time: '4:30 PM', enabled: false, selected: false, index: 17},\n # {time: '5:00 PM', enabled: true, selected: false, index: 18},\n # {time: '5:30 PM', enabled: true, selected: false, index: 19}]}\n\n end", "def valid_post_hash\n {\n :from_location_id => Location.first.id,\n :to_location_id => Location.last.id,\n :available_seats => 2,\n :total_price => 2,\n :departure_date => SpClock.date,\n :departure_time => SpClock.time,\n :duration_in_minutes => 15,\n :ride_type => \"sudan\"\n }\n end", "def create\n @time_record = TimeRecord.new(params[:time_record])\n @time_record.value = (@time_record.ended_at - @time_record.started_at) / 1.hour\n @time_record.recorded_on = @time_record.started_at.to_date\n\n respond_to do |format|\n if @time_record.save\n format.html { redirect_to time_records_path, notice: 'Time record was successfully created.' }\n format.json { render json: @time_record.to_json, status: :created, location: @time_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_record.errors.full_messages, 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 dis_duration_params\n params.require(:dis_duration).permit(:description, :status_id)\n end", "def create\n @indication = DisIndication.new(indication_params)\n\n\n if @indication.save\n flash[:notice] = \"Task was successfully created.\"\n respond_with(@indication)\n else\n flash[:notice] = \"Task was not created.\"\n end\n end", "def create\n temp = []\n cust_iti_detail_id = params[\"iti_cust_dest_poa_detail\"][\"cust_iti_detail_id\"]\n preferred_time_of_arrival = params[\"preferred_time_of_arrival\"].each_slice(2).to_a\n preferred_time_of_departure = params[\"preferred_time_of_departure\"].each_slice(2).to_a\n params[\"dest_iti_detail_id\"].each_with_index do |arg,i|\n iti_cust_dest_poa_detail = ItiCustDestPoaDetail.new\n iti_cust_dest_poa_detail.cust_iti_detail_id = cust_iti_detail_id\n iti_cust_dest_poa_detail.dest_iti_detail_id = arg.to_i\n iti_cust_dest_poa_detail.points_of_attraction_id = params[\"points_of_attraction_id\"][i]\n iti_cust_dest_poa_detail.preferred_time_of_arrival = preferred_time_of_arrival[i].map{ |k| \"#{k}\"}.join(\":\")\n iti_cust_dest_poa_detail.preferred_time_of_departure = preferred_time_of_departure[i].map{ |k| \"#{k}\"}.join(\":\")\n iti_cust_dest_poa_detail.day_number = params[\"day_number\"][i]\n iti_cust_dest_poa_detail.save\n end\n respond_to do |format|\n flash.now[:notice] = 'All Details Added successfully'\n format.html { redirect_to iti_cust_dest_poa_details_path, notice: 'All Details Added successfully'}\n format.json { render action: 'show', status: :created, location: iti_cust_dest_poa_detail }\n end\n end", "def create\n @stop_time = StopTime.new(params[:stop_time])\n\n respond_to do |format|\n if @stop_time.save\n format.html { redirect_to @stop_time, notice: 'Stop time was successfully created.' }\n format.json { render json: @stop_time, status: :created, location: @stop_time }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stop_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n @dispute = Dispute.new(dispute_params)\n\n respond_to do |format|\n if @dispute.save\n format.html { redirect_to @dispute, notice: 'Dispute was successfully created.' }\n format.json { render :show, status: :created, location: @dispute }\n else\n format.html { render :new }\n format.json { render json: @dispute.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @session_note = SessionNote.new\n @session_note.note = params[:note]\n @session_note.session_id = params[:session_id]\n respond_to do |format|\n if @session_note.save\n @session_note.created_at = params[:time].to_s\n @session_note.save\n format.any { render :json => {:response => 'Success' },:status => 200 }\n else\n format.html { render :new }\n format.json { render json: @session_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clinic_timing = ClinicTiming.new(params[:clinic_timing])\n\n respond_to do |format|\n if @clinic_timing.save\n format.html { redirect_to @clinic_timing, notice: 'Clinic timing was successfully created.' }\n format.json { render json: @clinic_timing, status: :created, location: @clinic_timing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clinic_timing.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6476341", "0.64049864", "0.6137282", "0.59819573", "0.59797984", "0.58441556", "0.5719973", "0.57143366", "0.57141", "0.56469536", "0.5605883", "0.5602034", "0.55547816", "0.5551453", "0.54402834", "0.54284286", "0.5420759", "0.5411625", "0.53763384", "0.5375875", "0.536286", "0.53445125", "0.5312252", "0.5297486", "0.5296102", "0.52760005", "0.52680993", "0.52666223", "0.5240432", "0.52327603", "0.5226064", "0.5219663", "0.5219116", "0.52163416", "0.5205109", "0.5188802", "0.51884794", "0.5170737", "0.5167384", "0.5165022", "0.5160495", "0.51566905", "0.5153178", "0.5130926", "0.51299256", "0.51299155", "0.51299155", "0.51299155", "0.51278573", "0.51269746", "0.51245254", "0.5122772", "0.5122314", "0.51179373", "0.51177156", "0.5116637", "0.5113922", "0.5113599", "0.51126164", "0.51125133", "0.51108027", "0.51105356", "0.5108573", "0.50931436", "0.50868165", "0.5085047", "0.50796396", "0.5076893", "0.50741506", "0.5073837", "0.50736827", "0.50690687", "0.5067254", "0.50605345", "0.505976", "0.50543994", "0.50536007", "0.5052655", "0.5049694", "0.5049686", "0.50404245", "0.50365806", "0.50353134", "0.5031794", "0.5030239", "0.5029776", "0.5029053", "0.50247186", "0.50203186", "0.50200254", "0.50185955", "0.5014298", "0.5012243", "0.50113547", "0.5010428", "0.50089985", "0.5002542", "0.49987003", "0.49960357", "0.49953297" ]
0.71925676
0
PATCH/PUT /disatance_and_times/1 PATCH/PUT /disatance_and_times/1.json
def update respond_to do |format| if @disatance_and_time.update(disatance_and_time_params) format.html { redirect_to @disatance_and_time, notice: 'Disatance and time was successfully updated.' } format.json { render :show, status: :ok, location: @disatance_and_time } else format.html { render :edit } format.json { render json: @disatance_and_time.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @time_off_request = TimeOffRequest.find(params[:id])\n respond_to do |format|\n if @time_off_request.update_attributes(params[:time_off_request])\n format.html { redirect_to admin_time_off_requests_url, notice: 'Time off request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_off_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cooking_time.update(cooking_time_params)\n format.html { redirect_to cooking_times_path, notice: 'Cooking time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cooking_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_entry = current_firm.all_time_entries.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nursing_time = NursingTime.find(params[:id])\n\n respond_to do |format|\n if @nursing_time.update_attributes(params[:nursing_time])\n format.html { redirect_to @nursing_time, notice: 'Nursing time was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nursing_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timing = Timing.find(params[:id])\n if @timing.update_attributes(params[:timing].slice(:start, :stop, :days, :active))\n render json: @timing\n else\n render json: { error: 'error: could not update timing' }\n end\n end", "def update\n @one_time_stop = OneTimeStop.find(params[:id])\n\n respond_to do |format|\n if @one_time_stop.update_attributes(params[:one_time_stop])\n format.html { redirect_to @one_time_stop, notice: 'One time stop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_time_stop.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.find(params[:id])\n @pill_times = @schedule.pill_times\n\n # TODO can improve it to use nested attributes\n if params[:pill_time]\n params[:pill_time].each_with_index do |pill_time, idx|\n if @pill_times[idx]\n @pill_times[idx].update_attributes(pill_time)\n else\n @pill_times.create(pill_time)\n end\n end\n end\n\n # remove unused pill times\n if params[:pill_time]\n diff = @pill_times.size - params[:pill_time].size\n @pill_times.destroy(@pill_times.last(diff)) if diff > 0\n end\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @downtime.update(downtime_params)\n format.html { redirect_to @downtime, notice: 'Downtime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @downtime.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_time_trial = MyTimeTrial.find(params[:id])\n\n respond_to do |format|\n if @my_time_trial.update_attributes(params[:my_time_trial])\n format.html { redirect_to @my_time_trial, :notice => 'My time trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @my_time_trial.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @time_gap = TimeGap.find(params[:id])\n\n respond_to do |format|\n if @time_gap.update_attributes(params[:time_gap])\n format.html { redirect_to @time_gap, notice: 'Time gap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_gap.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 @clinic_timing = ClinicTiming.find(params[:id])\n\n respond_to do |format|\n if @clinic_timing.update_attributes(params[:clinic_timing])\n format.html { redirect_to @clinic_timing, notice: 'Clinic timing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinic_timing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offset_time = OffsetTime.find(params[:id])\n\n respond_to do |format|\n if @offset_time.update_attributes(params[:offset_time])\n format.html { redirect_to @offset_time, notice: 'Offset time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offset_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event = Event.from_param(params[:event_id])\n @time_table = @event.time_tables.where(:permalink => params[:id]).first\n success = params[:time_table] && params[:time_table][:times] && \n @time_table.update_attributes(:times => JSON.parse(params[:time_table][:times]))\n success ? update_success : update_failure\n rescue JSON::ParserError\n update_failure\n end", "def update\n respond_to do |format|\n if @time_clock.update(time_clock_params)\n format.html { redirect_to time_sheet_index_path(@time_clock), notice: 'Time clock entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_clock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_slot = TimeSlot.find(params[:id])\n @recurrence_array = @time_slot.recurrence_pattern.split(//)\n respond_to do |format|\n if @time_slot.update_attributes(params[:time_slot])\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_control.update(time_control_params)\n format.html { redirect_to @time_control, notice: 'Time control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @teetime.update(teetime_params)\n\n render json: @teetime,status: :ok\n\n else\n\n render json: {error: true,errors: @teetime.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "def update\n respond_to do |format|\n if @time_charge.update(time_charge_params)\n format.html { redirect_to @time_charge, notice: 'Time charge was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_charge }\n else\n format.html { render :edit }\n format.json { render json: @time_charge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ride = Ride.find(params[:id])\n if @ride.update(ride_params)\n @ride.update(assembly_time: params[:ride][:assembly_time])\n @ride.update(destination_time: params[:ride][:destination_time])\n @ride.update(check_points: params[:ride][:check_points])\n render json: @ride\n \n @ride.delay.call_notification(I18n.t('Notification.ride_updated'), I18n.t('Email.ride_updated'))\n #head :no_content\n\n else\n render json: @ride.errors, status: :unprocessable_entity\n end\n end", "def update\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n if @meal_time.update_attributes(params[:meal_time])\n format.html { redirect_to @meal_time, notice: 'Meal time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service_time = ServiceTime.find(params[:id])\n\n respond_to do |format|\n if @service_time.update_attributes(params[:service_time])\n format.html { redirect_to @service_time, notice: 'Service time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task.update(task_params)\n @task.whenever_reset unless task_params[:every].blank? && task_params[:at].blank?\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @outcome_timepoint = OutcomeTimepoint.find(params[:id])\n\t@outcome_timepoint.update_attributes(params[:outcome_timepoint])\n end", "def update\n authorize_action_for @specialty_show\n\n @specialty_show.coordinator = Dj.find(params[:specialty_show].delete(:coordinator_id))\n @specialty_show.djs = Dj.find(params[:specialty_show].delete(:djs).reject(&:blank?))\n @specialty_show.set_times_conditionally_from_params params[:specialty_show]\n\n respond_to do |format|\n if @specialty_show.update(specialty_show_params)\n format.html { redirect_to @specialty_show, notice: 'Specialty show was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialty_show }\n else\n format.html { render :show }\n format.json { render json: @specialty_show.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # if @study_spot.is_open\n # # create a new row in the usage_time table\n # UsageTime.create(start: DateTime.now, end: DateTime.now, study_spot_id: @study_spot.id)\n # else\n # # update the end time to be the time the study_spot was made available again\n # UsageTime.where(study_spot_id: @study_spot.id).last.update_attribute(:end, DateTime.now)\n # end\n # status = @study_spot.update_attribute(:is_open, !@study_spot.is_open)\n # respond_to do |format|\n # if status\n # format.html { redirect_to @study_spot.room, notice: 'Study spot was successfully updated.' }\n # format.json { render :show, status: :ok, location: @study_spot }\n # else\n # format.html { render :edit }\n # format.json { render json: @study_spot.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n params[:task][:time] = parse_task_time(params[:task][:time], params[:anytime][:anytime])\n \n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_entry.update(time_entry_params)\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_entry }\n else\n format.html { render :edit }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_disatance_and_time\n @disatance_and_time = DisatanceAndTime.find(params[:id])\n end", "def update\n respond_to do |format|\n if @dis_duration.update(dis_duration_params)\n format.html { redirect_to @dis_duration, notice: 'Dis duration was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_duration }\n else\n format.html { render :edit }\n format.json { render json: @dis_duration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stime.update(stime_params)\n format.html { redirect_to @stime, notice: 'Stime was successfully updated.' }\n format.json { render :show, status: :ok, location: @stime }\n else\n format.html { render :edit }\n format.json { render json: @stime.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_trial.update(time_trial_params)\n format.html { redirect_to @time_trial, notice: 'Time trial was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_trial }\n else\n format.html { render :edit }\n format.json { render json: @time_trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @working_time = WorkingTime.find(params[:id])\n\n respond_to do |format|\n if @working_time.update_attributes(params[:working_time])\n format.html { redirect_to time_tables_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @working_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n if @timeentry.update_attributes(params[:timeentry])\n format.html { redirect_to @timeentry, notice: 'Timeentry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @timeentry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_line.update(time_line_params)\n format.html { redirect_to @time_line, notice: 'Time line was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_line }\n else\n format.html { render :edit }\n format.json { render json: @time_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @downtime_type.update(downtime_type_params)\n format.html { redirect_to downtime_types_url, notice: '成功更新.' }\n format.json { render :show, status: :ok, location: @downtime_type }\n else\n format.html { render :edit }\n format.json { render json: @downtime_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_section = TimeSection.find(params[:id])\n\n respond_to do |format|\n if @time_section.update_attributes(params[:time_section])\n format.html { redirect_to @time_section, notice: 'Time section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order_break_time.update(order_break_time_params)\n format.html { redirect_to @order_break_time, notice: 'Order break time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @order_break_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @receiver_time = ReceiverTime.find(params[:id])\n\n respond_to do |format|\n if @receiver_time.update_attributes(params[:receiver_time])\n format.html { redirect_to @receiver_time, notice: 'Receiver time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receiver_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_clock = TimeClock.find(params[:id])\n respond_to do |format|\n if @time_clock.update(time_clock_params)\n format.html { redirect_to @time_clock.user }\n format.json { render :show, status: :ok, location: @time_clock }\n else\n format.html { render :edit }\n format.json { render json: @time_clock.errors, status: :unprocessable_entity }\n end\n @time_clock.billed = 0\n @time_clock.hours = time_diff(@time_clock.clock_in, @time_clock.clock_out)\n @time_clock.save!\n end\n end", "def update\n @appointment = Appointment.find(params[:id])\n str_datetime = params[:datetime].to_datetime\n # @appointment.date = DateTime.strptime(params[:appointment][:datetime], \"%m-%d-%Y\")\n @appointment.date = str_datetime\n @appointment.time = str_datetime\n @appointment.description = params[:appointment][:description]\n\n respond_to do |format|\n if @appointment.save()\n format.html { redirect_to manager_appointment_path(@appointment), notice: 'Appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cal_time.update(cal_time_params)\n format.html { redirect_to @cal_time, notice: 'Cal time was successfully updated.' }\n format.json { render :show, status: :ok, location: @cal_time }\n else\n format.html { render :edit }\n format.json { render json: @cal_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stop_time = StopTime.find(params[:id])\n\n respond_to do |format|\n if @stop_time.update_attributes(params[:stop_time])\n format.html { redirect_to @stop_time, notice: 'Stop time was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stop_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location_time.update(location_time_params)\n format.html { redirect_to @location_time, notice: 'Location time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @location_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_track = TimeTrack.find(params[:id])\n\n respond_to do |format|\n if @time_track.update_attributes(params[:time_track])\n format.html { redirect_to @time_track, notice: 'Time track was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_track.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @daytime = Daytime.find(params[:id])\n\n respond_to do |format|\n if @daytime.update_attributes(params[:daytime])\n format.html { redirect_to @daytime, notice: 'Daytime was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @daytime.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @awareness.update_time=Time.now\n if @awareness.update(awareness_params)\n format.html { redirect_to @awareness, notice: 'Awareness was successfully updated.' }\n format.json { render :show, status: :ok, location: @awareness }\n else\n format.html { render :edit }\n format.json { render json: @awareness.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @doctor_timing = DoctorTiming.find(params[:id])\n\n respond_to do |format|\n if @doctor_timing.update_attributes(params[:doctor_timing])\n format.html { redirect_to @doctor_timing, notice: 'Doctor timing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @doctor_timing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource @ride, ride_params\n end", "def update\n @time_point = TimePoint.find(params[:id])\n\n respond_to do |format|\n if @time_point.update_attributes(params[:time_point])\n format.html { redirect_to @time_point, notice: 'Time point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_user\n set_time_off\n respond_to do |format|\n if @time_off.update(time_off_params)\n format.html { redirect_to user_time_off_path(@user, @time_off), notice: 'Time off was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @time_off.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dishtype.update(dishtype_params)\n format.html { redirect_to @dishtype, notice: 'Dishtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dishtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n self.unuse_pto_hours\n if @time_off_instance.update(time_off_instance_params)\n self.use_pto_hours\n format.html { redirect_to @time_off_instance, notice: 'Time off instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_off_instance }\n else\n format.html { render :edit }\n format.json { render json: @time_off_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trip = Trip.find(params[:id])\n \n \n params[:trip][:category_ids] ||= []\n params[:trip][:type_ids] ||= []\n \n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, :notice => 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @providers_opening_time.update(providers_opening_time_params)\n format.html { redirect_to providers_opening_times_path, notice: 'Opening time was successfully updated.' }\n format.json { render :show, status: :ok, location: @providers_opening_time }\n else\n format.html { render :edit }\n format.json { render json: @providers_opening_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @class_time.update(class_time_params)\n format.html { redirect_to @class_time, notice: 'Class time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @class_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_slot.update(time_slot_params)\n format.html { redirect_to @time_slot, notice: 'Time slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_slot }\n else\n format.html { render :edit }\n format.json { render json: @time_slot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n attendance_params[:checkout] = DateTime.parse(attendance_params[:checkout]) if attendance_params[:checkout].present?\n attendance_params[:attendance_date] = attendance_params[:attendance_date].to_date if attendance_params[:attendance_date].present?\n\n r = @api.update_attendance(params[:id], attendance_params)\n respond_to do |format|\n if r.code == 204\n format.html { redirect_to attendances_url, notice: 'Attendance was successfully updated.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to attendances_url, alert: response['message']}\n end\n end\n \n end", "def update\n respond_to do |format|\n if @timecard.update(timecard_params)\n format.html { redirect_to @timecard, notice: 'Timecard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timecard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_of_day.update(time_of_day_params)\n format.html { redirect_to @time_of_day, notice: 'Time of day was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_of_day }\n else\n format.html { render :edit }\n format.json { render json: @time_of_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:thing][:time] = @thing.time + params[:thing][:time].to_f if @thing.time\n\n respond_to do |format|\n if @thing.update(thing_params)\n format.html { redirect_to things_url, notice: 'The thing was updated.' }\n format.json { render :show, status: :ok, location: @thing }\n\n # Realtime push\n message = {:channel => '/things', :data => { :name => @thing.name, :time => @thing.time}}\n uri = URI.parse(\"http://localhost:9292/faye\")\n Net::HTTP.post_form(uri, :message => message.to_json)\n else\n format.html { render :edit }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @periodicity.update(periodicity_params)\n format.html { redirect_to @periodicity, notice: 'Periodicity was successfully updated.' }\n format.json { render :show, status: :ok, location: @periodicity }\n else\n format.html { render :edit }\n format.json { render json: @periodicity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @heart_rate_type = HeartRateType.find(params[:id])\n\n respond_to do |format|\n if @heart_rate_type.update_attributes(params[:heart_rate_type])\n format.html { redirect_to @heart_rate_type, notice: 'Heart rate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heart_rate_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @timecontroll.update(timecontroll_params)\n format.html { redirect_to @timecontroll, notice: 'Timecontroll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @timecontroll.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @timing.update(timing_params)\n render :show, status: :ok, location: @timing\n else\n render json: @timing.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @poi_time.update(poi_time_params)\n format.html { redirect_to @poi_time, notice: 'Poi time was successfully updated.' }\n format.json { render :show, status: :ok, location: @poi_time }\n else\n format.html { render :edit }\n format.json { render json: @poi_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n if @task.closed = true\n @task.effective_achievement_date = Date.today\n @task.stopover_id = Stopover.find(:first, :conditions => \"name = 'Closed'\").id\n end\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @dispatch_time = args[:dispatch_time] if args.key?(:dispatch_time)\n @response_status = args[:response_status] if args.key?(:response_status)\n @response_time = args[:response_time] if args.key?(:response_time)\n @schedule_time = args[:schedule_time] if args.key?(:schedule_time)\n end", "def update\n respond_to do |format|\n if @tick.update(tick_params)\n format.html { redirect_to @tick, notice: 'Tick was successfully updated.' }\n format.json { render :show, status: :ok, location: @tick }\n else\n format.html { render :edit }\n format.json { render json: @tick.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @periodic.update(periodic_params)\n format.html { redirect_to @periodic, notice: 'Periódico atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @periodic }\n else\n format.html { render :edit }\n format.json { render json: @periodic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_treinador.update(time_treinador_params)\n format.html { redirect_to @time_treinador, notice: 'Time alterado com sucesso' }\n format.json { render :show, status: :ok, location: @time_treinador }\n else\n format.html { render :edit }\n format.json { render json: @time_treinador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting_time.update(meeting_time_params)\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting_time.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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @hurdle_time = HurdleTime.find(params[:id])\n\n time = (params[:time][:minutes].to_i * 60) + params[:time][:seconds].to_i\n if params[:hurdle_time]\n params[:hurdle_time].store :time, time\n else\n params[:hurdle_time] = {}.store :time, time\n end\n\n respond_to do |format|\n if @hurdle_time.update_attributes(params[:hurdle_time])\n format.html { redirect_to hurdle_match_hurdle_times_path(@hurdle_time.hurdle_match), notice: 'Hurdle time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hurdle_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @time_episode = TimeEpisode.find(params[:id])\n\n respond_to do |format|\n if @time_episode.update_attributes(params[:time_episode])\n format.html { redirect_to @time_episode, notice: 'Time episode was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_episode.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @course_timing.update(course_timing_params)\n format.html { redirect_to @course_timing, notice: 'Course timing was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_timing }\n else\n format.html { render :edit }\n format.json { render json: @course_timing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_card.update(time_card_params)\n format.html { redirect_to @time_card, notice: 'Time card was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_card }\n else\n format.html { render :edit }\n format.json { render json: @time_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def update\n operation = params[:operation]\n case operation\n when 'set_best_time'\n resp = @@serv.set_best_time(params['escape_room_id'], params['best_time'])\n render json: { success: resp.success, message: resp.message }, status: :ok\n else\n render json: { success: false, message: 'Operation can not be preformed' }, status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @stay_time.update(stay_time_params)\n format.html { redirect_to @stay_time, notice: 'Stay time was successfully updated.' }\n format.json { render :show, status: :ok, location: @stay_time }\n else\n format.html { render :edit }\n format.json { render json: @stay_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_punch.update(time_punch_params)\n format.html { redirect_to @time_punch, notice: 'Time punch was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_punch }\n else\n format.html { render :edit }\n format.json { render json: @time_punch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wait_time = WaitTime.find(params[:id])\n\n respond_to do |format|\n if @wait_time.update_attributes(params[:wait_time])\n format.html { redirect_to @wait_time, notice: 'Wait time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wait_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @member_time = MemberTime.find(params[:id])\n\n respond_to do |format|\n if @member_time.update_attributes(params[:member_time])\n format.html { redirect_to @member_time, notice: 'Member time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @member_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @timeslot.update(timeslot_params)\n format.html { redirect_to @timeslot, notice: 'Timeslot was successfully updated.' }\n format.json { render :show, status: :ok, location: @timeslot }\n else\n format.html { render :edit }\n format.json { render json: @timeslot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if UpdateTeaTime.call(@tea_time, tea_time_params)\n format.html { redirect_to profile_path, notice: 'Tea time was successfully updated.' }\n format.json { render json: @tea_time, status: :ok, location: @tea_time }\n else\n format.html { render :edit }\n format.json { render json: @tea_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @heart_beat.update(heart_beat_params)\n format.html { redirect_to @heart_beat, notice: 'Heart beat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @heart_beat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n if @discipline_type.update_attributes(params[:discipline_type])\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @discipline_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n check_admin\n @time_balance = TimeBalance.find(params[:id])\n\n respond_to do |format|\n if @time_balance.update_attributes(params[:time_balance])\n format.html { redirect_to @time_balance, :notice => 'Time balance was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @time_balance.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_registration.update(time_registration_params)\n format.html { redirect_to @time_registration, notice: 'Time registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_registration }\n else\n format.html { render :edit }\n format.json { render json: @time_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admission_type = AdmissionType.find(params[:id])\n\n respond_to do |format|\n if @admission_type.update_attributes(params[:admission_type])\n format.html { redirect_to @admission_type, :notice => 'Tipo de Ingressso atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admission_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @partial_failures = args[:partial_failures] if args.key?(:partial_failures)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update\n respond_to do |format|\n if @observance.update(observance_params)\n format.html { redirect_to @observance, notice: 'Observance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @observance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @time_tracker.update(time_tracker_params)\n format.html { redirect_to @time_tracker, notice: 'Time tracker was successfully updated.' }\n format.json { render :show, status: :ok, location: @time_tracker }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @time_tracker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @call = Call.find(params[:id])\n respond_to do |format|\n if @call.update_attributes(time: DateTime.strptime(params[:call][:time], '%m/%d/%Y %H:%M'))\n format.html { redirect_to @call, notice: 'Call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @call.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64765316", "0.6354351", "0.6337179", "0.63341516", "0.6331484", "0.6283852", "0.6266696", "0.6223409", "0.6210575", "0.6158644", "0.6134187", "0.61199147", "0.6117282", "0.60922605", "0.60922605", "0.6075431", "0.6071622", "0.60702175", "0.6068346", "0.60498685", "0.60428846", "0.6040155", "0.60258144", "0.60247874", "0.6003132", "0.6000156", "0.5994458", "0.59861296", "0.59859705", "0.5961839", "0.59614927", "0.59556305", "0.59502196", "0.59457535", "0.5943107", "0.59382766", "0.59286815", "0.5928517", "0.5917603", "0.59075785", "0.5904413", "0.59033614", "0.5898298", "0.58975357", "0.58926237", "0.5889474", "0.5889397", "0.5878121", "0.5872452", "0.58695674", "0.586669", "0.5852453", "0.5849544", "0.58495194", "0.584879", "0.58449084", "0.58448946", "0.58435017", "0.58351403", "0.5830775", "0.582941", "0.5829274", "0.5826389", "0.5822744", "0.58211625", "0.58174425", "0.5816897", "0.58146715", "0.58132035", "0.58099353", "0.5807006", "0.58037555", "0.5801534", "0.5799657", "0.5797479", "0.5794836", "0.57916623", "0.5786861", "0.578685", "0.57846135", "0.5782002", "0.5780115", "0.5778793", "0.5776961", "0.5767512", "0.57640857", "0.57595", "0.575921", "0.5758469", "0.57536894", "0.5753271", "0.5750579", "0.5749287", "0.57451785", "0.57422656", "0.573603", "0.57352954", "0.57349324", "0.5733366", "0.5731482" ]
0.7111923
0
DELETE /disatance_and_times/1 DELETE /disatance_and_times/1.json
def destroy @disatance_and_time.destroy respond_to do |format| format.html { redirect_to disatance_and_times_url, notice: 'Disatance and time was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @time_gap = TimeGap.find(params[:id])\n @time_gap.destroy\n\n respond_to do |format|\n format.html { redirect_to time_gaps_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cooking_time.destroy\n respond_to do |format|\n format.html { redirect_to cooking_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_off_request = TimeOffRequest.find(params[:id])\n @time_off_request.destroy\n \n respond_to do |format|\n format.html { redirect_to admin_time_off_requests_url}\n format.json { head :ok }\n end\n end", "def destroy\n @downtime.destroy\n respond_to do |format|\n format.html { redirect_to downtimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_duration.destroy\n respond_to do |format|\n format.html { redirect_to dis_durations_url, notice: 'Dis duration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hurdle_time = HurdleTime.find(params[:id])\n @hurdle_time.destroy\n\n respond_to do |format|\n format.html { redirect_to hurdle_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @titletime.destroy\n respond_to do |format|\n format.html { redirect_to titletimes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @daytime = Daytime.find(params[:id])\n @daytime.destroy\n\n respond_to do |format|\n format.html { redirect_to daytimes_url }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @clinic_timing = ClinicTiming.find(params[:id])\n @clinic_timing.destroy\n\n respond_to do |format|\n format.html { redirect_to clinic_timings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_clock.destroy\n respond_to do |format|\n format.html { redirect_to time_sheet_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @timecontroll.destroy\n respond_to do |format|\n format.html { redirect_to timecontrolls_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "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 destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityOpening_times( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/opening_times\",params)\n end", "def destroy\n @time_period.destroy\n format.json { head :no_content }\n end", "def destroy\n @doctor_timing = DoctorTiming.find(params[:id])\n @doctor_timing.destroy\n\n respond_to do |format|\n format.html { redirect_to doctor_timings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_time = MealTime.find(params[:id])\n @meal_time.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_times_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 delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n check_admin\n @time_balance = TimeBalance.find(params[:id])\n @time_balance.destroy\n\n respond_to do |format|\n format.html { redirect_to time_balances_url }\n format.json { head :ok }\n end\n end", "def destroy\n @time_trial.destroy\n respond_to do |format|\n format.html { redirect_to '/admin', notice: 'Time trial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @one_time_stop = OneTimeStop.find(params[:id])\n @one_time_stop.destroy\n\n respond_to do |format|\n format.html { redirect_to one_time_stops_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @stime.destroy\n respond_to do |format|\n format.html { redirect_to stimes_url, notice: 'Stime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_line.destroy\n respond_to do |format|\n format.html { redirect_to time_lines_url, notice: 'Time line was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @timeentry = Timeentry.find(params[:id])\n @timeentry.destroy\n\n respond_to do |format|\n format.html { redirect_to timeentries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @downtime_type.destroy\n respond_to do |format|\n format.html { redirect_to downtime_types_url, notice: '成功删除.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_time.destroy\n respond_to do |format|\n format.html { redirect_to class_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_entry.destroy\n respond_to do |format|\n format.html { redirect_to time_entries_url, notice: 'Time entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_duplicate_therapy.destroy\n respond_to do |format|\n format.html { redirect_to dis_duplicate_therapies_url, notice: 'Dis duplicate therapy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @service_time = ServiceTime.find(params[:id])\n @service_time.destroy\n\n respond_to do |format|\n format.html { redirect_to service_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_break_time.destroy\n respond_to do |format|\n format.html { redirect_to order_break_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @time_entry = current_firm.all_time_entries.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to params[:ret] || firm_time_entries_path(current_firm) }\n format.json { head :ok }\n end\n end", "def destroy\n @disaster_type = DisasterType.find(params[:id])\n @disaster_type.destroy\n\n respond_to do |format|\n format.html { redirect_to disaster_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_series.destroy\n\n respond_to do |format|\n format.html { redirect_to time_series_index_url(@owner), flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.time_series.one'))} }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_section = TimeSection.find(params[:id])\n @time_section.destroy\n\n respond_to do |format|\n format.html { redirect_to time_sections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #Uncomment this if for some reason users should be able to delete TTs\n #@tea_time.destroy\n respond_to do |format|\n format.html { render text: \"I can't let you do that, #{current_user.name}\" }\n format.json { head 403 }\n end\n end", "def destroy\n @time_track = TimeTrack.find(params[:id])\n @time_track.destroy\n\n respond_to do |format|\n format.html { redirect_to time_tracks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @day_statistics = @patient.day_statistics.all\n @day_statistics.delete_all\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Данные пациента удалены.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member_time = MemberTime.find(params[:id])\n @member_time.destroy\n\n respond_to do |format|\n format.html { redirect_to member_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_of_day.destroy\n respond_to do |format|\n format.html { redirect_to time_of_days_url, notice: 'Time of day was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @showtime.destroy\n respond_to do |format|\n format.html { redirect_to showtimes_url, notice: \"Showtime was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @offset_time = OffsetTime.find(params[:id])\n @offset_time.destroy\n\n respond_to do |format|\n format.html { redirect_to offset_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @raw_datum = RawDatum.find(params[:id])\n @raw_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cal_time.destroy\n respond_to do |format|\n format.html { redirect_to cal_times_url, notice: 'Cal time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_treinador.destroy\n respond_to do |format|\n format.html { redirect_to time_treinadors_url, notice: 'Time deletado com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_visitor = TimeVisitor.find(params[:id])\n @time_visitor.destroy\n\n respond_to do |format|\n format.html { redirect_to tour_visitor_time_visitors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @beat = Beat.find(params[:id])\n @beat.destroy\n\n respond_to do |format|\n format.html { redirect_to beats_url }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @wait_time = WaitTime.find(params[:id])\n @wait_time.destroy\n\n respond_to do |format|\n format.html { redirect_to wait_times_url }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stance.destroy\n respond_to do |format|\n format.html { redirect_to stances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stay_time.destroy\n respond_to do |format|\n format.html { redirect_to stay_times_url, notice: 'Stay time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @htscdt.destroy\n respond_to do |format|\n format.html { redirect_to htscdts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_record = TimeRecord.find(params[:id])\n @time_record.destroy\n\n respond_to do |format|\n format.html { redirect_to time_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @periodicity.destroy\n respond_to do |format|\n format.html { redirect_to periodicities_url, notice: 'Periodicity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @downtime_record.destroy\n respond_to do |format|\n format.html { redirect_to downtime_records_url, notice: '成功删除.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @diet_dish.destroy\n respond_to do |format|\n format.html { redirect_to diet_dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dis_alcohol_interaction.destroy\n respond_to do |format|\n format.html { redirect_to dis_alcohol_interactions_url, notice: 'Dis alcohol interaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_type.destroy\n respond_to do |format|\n format.html { redirect_to dish_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @allocated_time.destroy\n respond_to do |format|\n format.html { redirect_to allocated_times_url, notice: 'Allocated time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @important_date.destroy\n respond_to do |format|\n format.html { redirect_to important_dates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_user\n @time_off.destroy\n respond_to do |format|\n format.html { redirect_to user_time_offs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dispute.destroy\n respond_to do |format|\n format.html { redirect_to disputes_url, notice: 'Dispute was successfully destroyed.' }\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 @heart_rate_type = HeartRateType.find(params[:id])\n @heart_rate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heart_rate_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tripdate = Tripdate.find(params[:id])\n @tripdate.destroy\n\n respond_to do |format|\n format.html { redirect_to tripdates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @timecard.destroy\n respond_to do |format|\n format.html { redirect_to timecards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum = Datum.find(params[:id])\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum = Datum.find(params[:id])\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_mood.destroy\n respond_to do |format|\n format.html { redirect_to dish_moods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_point = TimePoint.find(params[:id])\n @time_point.destroy\n\n respond_to do |format|\n format.html { redirect_to time_points_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ways_of_admission = WaysOfAdmission.find(params[:id])\n @ways_of_admission.destroy\n\n respond_to do |format|\n format.html { redirect_to ways_of_admissions_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.694231", "0.6882681", "0.6847577", "0.68420106", "0.6825202", "0.68122077", "0.67942166", "0.675718", "0.6752113", "0.67442197", "0.6717403", "0.6713383", "0.67035717", "0.6677627", "0.66670835", "0.6655729", "0.66526985", "0.66516083", "0.66468483", "0.6644592", "0.66265273", "0.66265273", "0.6617411", "0.6613418", "0.65968263", "0.6594271", "0.65938634", "0.6587808", "0.6582652", "0.65803754", "0.65714365", "0.65705997", "0.65650785", "0.65604454", "0.6554225", "0.65475965", "0.65453535", "0.6542692", "0.653671", "0.6532829", "0.65310407", "0.65282893", "0.65268964", "0.65260655", "0.6526029", "0.65181506", "0.6518099", "0.65097564", "0.65047616", "0.65006626", "0.64937985", "0.64934874", "0.64908844", "0.64761454", "0.647501", "0.6474907", "0.6473937", "0.64739084", "0.6472078", "0.64602655", "0.6459232", "0.64583963", "0.6456427", "0.644478", "0.64443666", "0.64441514", "0.6443724", "0.6441118", "0.64406747", "0.64368516", "0.6433464", "0.6430753", "0.6430753", "0.6429316", "0.64291734", "0.6428912", "0.6428159", "0.6428159", "0.6426403", "0.6424429", "0.64215523", "0.642026", "0.6419561", "0.6416322", "0.6414727", "0.6414037", "0.6405285", "0.6401943", "0.63962317", "0.63962317", "0.63962317", "0.63962317", "0.63903004", "0.6388156", "0.6386064", "0.6382845", "0.6382845", "0.6381092", "0.6379853", "0.63788164" ]
0.7547343
0
Use callbacks to share common setup or constraints between actions.
def set_disatance_and_time @disatance_and_time = DisatanceAndTime.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 disatance_and_time_params params.require(:disatance_and_time).permit(:start_id, :end_id, :cost_time, :distance) 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
Use callbacks to share common setup or constraints between actions.
def set_exams @course = Course.find(params[:course_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def exam_params params.require(:exam).permit(:title, :date, :minimum) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Determine Domain Mapentry and DbModel from entity expression.
def db_table_column(expr, entry = nil) storage_map = storage_map(:db, expr.domain_name) db = fetch_storage_class(storage_map.storage_key) column = storage_map.storage_attr(expr.domain_attr) [db.table_name, column] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entity_for(model) # @private :nodoc:\n entity_mapping[model] or raise \"model #{model} exists, but is not included in domain\"\n end", "def entity_class\n self.class.name.sub(/Mapper$/, '').constantize\n end", "def entity_class\n @entity_class ||= (\"::\" + self.class.name.split('::').last.gsub(/Mapper/, '')).constantize\n @entity_class\n end", "def entityResolver; @entityResolver; end", "def value_for_table_view (type, entity)\n return nil if entity.nil? or type.nil?\n return entity[type] unless type.include? '/'\n temp_hash = entity\n type_split = type.split '/'\n type_split.each do |split|\n if temp_hash.is_a?(Array)\n temp_hash = temp_hash.first[split] unless temp_hash.first.nil?\n elsif temp_hash.has_key? split\n temp_hash = temp_hash[split]\n else\n return nil\n end\n end\n temp_hash\n end", "def example_entity\n @example_entity ||= model&.last\n end", "def from_map_or_db(klass, attributes = nil, criteria_instance_id = nil)\n type = (attributes || {})[\"_type\"]\n id = (attributes || {})[\"_id\"]\n \n klass = type.blank? ? klass : type.camelize.constantize\n result = IdentityMap.get(klass, id)\n result ||= klass.instantiate(attributes, criteria_instance_id)\n end", "def get_entity(name)\n # These are the valid entities and their validators are defined\n if [\"Taluk\",\"Panchayat\",\"Place\"].include?(name)\n return name.constantize, name.downcase+\"_params\", name.downcase\n else\n return nil\n end\n end", "def mapper\n \"#{entity}Mapper\".constantize.new(@root_repo)\n end", "def render_entity_aspects(element, model)\n\n context = {:app => self}\n result = {}\n \n if model = (Plugins::ModelAspect.registered_models.select { |m| m.target_model.to_sym == model.to_sym }).first\n aspects_render=UI::EntityAspectRender.new(context, model.aspects) \n result = aspects_render.render(element, model)\n end \n \n return result\n \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 entry_data_class(entry_type)\n transpiler = self # method-local binding to be available in Class.new block\n\n Class.new(Framework::Definition::EntryData) do\n define_singleton_method :model_name do\n entry_type.to_s.capitalize.singularize\n end\n\n # invoice_fields or contract_fields\n _field_defs = transpiler.ast.field_defs(entry_type)\n _total_value_def = _field_defs.find { |f| f[:field] == 'TotalValue' }\n\n total_value_field _total_value_def[:from]\n\n _field_defs.each do |field_def|\n _name = field_def[:field] || field_def[:from]\n _type = field_def[:type]\n _options = { presence: true }.tap do |options|\n options[:exports_to] = field_def[:from]\n options[:allow_nil] = true if field_def[:optional]\n transpiler.add_lookup_validation(options, field_def, entry_type)\n end.compact\n\n field _name, _type, _options\n end\n end\n end", "def new_from_hash_w_constraints model_hash, constraints\n\n logger.debug(model_hash.inspect)\n #logger.debug(active_scaffold_constraints.inspect)\n #logger.debug(session[:last_data_entry_constraints].inspect)\n\n # overwrite values with constrained values for this record\n unless constraints.nil? || constraints.empty?\n model_hash.merge! constraints\n end\n\n logger.debug(model_hash.inspect)\n\n klass = controller_model_class\n couldnt_find_models = {} # any fields that held id's\n # where, when we looked in the database for them,\n # no matching record was found\n\n model_hash.each do |k,v|\n\n # TODO remove dirty hack\n # is this field an association or regular column?\n # model should be responsible for knowing what field to look for,\n # right now we assume all have a name\n association_class = klass.reflect_on_association(k.to_sym).try :klass\n\n if association_class # if column is an association column\n value_as_id = v.try(:to_i) #is the value an id or a name?\n attempted_find_method = :find_by_name\n if value_as_id != 0 # if it is an id\n attempted_find_method = :find\n v = value_as_id\n end\n\n # TODO catch if we can't find the id\n # thing is we don't, at the moment, have users read in files with id's\n # only give in id's from constraints made in the controllers\n associated_object = association_class.send(attempted_find_method, v)\n\n if associated_object\n model_hash[k] = associated_object\n else\n couldnt_find_models[k]={:association => k,\n :raw_value => model_hash.delete(k), :cleaned_value => v}\n end\n\n end\n end\n record = klass.new model_hash\n def record.association_lookup_errors #use for error handling later\n couldnt_find_models\n end\n if record.respond_to?(:data_response=)\n record.data_response = current_user.current_data_response\n end\n record\n end", "def entity(point_or_name); end", "def entity\n @keys[:entity]\n end", "def entity_map_for(tables)\n return { table_name => self.class.entity_class } if tables.empty?\n\n tables.inject({}) { |m, table|\n if table.is_a? Hash\n m.merge table\n elsif [Symbol, String].include? table.class\n m.merge table => self.class.entity_class_for(table.to_s.capitalize.singularize)\n else\n raise InvalidArgument.new \"invalid argument to `query`\"\n end\n }\n end", "def compose_expression(expression_object, model:, column_name:, column_node:, column_type:)\n expression_object => {expressions:, value: raw_value}\n\n raise \"column_type not supplied (it was #{column_type})\" unless column_type.is_a?(Symbol)\n unless column_node.is_a?(::Arel::Nodes::Node) || column_node.is_a?(::Arel::Attributes::Attribute)\n raise \"column was not an Arel::Nodes::Node, it was a #{column_node.class}\"\n end\n\n last_type = column_type\n query_transforms = []\n\n field = column_node\n\n validate_basic_class(field, raw_value)\n case raw_value\n when String\n ::Arel::Nodes::Quoted.new(raw_value)\n else\n raw_value\n end => value\n\n raise CustomErrors::FilterArgumentError, 'Expressions must contain at least one function' if expressions.blank?\n\n # apply each expression in sequence, building up the query\n expressions.each_with_index do |name, index|\n expression = KNOWN_EXPRESSIONS.fetch(name.to_sym, nil)\n\n raise CustomErrors::FilterArgumentError, \"Expression function `#{name}` does not exist\" if expression.nil?\n\n context = {\n last: index == (expressions.length - 1),\n raw_value:\n }\n\n expression.validate_type(last_type, model, column_name)\n\n field = expression.transform_field(field, model, column_name)\n value = expression.transform_value(value, model, column_name, context)\n\n query_transform = expression.transform_query(model, column_name)\n validate_closure(query_transform, [:query])\n query_transforms << query_transform\n\n last_type = expression.new_type\n end\n\n [query_transforms, field, value]\n end", "def model; eval model_name; end", "def model; eval model_name; end", "def Entity(input, &block)\n result = case input\n when Sipity::Entity\n input\n when URI::GID, GlobalID\n Entity.find_by(proxy_for_global_id: input.to_s)\n when SolrDocument\n Entity(input.to_model)\n when Draper::Decorator\n Entity(input.model)\n when Sipity::Comment\n Entity(input.entity)\n when Valkyrie::Resource\n Entity(Hyrax::GlobalID(input))\n else\n Entity(input.to_global_id) if input.respond_to?(:to_global_id)\n end\n\n handle_conversion(input, result, :to_sipity_entity, &block)\n rescue URI::GID::MissingModelIdError\n Entity(nil)\n end", "def parse_expression(expression)\n constraint = nil\n case expression[0].to_s\n when 'FORALL'\n interpreter = ForallInterpreter.new(expression[0], @objects)\n constraint = interpreter.forall\n when 'CONSTRAINT_EXPRESSION'\n interpreter = ExpressionInterpreter.new(expression[0], @objects)\n constraint = interpreter.expression\n end\n constraint\n end", "def to_ext\n values = Connect::Entry::Base.objects_table.lookup_regexp(@type, @name)\n return values if @selector.nil?\n\n return_value = {}\n values.each do |key, hash|\n return_value.merge!(key => Connect::Selector.run(hash, @selector))\n end\n return_value\n end", "def legal_entity\n {\n address: {\n line1: business_address_line1,\n line2: business_address_line2,\n city: business_address_city,\n state: business_address_state,\n postal_code: business_address_postal_code,\n country: 'FR',\n },\n dob: {\n day: owner_dob_day,\n month: owner_dob_month,\n year: owner_dob_year,\n },\n personal_address: {\n line1: owner_address_line1,\n city: owner_address_city,\n state: owner_address_state,\n postal_code: owner_address_postal_code,\n country: 'FR',\n },\n business_name: business_name,\n # business_url: business_url,\n first_name: owner_first_name,\n last_name: owner_last_name,\n type: business_type,\n additional_owners: additional_owners\n }\n end", "def model(entity, &block)\n key = entity.name.to_sym\n\n config = @registry[key] ||= RailsAdminImport::Config::Model.new(entity)\n config.instance_eval(&block) if block\n config\n end", "def build_entry\n model_scope.new\n end", "def to_db(ex,db)\n begin\n db_val1, hop_val1 = @expr1.to_db(ex,db)\n db_val2, hop_val2 = @expr2.to_db(ex,db)\n if @short\n #short-circuit\n if not db_val1.nil? and not db_val2.nil?\n #all calculated\n\n case op\n when 'and'\n db_cond=db.and(db_val1, db_val2)\n db_cond=db_val1 if db_cond.nil?\n return db_cond, self\n when 'or'\n return db.or(db_val1, db_val2), self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, self\n end\n else\n # sometnig cannot be calculated\n case op\n when 'or'\n # 8( all DB must be searched...\n return nil, self\n when 'and'\n return db_val2, self if(db_val1.nil?)\n return db_val1, self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, nil\n end\n end #if calculated\n elsif op == 'ins'\n # nodeset\n res = nil\n db_res = db.inset db_val1, db_val2\n return db_res, self\n else\n #full evaluation\n #if @pre_conv\n # hop_val1 = hop_val1.to_f\n # hop_val2 = hop_val2.to_f\n #end\n res = nil\n db_res = db.binary(db_val1,db_val2,@op)\n\n #res = res.to_s if @post_conv\n\n return db_res, self\n end\n rescue => e\n raise #e.message+' at line '+@code_line.to_s\n end\n end", "def clone_entity_to_domain(entities)\n entities.each do |entity|\n hash = entity.attributes\n hash[:id] = nil\n hash[:domain_id] = self.id\n entity = Entity.create!(hash)\n entity.create_entity_columns\n end\n end", "def synpred1_Entity\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 30 )\n\n\n # at line 76:6: function_call_statement assignment_type\n @state.following.push( TOKENS_FOLLOWING_function_call_statement_IN_synpred1_Entity_591 )\n function_call_statement\n @state.following.pop\n @state.following.push( TOKENS_FOLLOWING_assignment_type_IN_synpred1_Entity_593 )\n assignment_type\n @state.following.pop\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 30 )\n\n\n end", "def entity\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n\n\n value = nil\n\n\n name = nil\n a = nil\n\n\n begin\n # at line 20:5: ENTITY name= IDENT ( CLOSE | NL (a= class_body )* CLOSE )\n match( ENTITY, TOKENS_FOLLOWING_ENTITY_IN_entity_110 )\n name = match( IDENT, TOKENS_FOLLOWING_IDENT_IN_entity_114 )\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = EntityEval.new(name.text) \n # <-- action\n end\n\n # at line 21:3: ( CLOSE | NL (a= class_body )* CLOSE )\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0 == CLOSE )\n alt_6 = 1\n elsif ( look_6_0 == NL )\n alt_6 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 6, 0 )\n\n end\n case alt_6\n when 1\n # at line 21:5: CLOSE\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_entity_122 )\n\n when 2\n # at line 21:13: NL (a= class_body )* CLOSE\n match( NL, TOKENS_FOLLOWING_NL_IN_entity_126 )\n # at line 21:16: (a= class_body )*\n while true # decision 5\n alt_5 = 2\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0 == IDENT || look_5_0 == INIT || look_5_0 == OPEN || look_5_0.between?( TYPE_BOOL, TYPE_VOID ) || look_5_0 == T__41 )\n alt_5 = 1\n\n end\n case alt_5\n when 1\n # at line 21:17: a= class_body\n @state.following.push( TOKENS_FOLLOWING_class_body_IN_entity_131 )\n a = class_body\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value.add_body(a) \n # <-- action\n end\n\n\n else\n break # out of loop for decision 5\n end\n end # loop for decision 5\n\n match( CLOSE, TOKENS_FOLLOWING_CLOSE_IN_entity_137 )\n\n end\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__, 3 )\n\n\n end\n\n return value\n end", "def preprocess_model\n identifier = attribute_from_model(:id)\n identifier ||= attribute_from_model(:user_id)\n identifier ||= attribute_from_model(:email)\n raise StandardError unless identifier\n end", "def map_entity_relations\n assignments = @db_base.query_assignments\n results = Hash.new()\n assignments.each { |result|\n results[result[\"P_Id\"]] = result[\"T_Id\"]\n }\n return results\n end", "def fetch_expression (exp)\n\n fetch(exp)[0]\n end", "def map_from_row!(row_data)\n model_data = {}\n\n BREAKOUT_COLUMNS.each do |property_name|\n model_data[property_name] = row_data.delete(property_name) if row_data.key?(property_name)\n end\n\n# Merb.logger.info(\"Container Model Data is: #{model_data}\")\n\n model_data\n end", "def parse_entity(entity)\n entity = Yajl::Parser.parse(entity)\n entity.is_a?(Hash) ? HashWithIndifferentAccess.new(entity) : entity\n end", "def get_entity(entity_type)\n # Search for the first occuring node of type entity which is a child node\n # of the metadata element.\n entity = @document.elements[\"//[local-name()='metadata' and namespace-uri()='%s']/%s[1]\" %\n [Model::NS_MMD_1, entity_type]]\n \n unless entity.nil? or entity.is_a? REXML::Text\n create_method = method('create_' + entity.name)\n create_method.call(entity) if create_method\n else\n return nil\n end\n end", "def domain\n if @sym == SYM_DOMAIN_LITERAL\n\t save_text\n\t @addresses.last.domain = get_text\n\t get\n elsif @sym == SYM_ATOM\n obs_domain\n\t @addresses.last.domain = get_text\n\telse\n\t error \"expected start of domain, got #{@sym.inspect}\"\n\tend\n end", "def exists?(domain_expr)\n domain_name = domain_expr.domain_name\n domain_attr = domain_expr.domain_attr\n\n entry = find(domain_name, domain_attr)\n db_expr, values = convert_expr(domain_expr, [], entry)\n db = storage_class_from_entry(entry, :db)\n\n db.exists?([db_expr, *values])\n end", "def fetch (exp)\n\n fei = extract_fei(exp)\n\n [ get_expression_storage[fei], fei ]\n end", "def make_dto(tablename,entity) \n @tablename = camerize(tablename)\n @entity = entity\n make_header\n make_main\n end", "def model_class\n @model_class ||= mapping.to\n end", "def get_model_target exp\n if call? exp\n target = exp.target\n\n if COLLECTION_METHODS.include? exp.method or exp.method.to_s[0, 4] == \"find\"\n models = Set.new @tracker.models.keys\n name = class_name target\n return target if models.include?(name)\n end\n\n return get_model_target(target)\n end\n\n false\n end", "def entity(index)\n get_field_from_relationship(workspace_id(index), @fields_extra[:entity])\n end", "def model_from_document(document)\n\t\tactive_fedora_model = document[\"active_fedora_model_ssi\"]\n\tend", "def parse_mapping(expression)\n expression.scan(/^(.+):(.+)$/).first\nend", "def get_field_deserializers()\n return {\n \"criteria1\" => lambda {|n| @criteria1 = n.get_string_value() },\n \"criteria2\" => lambda {|n| @criteria2 = n.get_string_value() },\n \"oper\" => lambda {|n| @oper = n.get_string_value() },\n }\n end", "def entity\n @entity ||=\n begin\n detected = lam.QueryAssignedLicenses().find{|la| la.entityDisplayName == resource[:entity_id]}\n if detected\n detected.entityId\n else\n resource[:entity_id]\n end\n end\n end", "def find_model_argument(*args)\n # First a valid model object is searched for.\n model = args.find { |arg|\n arg.is_a?(Sketchup::Model) && model.valid?\n }\n # Then we look for objects that might return a valid model object.\n unless model\n entity ||= args.find { |arg|\n arg.respond_to?(:model) &&\n arg.model.is_a?(Sketchup::Model) && arg.model.valid?\n }\n if entity\n model = entity.model\n end\n end\n # We should only return valid objects.\n unless model && model.valid?\n return nil\n end\n model\n end", "def domainify \n #add the $CURRENT_ACCOUNT id to every new record\n before_validation :add_account_id\n #associate it with the $CURRENT_ACCOUNT\n belongs_to :account\n #modify the find method to add a default scope\n def self.find(*args)\n if !$CURRENT_ACCOUNT.nil?\n table = self.to_s.underscore.pluralize\n table = \"person_groups\" if table == \"event_registration_groups\"\n unless $CURRENT_ACCOUNT.is_master? && $ADMIN\n with_scope(:find=>{ :conditions=> [\"#{table}.account_id = ? or #{table}.master = ?\", $CURRENT_ACCOUNT.id, true] }) do # I think the answer is to add a global boolean to everything and \n super(*args) # make the conditions either account_id or global == true && visible == true\n end\n else\n #this is the first effort to remove the scope in the admin section of the master account, orders by account\n with_scope(:find=>{:order=> \"account_id\"}) do\n super(*args)\n end\n end\n else\n super(*args)\n end\n end\n include Domainify::InstanceMethods\n end", "def extract_entity_details entity = nil, entity_type = nil\n if entity\n validate_author(entity)\n return [entity.type, entity.id]\n else\n unless entity_type\n raise ArgumentError.new(\"Must include an author/recipient as an Unloq::Entity instance or include an author_type or recipient_type\")\n end\n return [entity_type, nil]\n end\n end", "def entity!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 39 )\n\n\n\n type = ENTITY\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 216:9: 'entity'\n match( \"entity\" )\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__, 39 )\n\n\n end", "def select_definition_from_model(model)\n validate_model(model)\n select_definition_from_table(model.arel_table)\n end", "def entity_for_transformation(transformation)\n Grape::Transformations.entity_for_transformation(@grape_transformations_target_class, transformation)\n end", "def base \n\n # we're going to create a new entity from the base entities of this\n # entity. We'll then patch up the base of that entity to point at the\n # grandparent bases, so that we can safely iterate up the entity\n # ancestry.\n bases = Helpers.entity_base(@entity)\n b = Helpers.create_entity(base: bases)\n Helpers.get_component!(b, :metadata).base =\n bases.map { |b| Helpers.entity_base(b) }.flatten.compact\n\n begin\n value = Helpers.get_component!(b, @component)[@field]\n\n value.is_a?(Morrow::Function) ?\n value.call(entity: b, component: @component, field: @field,\n level: @level) :\n value\n ensure\n Morrow.em.destroy_entity(b)\n end\n end", "def select_definition_from_model(model)\n validate_model(model)\n select_definition_from_table(model.arel_table)\n end", "def map_cloud_exposure_fields(exposure_type, exposure)\n \n # grab the relevant mapping\n mapping_areas = default_cloud_exposure_field_mapping.deep_merge(\n field_mapping_for_cloud_exposures[exposure_type]) # asset, vuln, vuln_def\n\n # then execute the mapping \n out = {}\n\n ## For each area (asset,vuln,vuln_def) in the mapping\n mapping_areas.each do |area,mapping|\n out[area] = {}\n\n ## For each item in the mapping\n mapping.each do |map_item|\n target = map_item[:target]\n map_action = map_item[:action]\n \n ## Perform the requested mapping action\n\n if map_action == \"proc\" # call a lambda, passing in the whole exposure\n out[area][target] = map_item[:proc].call(exposure)\n elsif map_action == \"copy\" # copy from source data\n out[area][target] = exposure[map_item[:source]]\n elsif map_action == \"data\" # static data \n out[area][target] = map_item[:data]\n end\n\n end\n end\n\n out \n end", "def entity_factory\n @entity_factory\n end", "def entity_factory\n @entity_factory\n end", "def run\n super\n\n entity_name = _get_entity_name\n check_and_create entity_name\n\n # trello strips out periods, so handle dns records differently\n if _get_entity_type_string == \"Domain\"\n check_and_create entity_name.split(\".\").first\n check_and_create entity_name.gsub(\".\",\"\")\n end\n\n end", "def _parse_entity(entity_string)\n entity_type = entity_string.split(\"#\").first\n\n # hack - fixes entities with full type\n unless entity_type =~ /::/\n entity_type = \"Intrigue::Entity::#{entity_type}\"\n end\n\n entity_name = entity_string.split(\"#\").last\n\n entity_hash = {\n \"type\" => entity_type,\n \"name\" => entity_name,\n \"details\" => { \"name\" => entity_name, \"whitelist\" => true }\n }\n\n #puts \"Got entity: #{entity_hash}\" if @debug\n\n entity_hash\n end", "def entity\n @entity ||=\n if entity_class.respond_to? :from_token_request\n entity_class.from_token_request request\n else\n entity_class.find_by username: auth_params[:username]\n end\n end", "def domain_input(_ctx, domain_ctx:, **)\n domain_ctx\n end", "def extract_definition_from_entry_type(entry_type)\n case entry_type\n when 'Problem', 'Problems'\n 'diagnosis'\n when 'Encounter', 'Encounters'\n 'encounter'\n when 'LabResults', 'Results'\n 'laboratory_test'\n when 'Procedure', 'Procedures'\n 'procedure'\n when 'Demographics'\n definition_for_demographic\n when 'Derived'\n 'derived'\n else\n fail \"Unknown data criteria template identifier [#{entry_type}]\"\n end\n end", "def run\n super\n\n # TODO - check for dictionary terms?\n\n #johndoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}.#{@entity.last_name}\"}\n \n # john.doe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}.#{@entity.last_name}\"}\n\n # john_doe \n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}_#{@entity.last_name}\"}\n \n # jdoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name.split(\"\").first}#{@entity.last_name}\"}\n\n # doe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.last_name}\"}\n \n if @entity.middle_name\n #johneffingdoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}#{@entity.middle_name}#{@entity.last_name}\"}\n\n #jedoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name.split(\"\").first}#{@entity.middle_name.split(\"\").first}#{@entity.last_name}\"}\n end\n\n\nend", "def map(type, row_hash, session, prefix = type.name.underscore)\n entity_name = type.name.underscore.to_sym\n resolve_name = \"jet_set__#{type.name.underscore}\".to_sym\n entity_mapping = @mapping.get(entity_name)\n row = Row.new(row_hash, entity_mapping.fields, prefix)\n\n reference_hash = {}\n row.reference_names.each do |reference_name|\n if entity_mapping.references.key? reference_name.to_sym\n reference_id_name = reference_name + '__id'\n unless row_hash[reference_id_name.to_sym].nil?\n type = entity_mapping.references[reference_name.to_sym].type\n reference_hash[reference_name.to_sym] = map(type, row_hash, session, reference_name)\n end\n end\n end\n\n object = @container.resolve(resolve_name, row.attributes_hash.merge(reference_hash))\n entity = @entity_builder.create(object)\n entity.load_attributes!(row.attributes)\n\n reference_hash.each do |key, value|\n entity.set_reference! key.to_s, value\n end\n\n session.attach(entity)\n entity\n end", "def build( domain = nil )\n record_class = self.record_type.constantize\n\n # make a clean copy of ourself\n attrs = self.attributes.dup\n attrs.delete_if { |k,_| !record_class.columns.map(&:name).include?( k ) }\n attrs.delete('id')\n\n # parse each attribute for %ZONE%\n unless domain.nil?\n attrs.keys.each do |k|\n attrs[k] = attrs[k].gsub( '%ZONE%', domain.name ) if attrs[k].is_a?( String )\n end\n end\n\n record_class.new( attrs )\n end", "def entity_map\n return @map if @map\n\n path = File.dirname(__FILE__) + \"/../../support/entities.txt\"\n @map = {}\n File.read(path).split.each do |line|\n elements = line.split(\":\")\n @map[elements.first] = elements.last\n end\n @map\n end", "def convert_if_possible(object_hash)\n if klass = object_hash.is_a?(Hash) && object_hash['data']\n if model_string = object_hash['data']['architect4r_type']\n data = begin\n eval(\"#{model_string}.send(:build_from_database, object_hash)\")\n rescue => ex\n data\n end\n elsif object_hash['self'].match(/node\\/\\d+$/i)\n data = GenericNode.send(:build_from_database, object_hash)\n end\n else\n data = object_hash\n end\n data\n end", "def initialize_fields_entities!\n @entity = SimpleAdmin::Entity.find_by(model_klass_name: model_klass.to_s)\n @entity_fields = @entity.entity_fields.where(presentation: field_presentation)\n end", "def convert_expr(expr, values = [], entry = nil)\n if expr_conjunction?(expr)\n return convert_conjunction(expr, values, entry)\n end\n\n column = qualified_db_column(expr, entry)\n op = expr.op\n arg = case expr.op\n when 'in', 'not in' then '(?)'\n when 'between', 'not between' then '? AND ?'\n else\n '?'\n end\n\n values << expr.value\n [\"#{column} #{op} #{arg}\", values]\n end", "def to_model\n match\n end", "def identity_map(model)\n @identity_maps[model.base_model] ||= IdentityMap.new\n end", "def map_to_model(ot)\n merge(ot)\n self\n end", "def domain_info\n @domain = normalized_email.split('@').last\n domain\n end", "def denormalize(o)\n return o if o[\"denorm\"]\n if @denorm[o[\"Org Code\"]]\n new = o.dup\n new[\"denorm\"] = @denorm[o[\"Org Code\"]]\n return new\n else\n # Not going to deal with older addresses not in 2010\n # for now.\n return o\n end\n matches = o[\"Org Name\"].match(/(.*)\\s-\\s(.*)/)\n district = matches[1]\n school = matches[2]\n label = \n \"DISTRICT: \" + district +\n \", SCHOOL: \" + school\n address = school + ', Massachusetts'\n new = o.dup\n new[\"denorm\"] ||= {}\n new[\"denorm\"][\"district\"] = district\n new[\"denorm\"][\"school\"] = school\n geom = GeoGet.geometry_for(address, label)\n new[\"denorm\"][\"geometry\"] = {\n \"lat\" => geom[\"geometry\"][\"location\"][\"lat\"],\n \"lng\" => geom[\"geometry\"][\"location\"][\"lng\"]\n }\n @denorm[o[\"Org Name\"]] = new[\"denorm\"]\n new\nend", "def domain_of(attr_name)\n attribute = self[attr_name]\n attribute ? attribute.domain : nil\n end", "def local_field_values(original_entity, properties, field, aggregate)\n if !original_entity.group_by || original_entity.group_by == field\n return properties[field]\n end\n\n entity = original_entity.clone\n properties.each do |name, value|\n entity.eq(name, value)\n end\n entity.field_values(field, aggregate)\n end", "def [](primary_key_value)\n entity = odata_entity_set[primary_key_value]\n return entity if entity.nil?\n model = self.new\n model.instance_variable_set(:@odata_entity, entity)\n model\n end", "def apply_map(object, expression)\n\t\tif expression.is_a?(Symbol) || expression.is_a?(String)\n\t\t\tif object.respond_to?(expression)\n\t\t\t\treturn object.send(expression)\n\t\t\tend\n\t\telsif expression.is_a?(Proc) && expression.arity == 1\n\t\t\treturn expression.call(object)\n\t\tend\n\t\traise StandardError, \"Cannot apply criterion expression #{expression.to_s} to #{object.to_s}.\"\n\tend", "def _parse_entity(entity_string)\n entity_type = entity_string.split(@delim).first\n entity_name = entity_string.split(@delim).last\n\n entity_hash = {\n \"type\" => entity_type,\n \"name\" => entity_name,\n \"details\" => { \"name\" => entity_name}\n }\n\n puts \"Got entity: #{entity_hash}\" if @debug\n\n entity_hash\n end", "def to_record(entity)\n end", "def formula\n # Find and initialize our formula\n klass = \"Mongoid::MapReduce::Formula::#{@formula_name.to_s.camelize}\"\n begin\n @formula ||= klass.constantize.new(@fields, @options)\n rescue NameError\n raise \"Could not load formula for #{klass}\"\n end\n end", "def default_attributes\n default_attributes = {}\n query.conditions.each do |tuple|\n operator, property, bind_value = *tuple\n\n next unless operator == :eql &&\n property.kind_of?(DataMapper::Property) &&\n ![ Array, Range ].any? { |k| bind_value.kind_of?(k) }\n !model.key(repository.name).include?(property)\n\n default_attributes[property.name] = bind_value\n end\n default_attributes\n end", "def MAP(match, value)\n Puppet::Pops::Model::Factory.MAP(match, value)\n end", "def set_expression\n @expression = Expression.find params[:id]\n end", "def from_entry(entry)\n dataset = Net::LDAP::Dataset.new\n hash = { }\n entry.each_attribute do |attribute, value|\n next if attribute == :dn\n hash[attribute] = value\n end\n dataset[entry.dn] = hash\n dataset\n end", "def entity_type\n return @entity_type\n end", "def likely_organization\n match_keys = [[:telephone_number], [:fax_number], [:first_line, :second_line, :postal_code]]\n [mailing_address, practice_location_address].each do |address|\n match_keys.each do |mk|\n matcher = address.slice(*mk).reject { |k, v| v.blank? }\n if matcher.size > 0 && org_address = Address.where(matcher.merge(entity_type: 'Organization')).first\n return org_address.entity\n end\n end\n end\n return nil\n end", "def extract_em_request_info(entity_name, is_child)\n \n result = {}\n\n #\n # analize request.path_info to retrieve information\n #\n parts = if is_child\n request.path_info.match(/\\/(?<entity>\\w+)\\/(?<parent_id>\\w+)(\\/page\\/(?<page>\\d+))?(\\/(?<action>new|edit))?(\\/(?<id>\\w+))?/)\n else\n request.path_info.match(/\\/(?<entity>\\w+)(\\/page\\/(?<page>\\d+))?(\\/(?<action>new|edit))?(\\/(?<id>\\w+))?/)\n end \n\n if parts\n unless action = parts['action']\n action = if parts['id'].nil?\n \t 'list'\n else\n \t 'view'\n \t end\n end \n info = {}\n info.store(:em_action, action)\n info.store(:em_parent_id, parts['parent_id']) if parts.names.include?('parent_id')\n info.store(:em_id, parts['id']) \n info.store(:em_page, parts['page']) \n result.store(:info, info)\n end\n \n #\n # Get the request query string params\n #\n if params=extract_request_query_string\n result.merge!(params)\n end\n\n return result\n\n end", "def make_expression_attribute_values(event)\n\t\tattr_values = make_hoh\n\n\t\tevent.each do |k,v| \n\t\t\tif k == \"start_time\"\n\t\t\t\tputs \"Found start time: methods: #{v.methods}, methods contain strftime? #{v.methods.include?(:strftime)}\"\n\t\t\tend\n\t\t\tattr_values[k][make_expression_key(k,)] = v \n\t\tend\n\t\treturn attr_values\n\tend", "def map_nested_models\n end", "def map_nested_models\n end", "def model_to_registration_mapping\n #{:model => 'server'}\n {:name => 'fullname', :email => 'email'}\n end", "def lookup_entry\n\t\tif entryhash = super\n\t\t\tself.apply_applicable_mixins( self.dn, entryhash )\n\t\tend\n\n\t\treturn entryhash\n\tend", "def type\n entity_type.name\n end", "def entity_class\n self.class.entity_class\n end", "def parse_custom(definition, field, value)\n validate_definition_instance(definition)\n validate_symbol(field)\n fail Clearly::Query::QueryArgumentError.new('field name must contain a dot (.)') unless field.to_s.include?('.')\n\n validate_not_blank(value)\n validate_hash(value)\n\n # extract table and field\n dot_index = field.to_s.index('.')\n\n other_table = field[0, dot_index].to_sym\n other_model = other_table.to_s.classify.constantize\n other_field = field[(dot_index + 1)..field.length].to_sym\n\n table_names = definition.associations_flat.map { |a| a[:join].table_name.to_sym }\n validate_name(other_table, table_names)\n\n models = definition.associations_flat.map { |a| a[:join] }\n validate_association(other_model, models)\n\n other_definition = select_definition_from_model(other_model)\n\n conditions = parse_standard_field(other_definition, other_field, value)\n subquery(definition, other_definition, conditions)\n end", "def query_def; @hit.mrna.definition; end", "def details(entity)\n details_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end", "def mapping\n if @mapping.nil?\n mapping_class = if self.association && self.association.macro == :one\n self.parent.dbi.klass\n else\n dbi.klass\n end\n @mapping = Lolita::Mapping.new(:\"#{mapping_class.to_s.downcase.pluralize}\") || false\n end\n @mapping\n end", "def get_related(*entities)\n entities.flatten!\n # If entities have no dictionaries, check if a related selected entity in a\n # different mode has dictionaries.\n if entities.all? {|e| e.attribute_dictionaries.nil?}\n model = (entities.empty? || entities.first.is_a?(Sketchup::Model)) ? Sketchup.active_model : entities.first.model\n alternative = nil\n # Selection\n alternative = model.selection.find {|e| e.attribute_dictionaries}\n # Definitions\n alternative = model.selection.to_a.select {|e| e.respond_to?(:definition)}.map {|e| e.definition}.find {|e| e.attribute_dictionaries} unless alternative\n # Materials\n alternative = model.materials.current if model.materials.current && model.materials.current.attribute_dictionaries unless alternative\n # Layers\n alternative = model.active_layer if model.active_layer.attribute_dictionaries unless alternative\n # Pages\n alternative = model.pages.selected_page if model.pages.selected_page && model.pages.selected_page.attribute_dictionaries unless alternative\n # Styles\n alternative = model.styles.selected_style if model.styles.selected_style && model.styles.selected_style.attribute_dictionaries unless alternative\n if alternative\n type = alternative.typename\n return {\n :title => TRANSLATE['currently selected %0', TRANSLATE[type]],\n :id => alternative.object_id\n }\n end\n end\n # If all entities are edges and part of same curve.\n if entities_of_curve?(*entities)\n curve = entities.first.curve\n type = curve.typename\n type = 'Circle' if curve.end_angle.to_l == 360.degrees\n return {\n :title => TRANSLATE[type],\n :id => curve.object_id\n }\n end\n # If entities are component instances of same definition.\n if entities_of_same_component_definition?(*entities)\n definition = entities.first.definition\n type = definition.typename\n return {\n :title => TRANSLATE[type],\n :id => definition.object_id\n }\n end\n end" ]
[ "0.5643843", "0.52450395", "0.4989761", "0.49816296", "0.47330636", "0.47177687", "0.46242404", "0.46222666", "0.45947158", "0.458505", "0.45841733", "0.4520969", "0.4491989", "0.44900355", "0.4474696", "0.44639853", "0.44362858", "0.44317403", "0.44317403", "0.44098812", "0.439909", "0.4397969", "0.43843043", "0.436311", "0.4351443", "0.43500268", "0.4346509", "0.43273544", "0.43174103", "0.43127313", "0.42998317", "0.42973483", "0.42751688", "0.4270413", "0.42672554", "0.42646316", "0.42595902", "0.4245051", "0.4231015", "0.42271274", "0.42218295", "0.42128205", "0.42090368", "0.42005837", "0.41904688", "0.41901746", "0.4182704", "0.41791317", "0.4162965", "0.41596302", "0.41547403", "0.41544685", "0.4150412", "0.41437188", "0.41345572", "0.41330388", "0.41330388", "0.4131698", "0.41281927", "0.41252667", "0.41213343", "0.41197443", "0.4114126", "0.4112097", "0.41099826", "0.41091666", "0.41065848", "0.41052076", "0.410422", "0.41012675", "0.40986565", "0.40952748", "0.4095016", "0.40935415", "0.40758103", "0.40728128", "0.40726933", "0.40652433", "0.4062697", "0.40591317", "0.4053896", "0.4052111", "0.40421835", "0.40404126", "0.4033493", "0.40330687", "0.40323406", "0.4021431", "0.40140933", "0.4013897", "0.4013897", "0.40133116", "0.40120286", "0.4002254", "0.4000283", "0.3993986", "0.3980936", "0.39620787", "0.39584485", "0.3957758" ]
0.4150493
52
Converts an entity expression into a valid active record expresion expression.
def convert_expr(expr, values = [], entry = nil) if expr_conjunction?(expr) return convert_conjunction(expr, values, entry) end column = qualified_db_column(expr, entry) op = expr.op arg = case expr.op when 'in', 'not in' then '(?)' when 'between', 'not between' then '? AND ?' else '?' end values << expr.value ["#{column} #{op} #{arg}", values] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_expression(expr); end", "def compose_expression(expression_object, model:, column_name:, column_node:, column_type:)\n expression_object => {expressions:, value: raw_value}\n\n raise \"column_type not supplied (it was #{column_type})\" unless column_type.is_a?(Symbol)\n unless column_node.is_a?(::Arel::Nodes::Node) || column_node.is_a?(::Arel::Attributes::Attribute)\n raise \"column was not an Arel::Nodes::Node, it was a #{column_node.class}\"\n end\n\n last_type = column_type\n query_transforms = []\n\n field = column_node\n\n validate_basic_class(field, raw_value)\n case raw_value\n when String\n ::Arel::Nodes::Quoted.new(raw_value)\n else\n raw_value\n end => value\n\n raise CustomErrors::FilterArgumentError, 'Expressions must contain at least one function' if expressions.blank?\n\n # apply each expression in sequence, building up the query\n expressions.each_with_index do |name, index|\n expression = KNOWN_EXPRESSIONS.fetch(name.to_sym, nil)\n\n raise CustomErrors::FilterArgumentError, \"Expression function `#{name}` does not exist\" if expression.nil?\n\n context = {\n last: index == (expressions.length - 1),\n raw_value:\n }\n\n expression.validate_type(last_type, model, column_name)\n\n field = expression.transform_field(field, model, column_name)\n value = expression.transform_value(value, model, column_name, context)\n\n query_transform = expression.transform_query(model, column_name)\n validate_closure(query_transform, [:query])\n query_transforms << query_transform\n\n last_type = expression.new_type\n end\n\n [query_transforms, field, value]\n end", "def eval_expression\n eval(expression, binding)\n end", "def filter_expr(expr)\n case expr\n when Hash\n SQL::BooleanExpression.from_value_pairs(expr)\n when Array\n if String === expr[0]\n filter_expr(expr.shift.gsub(QUESTION_MARK){literal(expr.shift)}.lit)\n else\n SQL::BooleanExpression.from_value_pairs(expr)\n end\n when Proc\n expr.to_sql(self).lit\n when SQL::NumericExpression, SQL::StringExpression\n raise(Error, \"Invalid SQL Expression type: #{expr.inspect}\") \n when Symbol, SQL::Expression\n expr\n when String\n \"(#{expr})\".lit\n else\n raise(Error, 'Invalid filter argument')\n end\n end", "def evaluate_expression(expression, eval_string = '')\n if expression.is_a? Yarpler::Models::Expression\n eval_string << evaluate_expression_inner(expression).to_s\n elsif expression.is_a? Yarpler::Models::Field\n obj = @problem.objects[expression.variable].get_value(expression.attribute)\n if (obj.is_a? Yarpler::Models::Relation)\n obj = @problem.objects[obj.to.first.to_s].id\n end\n eval_string << obj.to_s\n elsif expression.is_a? Yarpler::Models::Literal\n eval_string << expression.value.to_s\n else\n fail Yarpler::Exceptions::InvalidWhereExpression.new, 'Where Expression is illegal'\n end\n eval_string\n end", "def expression\n super\n end", "def expression_statement\n expr = expression\n consume(:semicolon, \"Expect ';' after expression.\")\n return Ringo::Expression.new(expr)\n end", "def expression; end", "def to_s\n @expression.to_s\n end", "def expression_to_action(e)\n if atom? e\n atom_to_action e\n else\n list_to_action e\n end\n end", "def to_ruby\n @expression.respond_to?(:to_ruby) ? @expression.to_ruby : @expression\n end", "def to_nfa\n exec(:expression)\n end", "def eval(expression, env = Environment.new)\n env = Trxl::Environment.new(env) if env.is_a?(Hash)\n ast = parse(expression)\n ast.eval(env)\n end", "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n\n value = nil\n\n\n type = nil\n a = nil\n b = nil\n\n\n begin\n # at line 185:5: a= relation (type= ( '&&' | '||' ) b= expression )?\n @state.following.push( TOKENS_FOLLOWING_relation_IN_expression_1389 )\n a = relation\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = a \n # <-- action\n end\n\n # at line 186:3: (type= ( '&&' | '||' ) b= expression )?\n alt_45 = 2\n look_45_0 = @input.peek( 1 )\n\n if ( look_45_0 == T__33 || look_45_0 == T__54 )\n alt_45 = 1\n end\n case alt_45\n when 1\n # at line 186:6: type= ( '&&' | '||' ) b= expression\n type = @input.look\n\n if @input.peek(1) == T__33 || @input.peek(1) == T__54\n @input.consume\n @state.error_recovery = false\n\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n mse = MismatchedSet( nil )\n raise mse\n\n end\n\n\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1410 )\n b = expression\n @state.following.pop\n\n # syntactic predicate action gate test\n if @state.backtracking == 0\n # --> action\n value = DoubleOperandExpressionEval.new(type.text, a, b) \n # <-- action\n end\n\n\n end\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__, 29 )\n\n\n end\n\n return value\n end", "def parse(expr)\n eval(\"[#{expr}]\")\n end", "def expr \n\n\t$cst.add_branch(\"Expr\")\n\t\n\tcase scout_token\n\twhen \"T_DIGIT\"\n\t\tintexpr\n\twhen \"T_QUOTE\"\n\t\tstringexpr\n\twhen \"T_LPAREN\", \"T_BOOLEAN\"\n\t\tboolexpr\n\twhen \"T_ID\"\n\t\tid\n\telse\n\t\traise FaultyTokenError.new(\"T_DIGIT, T_QUOTE, T_LPAREN, or T_ID\", $tokens[$index])\n\tend\n\t\n\t$cst.ascend\n\t\nend", "def set_expression\n @expression = Expression.find params[:id]\n end", "def expression_from(node)\n case node\n when Parser::AST::Node\n children_expression = node.children.map(&method(:expression_from)).join(' ')\n \"(#{node.type}#{' ' + children_expression if node.children.any?})\"\n when nil, 'nil'\n 'nil'\n when Symbol, String, Numeric\n '_'\n end\n end", "def to_expr\n return self.return_value\n end", "def parse_expression(expression)\n constraint = nil\n case expression[0].to_s\n when 'FORALL'\n interpreter = ForallInterpreter.new(expression[0], @objects)\n constraint = interpreter.forall\n when 'CONSTRAINT_EXPRESSION'\n interpreter = ExpressionInterpreter.new(expression[0], @objects)\n constraint = interpreter.expression\n end\n constraint\n end", "def evaluate(expr)\n @api.function_for_object_method(self, :eval).call(@session, expr)\n end", "def simple_eval(expression)\n parsed_expression = @engine.parse(expression, false)\n notify_expression_listeners(expression)\n @engine.eval(parsed_expression, nil, false)\n end", "def eval_and_convert(expression)\n notify_expression_listeners(expression)\n success, value = convert_to_ruby_object(@engine.parseAndEval(expression))\n raise RriException.new(\"Failed to convert R object to ruby object for: #{value}\") unless success\n value\n end", "def expression(expression_string)\n state_depth_must_be(States::ATTRIBUTE)\n raise 'expression already defined' if @current_attribute.expression\n @current_attribute.expression = expression_string\n end", "def expression\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_in( __method__, 1 )\r\n result = nil\r\n a = nil\r\n b = nil\r\n\r\n begin\r\n # at line 9:4: a= NUMBER '+' b= NUMBER\r\n a = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_28 )\r\n match( T__6, TOKENS_FOLLOWING_T__6_IN_expression_30 )\r\n b = match( NUMBER, TOKENS_FOLLOWING_NUMBER_IN_expression_34 )\r\n # --> action\r\n result = a.text.to_i + b.text.to_i \r\n # <-- action\r\n\r\n rescue ANTLR3::Error::RecognitionError => re\r\n report_error(re)\r\n recover(re)\r\n\r\n ensure\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_out( __method__, 1 )\r\n\r\n end\r\n \r\n return result\r\n end", "def expression(operator, val)\n val = (val.is_a?(String) || val.is_a?(Symbol)) ? \"'#{val}'\" : val\n \"#{@attr} #{operator} #{val}\"\n end", "def set_expression(opts)\n opts = check_params(opts,[:expressions])\n super(opts)\n end", "def to_expr\n if @object.kind_of?(Linkage::Data)\n @object.to_expr\n else\n @object\n end\n end", "def build_expression_from_rule(squeel, rule)\n if rule.conditions.empty?\n [rule.base_behavior ? ALWAYS_TRUE : ALWAYS_FALSE, []]\n else\n comparator = rule.base_behavior ? :== : :!=\n CanCanCan::Squeel::ExpressionBuilder.build(squeel, @model_class, comparator, rule.conditions)\n end\n end", "def to_string(expression)\n\t\t\tif expression.is_a? Array\n\t\t\t\texpression.map { |exp| to_string(exp) }\n\t\t\t\treturn \"(\" + expression.join(\" \") + \")\"\n\t\t\telse\n\t\t\t\treturn expression.to_s\n\t\t\tend\n\t\tend", "def aliased_expression_sql(ae)\n \"#{literal(ae.expression)} AS #{quote_identifier(ae.aliaz)}\"\n end", "def evaluate(expr)\n TupleExpression.coerce(expr).evaluate(self)\n end", "def apply_expression(scope, expression)\n ast = calculator.ast(expression)\n apply_ast(scope, ast)\n end", "def convert_from(expression_type)\n expression_type.auto_conversion_to(@expression_type)\n end", "def _expression\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_assignment)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_value)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_expression unless _tmp\n return _tmp\n end", "def eval_expression\n @input = eval(@input).to_s\n @output.text = @input\n end", "def to_regexp\n case expr.first\n when :hex\n Regexp.new(translate_codepoints(expr[1]))\n when :istr\n /#{expr.last}/ui\n when :range\n Regexp.new(\"[#{translate_codepoints(expr[1])}]\")\n else\n raise \"Can't turn #{expr.inspect} into a regexp\"\n end\n end", "def get_relational(expr)\n\t\t[\"==\", \"!=\", \">\", \"<\", \">=\", \"<=\"].each do |ope|\n\t\t\tif expr.scan(ope).length == 1\n\t\t\t\treturn ope\n\t\t\tend\n\t\tend\n\tend", "def parse_expression_statement\n expr = parse_expression\n stmt = node(:expression_statement, expression: expr)\n stmt = expect_statement_modifier(stmt) if statement_modifier?\n expect_terminator # NOTE: maybe it should be dropped?\n stmt\n end", "def sql_of( expr, dataset)\n dataset.send :literal_expression_append, rv=String.new, expr\n rv\n end", "def expression\n Bumbleworks::Expression.from_fei(fei)\n end", "def parsed_expression\n return @parsed_expression\n end", "def single_quoted_expression()\n\n\n\n # 285:7: '\\\\'' ( IDENTIFIER | NUMBER | expression_operator | quoted_operator | '\\\"' )* '\\\\''\n match(:SINGLE_QUOTES)\n # 285:12: ( IDENTIFIER | NUMBER | expression_operator | quoted_operator | '\\\"' )*\n while true\n alt41 = 6\n # ()* loopback of 285:12: ( IDENTIFIER | NUMBER | expression_operator | quoted_operator | '\\\"' )*\n case look_ahead(1)\n when :IDENTIFIER\n alt41 = 1\n when :NUMBER\n alt41 = 2\n when :LEFT_ANGULAR_BRACKET,:RIGHT_ANGULAR_BRACKET,:ECOMMERCIAL,:EQUAL,:LEFT_SQUARE_BRACKET,:RIGHT_SQUARE_BRACKET,:QUESTION_MARK,:PLUS,:MINUS,:TIMES,:MODULUS,:COLON,:PIPE,:WEDGE,:EXCLATION_MARK,:SLASH\n alt41 = 3\n when :SEMICOLON,:COMMA,:LEFT_BRACE,:RIGHT_BRACE,:LEFT_PARENTESIS,:RIGHT_PARENTESIS,:DOT,:BACKSLASH,:DOLLAR,:AT,:TILDE,:HASH,:T59,:T60\n alt41 = 4\n when :DOUBLE_QUOTES\n alt41 = 5\n end\n case alt41\n when 1\n # 285:13: IDENTIFIER\n match(:IDENTIFIER)\n when 2\n # 285:26: NUMBER\n match(:NUMBER)\n when 3\n # 285:35: expression_operator\n expression_operator()\n\n when 4\n # 285:57: quoted_operator\n quoted_operator()\n\n when 5\n # 285:75: '\\\"'\n match(:DOUBLE_QUOTES)\n else\n break\n end\n end\n match(:SINGLE_QUOTES)\n\n\n\n end", "def remove_expression(expression)\n \n end", "def parsed_expression=(value)\n @parsed_expression = value\n end", "def eval_expression\n if @input.to_i.zero?\n @input = eval(@input).to_s\n else\n @input = eval(@input).to_f.to_s\n end\n @output.text = @input\n end", "def initialize(expr = nil)\n @expression = expr\n end", "def eval_expression(expression)\n if expression.count(\"a-zA-Z\") > 0\n result = \"Incorrect expression or Number\"\n else\n expression = expression.gsub('/', '*1.0/') if expression.include?(\"/\")\n result = eval(expression).round(2)\n end\n result\n end", "def expr\n or_expr\n end", "def eval_expression\n @input = eval(@input).to_s\n @output.text = @input\n end", "def eval_expression\n @input = eval(@input).to_s\n @output.text = @input\n end", "def expression=(_arg0); end", "def expression\n lterm = term\n loop do\n if accept(:T_PLUS)\n lterm = Addition.new(lterm, term)\n elsif accept(:T_MINUS)\n lterm = Subtraction.new(lterm, term)\n else\n break\n end\n end\n lterm\n end", "def converts_from?(expression_type)\n expression_type.auto_converts_to?(@expression_type)\n end", "def expression(options=[])\n evaluator = Bun::Expression.new(options)\n evaluator.data = self\n evaluator\n end", "def fetch_expression (exp)\n\n fetch(exp)[0]\n end", "def to_s\n template = indirect? ? \"[%s]\" : \"%s\"\n return template % expr_to_s\n end", "def compile_expression\n write_tag '<expression>'\n compile_term\n compile_term while match('+', '-', '<', '/', '=', '>', '&', '|', '*')\n write_tag '</expression>'\n end", "def smart_quote_entity(el); end", "def evaluate_expression(activity, line, fread)\n eval = []\n activity.each do |token|\n eval = set_evaluation(token, eval, line, fread) unless eval.nil? || !eval\n end\n check_for_eval_errors(eval, fread, line)\n end", "def expr(matcher, &block)\n @expression_parsers[matcher] = block\n end", "def expression\n return additive_expression\n end", "def eval_expression\n @evaluated_expression =\n ConlangWordGenerator::run_expression(@full_expression, @bindings)\n end", "def query_string(expr)\n new(dataset.query_string(expr))\n end", "def or_exp(expression)\n @use_disjunction = true\n @disjunction = @builder.and(@disjunction,expression)\n\n self\n end", "def expression\n comma\n end", "def with_merged_expression\n if expression?\n e = expression\n CaseExpression.new(conditions.map{|c, r| [::Sequel::SQL::BooleanExpression.new(:'=', e, c), r]}, default)\n else\n self\n end\n end", "def valid?\n @expression.valid?\n end", "def expr_to_s\n buf = ''\n each_term do |term|\n if term[:operator]\n buf << term[:operator]\n end\n buf << term[:token]\n end\n buf\n end", "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n __COMPARITIONOPERATORS10__ = nil\n\n begin\n # at line 705:5: exp ( COMPARITIONOPERATORS exp )?\n @state.following.push( TOKENS_FOLLOWING_exp_IN_expression_1070 )\n exp\n @state.following.pop\n # at line 705:9: ( COMPARITIONOPERATORS exp )?\n alt_26 = 2\n look_26_0 = @input.peek( 1 )\n\n if ( look_26_0 == COMPARITIONOPERATORS )\n alt_26 = 1\n end\n case alt_26\n when 1\n # at line 705:10: COMPARITIONOPERATORS exp\n __COMPARITIONOPERATORS10__ = match( COMPARITIONOPERATORS, TOKENS_FOLLOWING_COMPARITIONOPERATORS_IN_expression_1073 )\n # --> action\n #Regla 8\n \t @stack_operators.push(__COMPARITIONOPERATORS10__.text)\n \t \n # <-- action\n @state.following.push( TOKENS_FOLLOWING_exp_IN_expression_1087 )\n exp\n @state.following.pop\n # --> action\n #Regla 9\n \t\t operator = @stack_operators.pop\n \t\t operand_b = @stack_operands.pop\n \t\t operand_a = @stack_operands.pop\n \t\t result = get_avail\n \t\t generate(operator, operand_a, operand_b, result)\n \t\t free_avail(operand_a)\n \t\t free_avail(operand_b)\n \t\t free_avail_const(operand_a)\n \t\t free_avail_const(operand_b)\n \t\t @stack_operands.push(result)\n \t\t @stack_types.push(resulting_type(@stack_types.pop, @stack_types.pop, operator))\n \t \n # <-- action\n\n end\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__, 23 )\n\n end\n \n return \n end", "def evaluate(expression)\n @simpleParser.parse expression\n end", "def expr\n space\n\n if accept(\"(\")\n self.unclosed_parens += 1\n a = or_clause\n expect(\")\")\n self.unclosed_parens -= 1\n a\n else\n term\n end\n end", "def evalExpression(expr)\n\texprs = expr.get_expr\n\tif expr.class == EXPR_VALUE\n\t\tsymbol = exprs.get_symbol\n\t\tidentif = exprs.get_value\n\t\tif symbol == :IDENTIFIER\n\t\t\tsymbol = $tables.lookup(identif)\n\t\t\tif symbol[1] != nil\n\t\t\t\treturn symbol\n\t\t\telse\n\t\t\t\tputs \"ERROR: variable `#{identif}` no inicializada\"\n\t\t\t\t$error = true\n\t\t\t\treturn [:UNKNOW,nil]\n\t\t\tend\n\t\tend\n\t\treturn [symbol,identif] \n\n\t# Caso que sea una expresion binaria\n\telsif expr.class == EXPR_BIN\n\t\tarit = expr.get_arit\n\t\tsymbol1 = evalExpression(exprs[0])\n\t\tsymbol2 = evalExpression(exprs[1])\n\t\t# Chequea todos los tipos de expresiones binarias aritmeticas\n\t\t# Para cada caso, asegura que sean correctas\n\t\tif !$error\n\t\t\tcase arit\n\t\t\twhen :PLUS , :MINUS, :DIVISION, :MULTIPLY, :PERCENT\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\tif !$error\t\n\t\t\t\t\tif expr_eval > 2147483647 || expr_eval < -2147483647\n\t\t\t\t\t\tputs \"ERROR: overflow numero de 32 bits excedido\"\n\t\t\t\t\t\t$error = true\n\t\t\t\t\t\treturn [:UNKNOW,nil]\n\t\t\t\t\telse\n\t\t\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen :AND, :OR\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :AMPERSAND, :VIRGUILE \n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\tif expr_eval == nil\n\t\t\t\t\tif arit == :AMPERSAND \n\t\t\t\t\t\tputs \"ERROR: concatenacion vertical incorrecta tamano incompatible\"\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"ERROR: concatenacion horizontal incorrecta tamano incompatible\"\n\t\t\t\t\tend\n\t\t\t\t\t$error = true\n\t\t\t\t\treturn [:UNKNOW,nil]\n\t\t\t\tend\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :LESS, :LESS_EQUAL, :MORE, :MORE_EQUAL\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [:BOOLEAN,expr_eval]\n\t\t\twhen :EQUAL, :INEQUAL\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1],symbol2[1])\n\t\t\t\treturn [:BOOLEAN,expr_eval]\n\t\t\tend\n\t\tend\n\t\t# Caso que sea una expresion unaria\n\telsif expr.class == EXPR_UNARIA\n\t\tarit = expr.get_arit\n\t\tsymbol1 = evalExpression(exprs)\n\t\t# evalua las expresiones unarias aritmeticas\n\t\t# Para cada caso, chequea que sean correctas\n\t\tif !$error \n\t\t\tcase arit\n\t\t\twhen :MINUS_UNARY\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :DOLLAR, :APOSTROPHE \n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\twhen :NOT\n\t\t\t\texpr_eval = expr.get_eval(arit,symbol1[1])\n\t\t\t\treturn [symbol1[0],expr_eval]\n\t\t\tend\n\t\tend\n\t# En caso de conseguir expresiones parentizadas, evalua la expresion\n\telsif expr.class == EXPR_PARENTHESIS\n\t\treturn evalExpression(exprs)\n\tend\nend", "def expression(expression)\n if expression.function_sql == \"DISTINCT\"\n \"#{expression.function_sql} #{expression.attribute.to_sql(self)}\" +\n (expression.alias ? \" AS #{quote_column_name(expression.alias)}\" : '')\n else\n \"#{expression.function_sql}(#{expression.attribute.to_sql(self)})\" +\n (expression.alias ? \" AS #{quote_column_name(expression.alias)}\" : \"\")\n end\n end", "def to_s(ds)\n ds.aliased_expression_sql(self)\n end", "def initialize(expr)\n @expr = expr\n super()\n end", "def initialize(expr)\r\n @expr = expr\r\n end", "def resolve(_expression)\n true\n end", "def eval(expr, *rest) end", "def transforming_body_expr; end", "def execute_expression\n valid_input\n to_roman(to_num(@operand_one).send(@operator, to_num(@operand_two)))\n end", "def expression_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n return_value = ExpressionStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n expression_list37 = nil\n statement_end38 = nil\n\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 315:5: expression_list statement_end\n @state.following.push( TOKENS_FOLLOWING_expression_list_IN_expression_statement_2099 )\n expression_list37 = expression_list\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, expression_list37.tree )\n end\n @state.following.push( TOKENS_FOLLOWING_statement_end_IN_expression_statement_2101 )\n statement_end38 = statement_end\n @state.following.pop\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end\n \n return return_value\n end", "def expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n return_value = ExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n char_literal106 = nil\n char_literal110 = nil\n string_literal113 = nil\n __SLASH_ASGN116__ = nil\n __MOD_ASGN119__ = nil\n string_literal122 = nil\n string_literal125 = nil\n string_literal128 = nil\n string_literal131 = nil\n string_literal134 = nil\n string_literal137 = nil\n string_literal140 = nil\n string_literal143 = nil\n string_literal146 = nil\n char_literal149 = nil\n string_literal152 = nil\n char_literal155 = nil\n char_literal158 = nil\n string_literal161 = nil\n string_literal164 = nil\n string_literal167 = nil\n char_literal170 = nil\n char_literal173 = nil\n __MOD176__ = nil\n __SLASH179__ = nil\n char_literal182 = nil\n string_literal185 = nil\n string_literal188 = nil\n string_literal191 = nil\n string_literal194 = nil\n string_literal197 = nil\n string_literal200 = nil\n char_literal203 = nil\n char_literal206 = nil\n string_literal209 = nil\n string_literal212 = nil\n string_literal215 = nil\n string_literal217 = nil\n string_literal219 = nil\n string_literal221 = nil\n string_literal223 = nil\n __UPLUS225__ = nil\n __UMINUS227__ = nil\n char_literal229 = nil\n char_literal231 = nil\n __POST_INCR233__ = nil\n __POST_DECR235__ = nil\n __AREF237__ = nil\n char_literal240 = nil\n __CALL243__ = nil\n __ITER246__ = nil\n string_literal249 = nil\n expression107 = nil\n expression108 = nil\n expression109 = nil\n expression111 = nil\n expression112 = nil\n expression114 = nil\n expression115 = nil\n expression117 = nil\n expression118 = nil\n expression120 = nil\n expression121 = nil\n expression123 = nil\n expression124 = nil\n expression126 = nil\n expression127 = nil\n expression129 = nil\n expression130 = nil\n expression132 = nil\n expression133 = nil\n expression135 = nil\n expression136 = nil\n expression138 = nil\n expression139 = nil\n expression141 = nil\n expression142 = nil\n expression144 = nil\n expression145 = nil\n expression147 = nil\n expression148 = nil\n expression150 = nil\n expression151 = nil\n expression153 = nil\n expression154 = nil\n expression156 = nil\n expression157 = nil\n expression159 = nil\n expression160 = nil\n expression162 = nil\n expression163 = nil\n expression165 = nil\n expression166 = nil\n expression168 = nil\n expression169 = nil\n expression171 = nil\n expression172 = nil\n expression174 = nil\n expression175 = nil\n expression177 = nil\n expression178 = nil\n expression180 = nil\n expression181 = nil\n expression183 = nil\n expression184 = nil\n expression186 = nil\n expression187 = nil\n expression189 = nil\n expression190 = nil\n expression192 = nil\n expression193 = nil\n expression195 = nil\n expression196 = nil\n expression198 = nil\n expression199 = nil\n expression201 = nil\n expression202 = nil\n expression204 = nil\n expression205 = nil\n expression207 = nil\n expression208 = nil\n expression210 = nil\n expression211 = nil\n expression213 = nil\n expression214 = nil\n expression216 = nil\n expression218 = nil\n expression220 = nil\n expression222 = nil\n expression224 = nil\n expression226 = nil\n expression228 = nil\n expression230 = nil\n expression232 = nil\n expression234 = nil\n expression236 = nil\n expression238 = nil\n expression239 = nil\n expression241 = nil\n property_name242 = nil\n expression244 = nil\n arguments245 = nil\n parameters247 = nil\n block248 = nil\n expression250 = nil\n arguments251 = nil\n literal252 = nil\n\n tree_for_char_literal106 = nil\n tree_for_char_literal110 = nil\n tree_for_string_literal113 = nil\n tree_for_SLASH_ASGN116 = nil\n tree_for_MOD_ASGN119 = nil\n tree_for_string_literal122 = nil\n tree_for_string_literal125 = nil\n tree_for_string_literal128 = nil\n tree_for_string_literal131 = nil\n tree_for_string_literal134 = nil\n tree_for_string_literal137 = nil\n tree_for_string_literal140 = nil\n tree_for_string_literal143 = nil\n tree_for_string_literal146 = nil\n tree_for_char_literal149 = nil\n tree_for_string_literal152 = nil\n tree_for_char_literal155 = nil\n tree_for_char_literal158 = nil\n tree_for_string_literal161 = nil\n tree_for_string_literal164 = nil\n tree_for_string_literal167 = nil\n tree_for_char_literal170 = nil\n tree_for_char_literal173 = nil\n tree_for_MOD176 = nil\n tree_for_SLASH179 = nil\n tree_for_char_literal182 = nil\n tree_for_string_literal185 = nil\n tree_for_string_literal188 = nil\n tree_for_string_literal191 = nil\n tree_for_string_literal194 = nil\n tree_for_string_literal197 = nil\n tree_for_string_literal200 = nil\n tree_for_char_literal203 = nil\n tree_for_char_literal206 = nil\n tree_for_string_literal209 = nil\n tree_for_string_literal212 = nil\n tree_for_string_literal215 = nil\n tree_for_string_literal217 = nil\n tree_for_string_literal219 = nil\n tree_for_string_literal221 = nil\n tree_for_string_literal223 = nil\n tree_for_UPLUS225 = nil\n tree_for_UMINUS227 = nil\n tree_for_char_literal229 = nil\n tree_for_char_literal231 = nil\n tree_for_POST_INCR233 = nil\n tree_for_POST_DECR235 = nil\n tree_for_AREF237 = nil\n tree_for_char_literal240 = nil\n tree_for_CALL243 = nil\n tree_for_ITER246 = nil\n tree_for_string_literal249 = nil\n\n begin\n # at line 150:3: ( ^( '?' expression expression expression ) | ^( '=' expression expression ) | ^( '*=' expression expression ) | ^( SLASH_ASGN expression expression ) | ^( MOD_ASGN expression expression ) | ^( '+=' expression expression ) | ^( '-=' expression expression ) | ^( '<<=' expression expression ) | ^( '>>=' expression expression ) | ^( '>>>=' expression expression ) | ^( '&=' expression expression ) | ^( '^=' expression expression ) | ^( '||=' expression expression ) | ^( '|=' expression expression ) | ^( '|' expression expression ) | ^( '||' expression expression ) | ^( '&' expression expression ) | ^( '^' expression expression ) | ^( '>>' expression expression ) | ^( '<<' expression expression ) | ^( '>>>' expression expression ) | ^( '-' expression expression ) | ^( '+' expression expression ) | ^( MOD expression expression ) | ^( SLASH expression expression ) | ^( '*' expression expression ) | ^( '==' expression expression ) | ^( '===' expression expression ) | ^( '!=' expression expression ) | ^( '!==' expression expression ) | ^( '>=' expression expression ) | ^( '<=' expression expression ) | ^( '>' expression expression ) | ^( '<' expression expression ) | ^( 'instanceof' expression expression ) | ^( 'in' expression expression ) | ^( 'delete' expression ) | ^( 'void' expression ) | ^( 'typeof' expression ) | ^( '++' expression ) | ^( '--' expression ) | ^( UPLUS expression ) | ^( UMINUS expression ) | ^( '~' expression ) | ^( '!' expression ) | ^( POST_INCR expression ) | ^( POST_DECR expression ) | ^( AREF expression expression ) | ^( '.' expression property_name ) | ^( CALL expression arguments ) | ^( ITER parameters block ) | ^( 'new' expression ( arguments )? ) | literal )\n alt_32 = 53\n case look_32 = @input.peek( 1 )\n when QMARK then alt_32 = 1\n when ASGN then alt_32 = 2\n when STAR_ASGN then alt_32 = 3\n when SLASH_ASGN then alt_32 = 4\n when MOD_ASGN then alt_32 = 5\n when PLUS_ASGN then alt_32 = 6\n when MINUS_ASGN then alt_32 = 7\n when LSHIFT_ASGN then alt_32 = 8\n when RSHIFT_ASGN then alt_32 = 9\n when RSHIFT3_ASGN then alt_32 = 10\n when AMP_ASGN then alt_32 = 11\n when HAT_ASGN then alt_32 = 12\n when OR_ASGN then alt_32 = 13\n when PIPE_ASGN then alt_32 = 14\n when PIPE then alt_32 = 15\n when OR then alt_32 = 16\n when AMP then alt_32 = 17\n when HAT then alt_32 = 18\n when RSHIFT then alt_32 = 19\n when LSHIFT then alt_32 = 20\n when RSHIFT3 then alt_32 = 21\n when MINUS then alt_32 = 22\n when PLUS then alt_32 = 23\n when MOD then alt_32 = 24\n when SLASH then alt_32 = 25\n when STAR then alt_32 = 26\n when EQ then alt_32 = 27\n when EQQ then alt_32 = 28\n when NEQ then alt_32 = 29\n when NEQQ then alt_32 = 30\n when GEQ then alt_32 = 31\n when LEQ then alt_32 = 32\n when GREATER then alt_32 = 33\n when LESS then alt_32 = 34\n when INSTANCEOF then alt_32 = 35\n when IN then alt_32 = 36\n when DELETE then alt_32 = 37\n when VOID then alt_32 = 38\n when TYPEOF then alt_32 = 39\n when INCR then alt_32 = 40\n when DECR then alt_32 = 41\n when UPLUS then alt_32 = 42\n when UMINUS then alt_32 = 43\n when TILDE then alt_32 = 44\n when NOT then alt_32 = 45\n when POST_INCR then alt_32 = 46\n when POST_DECR then alt_32 = 47\n when AREF then alt_32 = 48\n when DOT then alt_32 = 49\n when CALL then alt_32 = 50\n when ITER then alt_32 = 51\n when NEW then alt_32 = 52\n when FUNCTION, ARRAY, ARROW, REGEX, THIS, TRUE, UNDEFINED, NULL, OBJECT, FALSE, ID, IVAR, NUMBER, STRING, DOC then alt_32 = 53\n else\n raise NoViableAlternative( \"\", 32, 0 )\n end\n case alt_32\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 150:5: ^( '?' expression expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal106 = match( QMARK, TOKENS_FOLLOWING_QMARK_IN_expression_813 )\n\n tree_for_char_literal106 = @adaptor.copy_node( char_literal106 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal106, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_815 )\n expression107 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression107.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_817 )\n expression108 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression108.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_819 )\n expression109 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression109.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 151:5: ^( '=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal110 = match( ASGN, TOKENS_FOLLOWING_ASGN_IN_expression_829 )\n\n tree_for_char_literal110 = @adaptor.copy_node( char_literal110 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal110, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_831 )\n expression111 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression111.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_833 )\n expression112 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression112.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 152:5: ^( '*=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal113 = match( STAR_ASGN, TOKENS_FOLLOWING_STAR_ASGN_IN_expression_843 )\n\n tree_for_string_literal113 = @adaptor.copy_node( string_literal113 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal113, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_845 )\n expression114 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression114.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_847 )\n expression115 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression115.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 153:5: ^( SLASH_ASGN expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __SLASH_ASGN116__ = match( SLASH_ASGN, TOKENS_FOLLOWING_SLASH_ASGN_IN_expression_857 )\n\n tree_for_SLASH_ASGN116 = @adaptor.copy_node( __SLASH_ASGN116__ )\n\n root_1 = @adaptor.become_root( tree_for_SLASH_ASGN116, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_859 )\n expression117 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression117.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_861 )\n expression118 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression118.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 154:5: ^( MOD_ASGN expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __MOD_ASGN119__ = match( MOD_ASGN, TOKENS_FOLLOWING_MOD_ASGN_IN_expression_871 )\n\n tree_for_MOD_ASGN119 = @adaptor.copy_node( __MOD_ASGN119__ )\n\n root_1 = @adaptor.become_root( tree_for_MOD_ASGN119, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_873 )\n expression120 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression120.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_875 )\n expression121 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression121.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 6\n root_0 = @adaptor.create_flat_list\n\n\n # at line 155:5: ^( '+=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal122 = match( PLUS_ASGN, TOKENS_FOLLOWING_PLUS_ASGN_IN_expression_885 )\n\n tree_for_string_literal122 = @adaptor.copy_node( string_literal122 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal122, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_887 )\n expression123 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression123.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_889 )\n expression124 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression124.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 7\n root_0 = @adaptor.create_flat_list\n\n\n # at line 156:5: ^( '-=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal125 = match( MINUS_ASGN, TOKENS_FOLLOWING_MINUS_ASGN_IN_expression_899 )\n\n tree_for_string_literal125 = @adaptor.copy_node( string_literal125 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal125, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_901 )\n expression126 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression126.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_903 )\n expression127 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression127.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 8\n root_0 = @adaptor.create_flat_list\n\n\n # at line 157:5: ^( '<<=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal128 = match( LSHIFT_ASGN, TOKENS_FOLLOWING_LSHIFT_ASGN_IN_expression_913 )\n\n tree_for_string_literal128 = @adaptor.copy_node( string_literal128 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal128, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_915 )\n expression129 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression129.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_917 )\n expression130 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression130.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 9\n root_0 = @adaptor.create_flat_list\n\n\n # at line 158:5: ^( '>>=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal131 = match( RSHIFT_ASGN, TOKENS_FOLLOWING_RSHIFT_ASGN_IN_expression_927 )\n\n tree_for_string_literal131 = @adaptor.copy_node( string_literal131 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal131, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_929 )\n expression132 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression132.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_931 )\n expression133 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression133.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 10\n root_0 = @adaptor.create_flat_list\n\n\n # at line 159:5: ^( '>>>=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal134 = match( RSHIFT3_ASGN, TOKENS_FOLLOWING_RSHIFT3_ASGN_IN_expression_941 )\n\n tree_for_string_literal134 = @adaptor.copy_node( string_literal134 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal134, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_943 )\n expression135 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression135.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_945 )\n expression136 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression136.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 11\n root_0 = @adaptor.create_flat_list\n\n\n # at line 160:5: ^( '&=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal137 = match( AMP_ASGN, TOKENS_FOLLOWING_AMP_ASGN_IN_expression_955 )\n\n tree_for_string_literal137 = @adaptor.copy_node( string_literal137 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal137, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_957 )\n expression138 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression138.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_959 )\n expression139 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression139.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 12\n root_0 = @adaptor.create_flat_list\n\n\n # at line 161:5: ^( '^=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal140 = match( HAT_ASGN, TOKENS_FOLLOWING_HAT_ASGN_IN_expression_969 )\n\n tree_for_string_literal140 = @adaptor.copy_node( string_literal140 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal140, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_971 )\n expression141 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression141.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_973 )\n expression142 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression142.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 13\n root_0 = @adaptor.create_flat_list\n\n\n # at line 162:5: ^( '||=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal143 = match( OR_ASGN, TOKENS_FOLLOWING_OR_ASGN_IN_expression_983 )\n\n tree_for_string_literal143 = @adaptor.copy_node( string_literal143 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal143, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_985 )\n expression144 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression144.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_987 )\n expression145 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression145.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 14\n root_0 = @adaptor.create_flat_list\n\n\n # at line 163:5: ^( '|=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal146 = match( PIPE_ASGN, TOKENS_FOLLOWING_PIPE_ASGN_IN_expression_997 )\n\n tree_for_string_literal146 = @adaptor.copy_node( string_literal146 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal146, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_999 )\n expression147 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression147.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1001 )\n expression148 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression148.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 15\n root_0 = @adaptor.create_flat_list\n\n\n # at line 164:5: ^( '|' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal149 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_expression_1011 )\n\n tree_for_char_literal149 = @adaptor.copy_node( char_literal149 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal149, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1013 )\n expression150 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression150.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1015 )\n expression151 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression151.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 16\n root_0 = @adaptor.create_flat_list\n\n\n # at line 165:5: ^( '||' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal152 = match( OR, TOKENS_FOLLOWING_OR_IN_expression_1025 )\n\n tree_for_string_literal152 = @adaptor.copy_node( string_literal152 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal152, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1027 )\n expression153 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression153.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1029 )\n expression154 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression154.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 17\n root_0 = @adaptor.create_flat_list\n\n\n # at line 166:5: ^( '&' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal155 = match( AMP, TOKENS_FOLLOWING_AMP_IN_expression_1039 )\n\n tree_for_char_literal155 = @adaptor.copy_node( char_literal155 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal155, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1041 )\n expression156 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression156.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1043 )\n expression157 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression157.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 18\n root_0 = @adaptor.create_flat_list\n\n\n # at line 167:5: ^( '^' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal158 = match( HAT, TOKENS_FOLLOWING_HAT_IN_expression_1053 )\n\n tree_for_char_literal158 = @adaptor.copy_node( char_literal158 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal158, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1055 )\n expression159 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression159.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1057 )\n expression160 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression160.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 19\n root_0 = @adaptor.create_flat_list\n\n\n # at line 168:5: ^( '>>' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal161 = match( RSHIFT, TOKENS_FOLLOWING_RSHIFT_IN_expression_1067 )\n\n tree_for_string_literal161 = @adaptor.copy_node( string_literal161 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal161, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1069 )\n expression162 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression162.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1071 )\n expression163 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression163.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 20\n root_0 = @adaptor.create_flat_list\n\n\n # at line 169:5: ^( '<<' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal164 = match( LSHIFT, TOKENS_FOLLOWING_LSHIFT_IN_expression_1081 )\n\n tree_for_string_literal164 = @adaptor.copy_node( string_literal164 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal164, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1083 )\n expression165 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression165.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1085 )\n expression166 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression166.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 21\n root_0 = @adaptor.create_flat_list\n\n\n # at line 170:5: ^( '>>>' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal167 = match( RSHIFT3, TOKENS_FOLLOWING_RSHIFT3_IN_expression_1095 )\n\n tree_for_string_literal167 = @adaptor.copy_node( string_literal167 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal167, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1097 )\n expression168 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression168.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1099 )\n expression169 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression169.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 22\n root_0 = @adaptor.create_flat_list\n\n\n # at line 171:5: ^( '-' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal170 = match( MINUS, TOKENS_FOLLOWING_MINUS_IN_expression_1109 )\n\n tree_for_char_literal170 = @adaptor.copy_node( char_literal170 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal170, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1111 )\n expression171 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression171.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1113 )\n expression172 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression172.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 23\n root_0 = @adaptor.create_flat_list\n\n\n # at line 172:5: ^( '+' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal173 = match( PLUS, TOKENS_FOLLOWING_PLUS_IN_expression_1123 )\n\n tree_for_char_literal173 = @adaptor.copy_node( char_literal173 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal173, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1125 )\n expression174 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression174.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1127 )\n expression175 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression175.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 24\n root_0 = @adaptor.create_flat_list\n\n\n # at line 173:5: ^( MOD expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __MOD176__ = match( MOD, TOKENS_FOLLOWING_MOD_IN_expression_1137 )\n\n tree_for_MOD176 = @adaptor.copy_node( __MOD176__ )\n\n root_1 = @adaptor.become_root( tree_for_MOD176, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1139 )\n expression177 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression177.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1141 )\n expression178 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression178.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 25\n root_0 = @adaptor.create_flat_list\n\n\n # at line 174:5: ^( SLASH expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __SLASH179__ = match( SLASH, TOKENS_FOLLOWING_SLASH_IN_expression_1151 )\n\n tree_for_SLASH179 = @adaptor.copy_node( __SLASH179__ )\n\n root_1 = @adaptor.become_root( tree_for_SLASH179, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1153 )\n expression180 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression180.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1155 )\n expression181 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression181.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 26\n root_0 = @adaptor.create_flat_list\n\n\n # at line 175:5: ^( '*' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal182 = match( STAR, TOKENS_FOLLOWING_STAR_IN_expression_1165 )\n\n tree_for_char_literal182 = @adaptor.copy_node( char_literal182 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal182, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1167 )\n expression183 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression183.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1169 )\n expression184 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression184.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 27\n root_0 = @adaptor.create_flat_list\n\n\n # at line 176:5: ^( '==' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal185 = match( EQ, TOKENS_FOLLOWING_EQ_IN_expression_1179 )\n\n tree_for_string_literal185 = @adaptor.copy_node( string_literal185 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal185, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1181 )\n expression186 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression186.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1183 )\n expression187 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression187.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 28\n root_0 = @adaptor.create_flat_list\n\n\n # at line 177:5: ^( '===' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal188 = match( EQQ, TOKENS_FOLLOWING_EQQ_IN_expression_1193 )\n\n tree_for_string_literal188 = @adaptor.copy_node( string_literal188 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal188, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1195 )\n expression189 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression189.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1197 )\n expression190 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression190.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 29\n root_0 = @adaptor.create_flat_list\n\n\n # at line 178:5: ^( '!=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal191 = match( NEQ, TOKENS_FOLLOWING_NEQ_IN_expression_1207 )\n\n tree_for_string_literal191 = @adaptor.copy_node( string_literal191 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal191, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1209 )\n expression192 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression192.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1211 )\n expression193 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression193.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 30\n root_0 = @adaptor.create_flat_list\n\n\n # at line 179:5: ^( '!==' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal194 = match( NEQQ, TOKENS_FOLLOWING_NEQQ_IN_expression_1221 )\n\n tree_for_string_literal194 = @adaptor.copy_node( string_literal194 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal194, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1223 )\n expression195 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression195.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1225 )\n expression196 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression196.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 31\n root_0 = @adaptor.create_flat_list\n\n\n # at line 180:5: ^( '>=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal197 = match( GEQ, TOKENS_FOLLOWING_GEQ_IN_expression_1235 )\n\n tree_for_string_literal197 = @adaptor.copy_node( string_literal197 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal197, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1237 )\n expression198 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression198.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1239 )\n expression199 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression199.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 32\n root_0 = @adaptor.create_flat_list\n\n\n # at line 181:5: ^( '<=' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal200 = match( LEQ, TOKENS_FOLLOWING_LEQ_IN_expression_1249 )\n\n tree_for_string_literal200 = @adaptor.copy_node( string_literal200 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal200, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1251 )\n expression201 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression201.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1253 )\n expression202 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression202.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 33\n root_0 = @adaptor.create_flat_list\n\n\n # at line 182:5: ^( '>' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal203 = match( GREATER, TOKENS_FOLLOWING_GREATER_IN_expression_1263 )\n\n tree_for_char_literal203 = @adaptor.copy_node( char_literal203 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal203, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1265 )\n expression204 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression204.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1267 )\n expression205 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression205.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 34\n root_0 = @adaptor.create_flat_list\n\n\n # at line 183:5: ^( '<' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal206 = match( LESS, TOKENS_FOLLOWING_LESS_IN_expression_1277 )\n\n tree_for_char_literal206 = @adaptor.copy_node( char_literal206 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal206, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1279 )\n expression207 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression207.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1281 )\n expression208 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression208.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 35\n root_0 = @adaptor.create_flat_list\n\n\n # at line 184:5: ^( 'instanceof' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal209 = match( INSTANCEOF, TOKENS_FOLLOWING_INSTANCEOF_IN_expression_1291 )\n\n tree_for_string_literal209 = @adaptor.copy_node( string_literal209 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal209, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1293 )\n expression210 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression210.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1295 )\n expression211 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression211.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 36\n root_0 = @adaptor.create_flat_list\n\n\n # at line 185:5: ^( 'in' expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal212 = match( IN, TOKENS_FOLLOWING_IN_IN_expression_1305 )\n\n tree_for_string_literal212 = @adaptor.copy_node( string_literal212 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal212, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1307 )\n expression213 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression213.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1309 )\n expression214 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression214.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 37\n root_0 = @adaptor.create_flat_list\n\n\n # at line 186:5: ^( 'delete' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal215 = match( DELETE, TOKENS_FOLLOWING_DELETE_IN_expression_1319 )\n\n tree_for_string_literal215 = @adaptor.copy_node( string_literal215 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal215, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1321 )\n expression216 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression216.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 38\n root_0 = @adaptor.create_flat_list\n\n\n # at line 187:5: ^( 'void' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal217 = match( VOID, TOKENS_FOLLOWING_VOID_IN_expression_1331 )\n\n tree_for_string_literal217 = @adaptor.copy_node( string_literal217 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal217, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1333 )\n expression218 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression218.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 39\n root_0 = @adaptor.create_flat_list\n\n\n # at line 188:5: ^( 'typeof' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal219 = match( TYPEOF, TOKENS_FOLLOWING_TYPEOF_IN_expression_1343 )\n\n tree_for_string_literal219 = @adaptor.copy_node( string_literal219 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal219, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1345 )\n expression220 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression220.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 40\n root_0 = @adaptor.create_flat_list\n\n\n # at line 189:5: ^( '++' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal221 = match( INCR, TOKENS_FOLLOWING_INCR_IN_expression_1355 )\n\n tree_for_string_literal221 = @adaptor.copy_node( string_literal221 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal221, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1357 )\n expression222 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression222.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 41\n root_0 = @adaptor.create_flat_list\n\n\n # at line 190:5: ^( '--' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal223 = match( DECR, TOKENS_FOLLOWING_DECR_IN_expression_1367 )\n\n tree_for_string_literal223 = @adaptor.copy_node( string_literal223 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal223, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1369 )\n expression224 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression224.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 42\n root_0 = @adaptor.create_flat_list\n\n\n # at line 191:5: ^( UPLUS expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __UPLUS225__ = match( UPLUS, TOKENS_FOLLOWING_UPLUS_IN_expression_1379 )\n\n tree_for_UPLUS225 = @adaptor.copy_node( __UPLUS225__ )\n\n root_1 = @adaptor.become_root( tree_for_UPLUS225, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1381 )\n expression226 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression226.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 43\n root_0 = @adaptor.create_flat_list\n\n\n # at line 192:5: ^( UMINUS expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __UMINUS227__ = match( UMINUS, TOKENS_FOLLOWING_UMINUS_IN_expression_1391 )\n\n tree_for_UMINUS227 = @adaptor.copy_node( __UMINUS227__ )\n\n root_1 = @adaptor.become_root( tree_for_UMINUS227, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1393 )\n expression228 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression228.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 44\n root_0 = @adaptor.create_flat_list\n\n\n # at line 193:5: ^( '~' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal229 = match( TILDE, TOKENS_FOLLOWING_TILDE_IN_expression_1403 )\n\n tree_for_char_literal229 = @adaptor.copy_node( char_literal229 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal229, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1405 )\n expression230 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression230.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 45\n root_0 = @adaptor.create_flat_list\n\n\n # at line 194:5: ^( '!' expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal231 = match( NOT, TOKENS_FOLLOWING_NOT_IN_expression_1415 )\n\n tree_for_char_literal231 = @adaptor.copy_node( char_literal231 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal231, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1417 )\n expression232 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression232.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 46\n root_0 = @adaptor.create_flat_list\n\n\n # at line 195:5: ^( POST_INCR expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __POST_INCR233__ = match( POST_INCR, TOKENS_FOLLOWING_POST_INCR_IN_expression_1427 )\n\n tree_for_POST_INCR233 = @adaptor.copy_node( __POST_INCR233__ )\n\n root_1 = @adaptor.become_root( tree_for_POST_INCR233, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1429 )\n expression234 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression234.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 47\n root_0 = @adaptor.create_flat_list\n\n\n # at line 196:5: ^( POST_DECR expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __POST_DECR235__ = match( POST_DECR, TOKENS_FOLLOWING_POST_DECR_IN_expression_1439 )\n\n tree_for_POST_DECR235 = @adaptor.copy_node( __POST_DECR235__ )\n\n root_1 = @adaptor.become_root( tree_for_POST_DECR235, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1441 )\n expression236 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression236.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 48\n root_0 = @adaptor.create_flat_list\n\n\n # at line 197:5: ^( AREF expression expression )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __AREF237__ = match( AREF, TOKENS_FOLLOWING_AREF_IN_expression_1451 )\n\n tree_for_AREF237 = @adaptor.copy_node( __AREF237__ )\n\n root_1 = @adaptor.become_root( tree_for_AREF237, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1453 )\n expression238 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression238.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1455 )\n expression239 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression239.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 49\n root_0 = @adaptor.create_flat_list\n\n\n # at line 198:5: ^( '.' expression property_name )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n char_literal240 = match( DOT, TOKENS_FOLLOWING_DOT_IN_expression_1465 )\n\n tree_for_char_literal240 = @adaptor.copy_node( char_literal240 )\n\n root_1 = @adaptor.become_root( tree_for_char_literal240, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1467 )\n expression241 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression241.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_property_name_IN_expression_1469 )\n property_name242 = property_name\n @state.following.pop\n\n @adaptor.add_child( root_1, property_name242.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 50\n root_0 = @adaptor.create_flat_list\n\n\n # at line 199:5: ^( CALL expression arguments )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __CALL243__ = match( CALL, TOKENS_FOLLOWING_CALL_IN_expression_1479 )\n\n tree_for_CALL243 = @adaptor.copy_node( __CALL243__ )\n\n root_1 = @adaptor.become_root( tree_for_CALL243, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1481 )\n expression244 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression244.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_arguments_IN_expression_1483 )\n arguments245 = arguments\n @state.following.pop\n\n @adaptor.add_child( root_1, arguments245.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 51\n root_0 = @adaptor.create_flat_list\n\n\n # at line 200:5: ^( ITER parameters block )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __ITER246__ = match( ITER, TOKENS_FOLLOWING_ITER_IN_expression_1493 )\n\n tree_for_ITER246 = @adaptor.copy_node( __ITER246__ )\n\n root_1 = @adaptor.become_root( tree_for_ITER246, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_parameters_IN_expression_1495 )\n parameters247 = parameters\n @state.following.pop\n\n @adaptor.add_child( root_1, parameters247.tree )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_block_IN_expression_1497 )\n block248 = block\n @state.following.pop\n\n @adaptor.add_child( root_1, block248.tree )\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 52\n root_0 = @adaptor.create_flat_list\n\n\n # at line 201:5: ^( 'new' expression ( arguments )? )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n string_literal249 = match( NEW, TOKENS_FOLLOWING_NEW_IN_expression_1507 )\n\n tree_for_string_literal249 = @adaptor.copy_node( string_literal249 )\n\n root_1 = @adaptor.become_root( tree_for_string_literal249, root_1 )\n\n\n\n match( DOWN, nil )\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_expression_IN_expression_1509 )\n expression250 = expression\n @state.following.pop\n\n @adaptor.add_child( root_1, expression250.tree )\n # at line 201:25: ( arguments )?\n alt_31 = 2\n look_31_0 = @input.peek( 1 )\n\n if ( look_31_0 == ARGUMENTS )\n alt_31 = 1\n end\n case alt_31\n when 1\n # at line 201:25: arguments\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_arguments_IN_expression_1511 )\n arguments251 = arguments\n @state.following.pop\n\n @adaptor.add_child( root_1, arguments251.tree )\n\n\n end\n\n match( UP, nil )\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n when 53\n root_0 = @adaptor.create_flat_list\n\n\n # at line 202:5: literal\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_literal_IN_expression_1520 )\n literal252 = literal\n @state.following.pop\n\n @adaptor.add_child( root_0, literal252.tree )\n\n\n end\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return return_value\n end", "def evaluate_expression_inner(expression)\n expression_string = evaluate_expression(expression.left)\n expression_string << ' ' + expression.operator.to_s + ' '\n expression_string << evaluate_expression(expression.right)\n expression_string\n end", "def expr_eval_to_s\n if @last_eval_state.nil?\n return \"<unevaluated>\"\n end\n \n str = ''\n if @offset\n str << \"#{@offset < 0 ? '-' : ''}0x#{@offset.abs.to_s(16)}\"\n end\n \n if @last_eval_state[:special] || @last_eval_state[:register]\n if @offset\n str << '+'\n end\n if @last_eval_state[:special]\n str << @last_eval_state[:special_tok]\n elsif @last_eval_state[:register]\n str << @last_eval_state[:reg_tok]\n end \n end\n \n str\n end", "def parse_expr str\n parse(str, @parser)\n end", "def process_iasgn(exp)\n ivar = exp.shift\n value = exp.shift\n ivar_name = @model.encode_instance_variable(ivar)\n\n str = without_result do\n want_expression do\n \"#{@model.encode_self}.#{ivar_name}=#{process(value)}\"\n end\n end\n\n resultify(str)\n end", "def evaluate(expression)\n eval(expression).inspect\nend", "def to_expr\n return @signal.to_expr\n end", "def create_method_from_expressions; end", "def complete_expression?(str); end", "def expression\n n = term\n while next_token == '+' || next_token == '-'\n op = consume\n m = term\n n = case op\n when '+'\n n + m\n when '-'\n n - m\n else\n nil\n end\n end\n n\n end", "def expression?\n !@no_expression\n end", "def orginize_equation\n gsub!(' ','')\n ##TODO:: orginaize \n end", "def expr()\n #This is a stub, used for indexing\n end", "def expression sexp\n return nil if sexp == nil\n #pp sexp\n body = sexp.sexp_body\n case sexp[0]\n # when :block # a collection of things to do!\n # body.map { |i| convert(i) + NL }.join\n when :iasgn # assign to instance variable\n value = expression( sexp[2] )\n name = @vars.set( sexp[1], value.type )\n \"#{name} = (#{value})\"\n when :lit, :false, :true, :array # literal values\n literal(sexp)\n when :ivar\n @vars.get(sexp.value)\n when :call # call a 'method' on something\n call(sexp[1], sexp[2], sexp[3].sexp_body)\n when :if # statements resembling ifs\n condition = expression(sexp[1])\n true_code = expression(sexp[2])\n false_code = expression(sexp[3])\n \"( ( #{condition} )?( #{true_code} ):( #{false_code} ) )\"\n when :colon2 # lookup constants\n if sexp[1][0] == :const and sexp[1][1] == :Math\n case sexp[2]\n when :PI\n Value.typed CTypeFloat, Math::PI.inspect\n end\n end\n when :not # the !something operator\n Value.typed CTypeBoolean, \"!(#{ expression(sexp.value) })\"\n else\n raise \"IDK how to handle this S-expression: #{ sexp.inspect }!\"\n end\n end", "def as_sql(expression, aliaz)\n \"#{expression} #{quote_identifier(aliaz)}\"\n end", "def parse_expression\n expr = []\n loop do\n raise ExpressionError, 'Expression definition incomplete.. more terms expected' unless current_token\n\n name = expect_token %i[name string]\n expr.append name\n\n debug \"Expression identifier found as #{name} - appending to expr stack\"\n\n if current_token.nil?\n raise ExpressionError, \"Expected terminator (;) or operator (+) following #{name} in expression.\"\n elsif !(current_token.type == :operator || current_token.type == :terminator)\n raise ExpressionError, \"Unexpected #{current_token} inside expression; expected terminator (;) or operator (+)\"\n elsif current_token.type == :terminator\n break\n end\n\n step_forward\n end\n\n expr\n rescue ExpressionError => e\n raise_parser_error \"Failed to parse expression: #{e.message}\" unless @state_arg\n raise_parser_error \"Expression error for #{@state_arg} command: #{e.message}\"\n end", "def arg_expr(expr)\n if expr.type == :lvasgn\n expr.updated(:arg)\n else\n n(:arg_expr, [ expr ],\n expr.loc.dup)\n end\n end", "def create_equation\n equation =''\n for i in 0..(@operands.size-1)\n if i==0\n equation << @operands[i].to_s\n else\n #binding.pry\n equation << @operators[@operator_value[i-1]].to_s\n equation << @operands[i].to_s\n end\n end\n equation\n end" ]
[ "0.594437", "0.5938093", "0.5765557", "0.5683596", "0.56009287", "0.5495079", "0.5488852", "0.54812586", "0.53991836", "0.5252175", "0.51958126", "0.51896244", "0.50873345", "0.5057998", "0.50463855", "0.5019224", "0.5010823", "0.50105554", "0.49776268", "0.49641386", "0.49579608", "0.49208647", "0.49108568", "0.49081486", "0.48949984", "0.48948628", "0.48811874", "0.4847194", "0.48435783", "0.48370916", "0.48292023", "0.48031387", "0.4802068", "0.47920346", "0.476221", "0.47557938", "0.47465923", "0.47445676", "0.4744423", "0.47273296", "0.47240728", "0.47224653", "0.47052753", "0.4690947", "0.46886104", "0.46840888", "0.4681678", "0.46789783", "0.46567184", "0.46475032", "0.46475032", "0.46390888", "0.46339884", "0.46260136", "0.4614195", "0.46135592", "0.46060207", "0.46052396", "0.4602058", "0.45876968", "0.45834926", "0.457434", "0.45727152", "0.45694146", "0.45657697", "0.45470864", "0.45432565", "0.4534611", "0.45345217", "0.4521892", "0.45150217", "0.45141706", "0.4511928", "0.4511133", "0.45078012", "0.4507794", "0.45015392", "0.44907874", "0.4487867", "0.44843534", "0.4481628", "0.44800884", "0.4476591", "0.44748065", "0.44676733", "0.44602662", "0.44432136", "0.44420418", "0.44419283", "0.44414732", "0.44388938", "0.44345352", "0.44265953", "0.44238243", "0.4417783", "0.4406995", "0.43942118", "0.439244", "0.4387605", "0.4381999" ]
0.5827323
2
Validates if a record exists in the table that matches the array with the conditions given.
def exists?(domain_expr) domain_name = domain_expr.domain_name domain_attr = domain_expr.domain_attr entry = find(domain_name, domain_attr) db_expr, values = convert_expr(domain_expr, [], entry) db = storage_class_from_entry(entry, :db) db.exists?([db_expr, *values]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_records(records)\n records.select do |record|\n conditions.matches?(record)\n end\n end", "def valid_for_table?(table)\n conditions.reject {|c| c.valid?(table)}.length == 0\n end", "def contains?(record)\n begin\n val = relation.exists?(record.id)\n @valid = true # set valid to true, if relation.exists?(model) does not throw any exception\n val\n rescue\n @valid = false\n end\n end", "def validate(table)\r\n establish! do\r\n options[:conditions].each do |cond|\r\n validate! table, cond\r\n end\r\n end\r\n end", "def has(*conditions)\n if conditions.size == 1\n self.class.new( where( conditions[0], :!=, nil ) )\n elsif conditions.size == 2\n self.class.new( where( { conditions[0] => conditions[1] } ) )\n elsif conditions.size == 3\n self.class.new( where( *conditions ) )\n end\n end", "def exists?(ids)\r\n if ids.is_a?(Array) && ids.first.is_a?(String)\r\n count(:conditions => ids) > 0\r\n else\r\n obj = find(ids) rescue false\r\n !obj.nil? and obj.is_a?(self) \r\n end\r\n end", "def exists?\n rec = run_sql(\"SELECT * FROM #{table} WHERE id = #{@id};\")\n if rec.empty?\n @errors << \"That id does not exist in the table.\"\n false\n else\n true\n end\n end", "def exists?(id_or_conditions = {})\n case id_or_conditions\n when Hash then where(id_or_conditions).count >= 1\n else\n begin\n find(id_or_conditions)\n true\n rescue Dynamoid::Errors::RecordNotFound\n false\n end\n end\n end", "def valid?\n @errors = []\n if id.blank?\n @errors << {message: \"#{class_name} id cannot be blank.\", variable: \"id\"}\n elsif !possible_values.include?(id)\n @errors << {message: \"#{class_name} id must be included in the table.\", variable: \"id\"}\n end\n \n if class_name.blank?\n @errors << {message: \"Class cannot be blank.\", variable: \"class\"}\n end\n \n @errors.empty?\n end", "def match_id_array_exists?(match_id_array)\n match_id_array.each do |match_id|\n return true if @matched_cells.has_key?(match_id)\n end\n end", "def row_exists?(dbh, table=nil, column=nil, where_value=nil)\n stmt = %Q(SELECT #{column} FROM #{table} WHERE #{column} = #{where_value})\n res = dbh.query(stmt)\n ary = []\n res.each do |array|\n array.each do |value|\n ary << value\n end\n end\n ary.empty? ? false : true\nend", "def find_crossed(record)\n self.scoped_model = record.class\n self.generate_overlap_sql_values(record)\n self.generate_overlap_sql_conditions(record)\n self.add_attributes(record, options[:scope]) if options && options[:scope].present?\n self.add_query_options(options[:query_options]) if options && options[:query_options].present?\n\n return self.scoped_model.exists?([sql_conditions, sql_values])\n end", "def exists?(id_or_conditions = {})\n case id_or_conditions\n when Hash then where(id_or_conditions).first.present?\n else\n begin\n find(id_or_conditions)\n true\n rescue Dynamoid::Errors::RecordNotFound\n false\n end\n end\n end", "def presence_of_facility_in_associated_data(facility_id_array)\r\n result = true\r\n error_message = nil\r\n blank_facility_array = facility_id_array.select{|facility| facility.blank?}\r\n uniq_facility_array = facility_id_array.uniq\r\n another_record_with_same_facility_exists = uniq_facility_array.length != facility_id_array.length\r\n if !blank_facility_array.blank? || another_record_with_same_facility_exists\r\n result = false\r\n error_message = \"Please enter one row for a facility.\"\r\n end\r\n return result, error_message\r\n end", "def exists(table, where = {})\n count(table, where) > 0\n end", "def validate_unique *colnames\n\t\t\tcolnames.each { |colname|\n\t\t\t\tds = self.class.where colname => send(colname)\n\t\t\t\tds.filter!(~{primary_key => send(primary_key)}) unless new?\n\t\t\t\tif ds.count > 0\n\t\t\t\t\terrors.add(colname, 'must be unique.')\n\t\t\t\tend\n\t\t\t}\n\t\tend", "def has_record?(record)\n table.has_key?(lookup_key_for(record))\n end", "def check_all_records\n models.each do |model|\n begin\n # TODO: Can we filter based on those records that are already present in the 'invalid_records' table - especially since they have been re-verified in the method before?\n model.find_each(batch_size: Checker.batch_size) do |record|\n invalid_record!(record) unless record.valid?\n end\n rescue => e\n # Rescue from exceptions (table does not exists,\n # deserialization error, ...)\n puts e.message\n puts \"Skipping validations for #{model}\"\n end\n end\n end", "def exists_bulk_method(states = [nil, :found])\n prepare_environment\n @item = @resource_type.new(@client, @data)\n return true if empty_data_check(states)\n @property_hash[:ensure] == :present\nend", "def validate_matches\n return success unless (@matched_ids.present? || @unmatched_ids.present?)\n\n # common ids in matches_ids and unmatched_ids\n r = validate_matched_unmatched_records\n return r unless r.success?\n\n success\n\n end", "def valid_row?(row)\n required_csv_fields.all? do |required_field|\n valid_field = row[required_field].present?\n row[:errors] << \"The field #{I18n.t(required_field).titleize} is required!\" unless valid_field\n valid_field\n end\n end", "def any_records?(type)\n @records.any? { |rec| rec.is_a?(type) && rec.valid? }\n end", "def validate_data\n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n # check for the relationships t other tables\n if self.rate_id.blank? && self.rate_override.blank?\n @s.push self.dataerrors.build(:message => \"A rate or override rate must be entered\", :created_user => self.created_user) \n end\n \n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n return false\n end\n #everything is good, return true\n return true\n end", "def validate_row(row_hash)\n row_validation_errors(row_hash).empty?\n end", "def validate_records\n have_enough_items_to_trade?\n end", "def multi_appointment_receipt_allowed?() # We must validate record existance (for AS security layer):\n return false unless existing_record_check? # (current record instance could be empty or new)\n # Existing records must be checked for this also:\n ( Appointment.find_all_unpayed_for_patient( self.id ).size > 0 )\n end", "def matches_conditions?(object, query); end", "def check_duplicate_item(db, tbl,field_name,value)\r\n check_command = \"Select * from ? where ? = ?\",[tbl, field_name,value]\r\n if db.execute(check_command).length > 0\r\n return true\r\n else \r\n return false \r\n end \r\nend", "def valid_input?(id_list)\n return false if id_list.empty?\n id_list.each do |id, quan|\n return false unless Product.where(\"id =?\", id).first\n return false if (quan.nil? || quan <=0)\n end\n end", "def exists_with(hash)\n\t\tcolumn = hash.keys.first\n\t\tcheck_column(column.to_s)\n\t\tvalue = hash[column]\n\t\tresult = @db.execute(\n\t\t\t\"SELECT * FROM #{@table} WHERE #{column.to_s} IS ?\", \n\t\t\tvalue\n\t\t)\n\n\t\tif(result.size == 0)\n\t\t\tfalse\n\t\telse\n\t\t\ttrue\n\t\tend\n\tend", "def present?(record, *attributes)\n attributes.any? do |attribute|\n record[attribute].present?\n end\n end", "def check_conditions(klass) #:nodoc:\n !@conditions.find do |tuple|\n if tuple[0].call(klass); false\n else\n warn tuple[1]\n true\n end\n end\n end", "def row_allowed?(row)\n if unique\n key = (unique.collect { |k| row[k] }).join('|')\n return false if compound_key_constraints[key]\n compound_key_constraints[key] = 1\n end\n return true\n end", "def valid?\n conditions.valid?\n end", "def valid_record?( record )\n !record[:name].nil? and !record[:type].nil? and !record[:value].nil? and\n !record[:name].empty? and !record[:type].empty? and !record[:value].empty?\nend", "def apply_filtering(records, params)\n return records unless params[:conditions]\n records.select! do |record|\n params[:conditions].all? do |key, value|\n db_value = record.send(key) if record.respond_to?(key)\n if key == :id\n value = value.is_a?(Array) ? value.map(&:to_i) : value.to_i\n end\n if value.is_a?(Array)\n value.include?(db_value)\n else\n db_value == value\n end\n end\n end\n records\n end", "def exists?\n criteria.exists?\n end", "def valid?\n @errors = []\n \n # checks each field type and adds error messages if it does not meet requirements from the table\n validate_field_types\n \n \n if integer?(\"num_quarter_hours\")\n if num_quarter_hours < 1\n @errors << {message: \"Number of quarter hours must be greater than 0.\", variable: \"num_quarter_hours\"}\n end\n end\n \n @errors.empty?\n end", "def balance_record_eob_exist?\n insurance_payment_eobs.count(:conditions => ['balance_record_type is not NULL']) > 0\n end", "def success?\n data_rows.exists? && !data_rows.failed.exists?\n end", "def _row_checker()\n array_of_rows = _get_board_rows()\n _board_logic_checker(array_of_rows)\n end", "def validate(options = {})\n options = normalize_options(options)\n self.sql(options[:table_class])\n raise \"No column defined.\" if column.nil? or column.strip == \"\"\n if options[:table_class]\n\traise \"Condition not appliable to #{options.inspect}.\" unless applyable(options)\n end\n end", "def add_conditions_from_array(conditions)\n if conditions.length == 2 && conditions[1].class == Hash\n add_conditions_from_hash_array(conditions)\n else\n add_conditions_from_string_array(conditions)\n end\n end", "def valid?\n validate_field_types\n # only do a database query if you have good enough data to check the database\n if @errors.length == 0\n if duplicate_user_assignment?\n @errors << \n {message: \n \"The database already has this user and assignment combination. It is record \n #{this_user_and_assignment.id}. Change this assignment or user or the assignment or user of that record.\", \n variabe: \"assignment_id, user_id\"}\n end\n end \n @errors.length == 0\n end", "def applyable(table_class)\n for condition in conditions\n\treturn false unless condition.applyable(table_class)\n end\n return true\n end", "def isValid?\n if @Valid.nil?\n params = []\n joins = ''\n where = ''\n\n if not @Locales.empty?\n joins += ' LEFT JOIN `Locales` AS L ON RI.Locale = L.ID'\n where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '\n params += @Locales\n end\n\n sql = \"SELECT 1 FROM `RailsI18N` RI #{joins} WHERE #{where}RI.`NameLowercase` = ? LIMIT 1\"\n params << @Name.downcase\n\n @Valid = Data::Storage.getStatement(sql).execute(*params).count > 0\n end\n @Valid\n end", "def user_exist?(id)\n DB[:users].select.where(:id=>id).all\nend", "def found?\n return false if no_search\n\n id.present? || records.present?\n end", "def row_exists?(unique_identifier)\n wait_for_results\n exists? result_row(unique_identifier)\n end", "def row_exists?(unique_identifier)\n wait_for_results\n exists? result_row(unique_identifier)\n end", "def check_record(rec)\n @mapping.each { |mapping|\n unless rec[mapping[:field_name]].blank?\n if mapping.has_key?(:format) && !mapping[:format].match(rec[mapping[:field_name]])\n Rails.logger.error([\"invalid value for field #{mapping[:name]} [#{rec[mapping[:field_name]]}]\", \"#{@filename}, line #{@linenumber}\", \"SchoolDataImporter\"].join(\" - \"))\n return false\n end\n end\n }\n return true\n end", "def validate_time_slot_ids times\n\n empty_times if times.size == 0\n\n times.each do |id|\n time_slot = TimeSlot.find(id)\n end\n true\n\n rescue ActiveRecord::RecordNotFound\n r = {times: 'Record Not Found'}\n return not_found r\n end", "def check_required_field_exists(csv_data, column_name)\n data = csv_data.select{|item| !item[column_name].nil? }\n if data.length < csv_data.length\n puts \"🔴 Some rows contain empty #{column_name}\"\n return true\n else \n return false\n end\n end", "def exist? \n !DB.execute(\"SELECT name FROM students WHERE Id = ? \", @id).empty?\n end", "def check_valid(key, array, values)\n return true if [nil, '', '-'].include?(array[key])\n return true if values.map(&:to_s).include?(array[key].to_s)\n raise RuntimeError, \"Invalid value for #{key}\"\n end", "def valid?\n ids.include?(@id)\n end", "def email_exist(email)\n if $db.execute(\"SELECT email from users WHERE email = ?\", email) != []\n return true\n else\n return false\n end\nend", "def exists(opts = nil)\n \"EXISTS (#{select_sql(opts)})\"\n end", "def isValid?\n if @Valid.nil?\n params = []\n joins = ''\n where = ''\n\n if not @Locales.empty?\n joins += ' LEFT JOIN `Locales` AS L ON TN.Locale = L.ID'\n where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '\n params += @Locales\n end\n\n sql = \"SELECT 1 FROM `WindowsZoneNames` TN #{joins} WHERE #{where}TN.`NameLowercase` = ? LIMIT 1\"\n params << @Name.downcase\n\n @Valid = Data::Storage.getStatement(sql).execute(*params).count > 0\n end\n @Valid\n end", "def unique?\n existing_record = CONNECTION.execute(\"SELECT * FROM logs WHERE user_id = #{self.user_id} AND train_id = #{self.train_id}\")\n return existing_record == []\n end", "def exists?(name, table)\n Existence.new(name, table).matches?\n end", "def valid_to_ins(list, new_entry, identifier)\n id = new_entry[identifier]\n list.each do |entry|\n return false if entry[identifier] == id\n end\n\n true\n end", "def engineer_exists\n if ! Engineer.exists?([\"id = ?\",engineer_id]) \n errors.add(:engineer_id,\"Engineer provided does not exist!\")\n end\n end", "def isValid?\n if @Valid.nil?\n params = []\n joins = ''\n where = ''\n\n if not @Locales.empty?\n joins += ' LEFT JOIN `Locales` AS L ON TN.Locale = L.ID'\n where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '\n params += @Locales\n end\n\n sql = \"SELECT 1 FROM `TimezoneNames` TN #{joins} WHERE #{where}TN.NameLowercase = ? COLLATE NOCASE LIMIT 1\"\n params << @Timezone.downcase\n\n @Valid = Data::Storage.getStatement(sql).execute(*params).count > 0\n end\n @Valid\n end", "def find_on_conditions(id, conditions)\n find_first(\"#{primary_key} = '#{sanitize(id)}' AND #{sanitize_conditions(conditions)}\") || \n raise(RecordNotFound, \"Couldn't find #{name} with #{primary_key} = #{id} on the condition of #{conditions}\")\n end", "def preconditions_met?(row, precondition)\n unless precondition.nil?\n pre_query = precondition.gsub(/%(\\w+)/) do |m|\n if row[$1].kind_of?(String)\n row[$1].downcase\n else\n row[$1]\n end\n end\n\n begin\n r = $dbh_ms.select_one(pre_query)\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not process pre-query. Message: #{$!}. Pre-query: \\\"#{pre_query}\\\"\")\n STDERR.puts \"r: #{r.inspect}\"\n raise\n exit\n end\n if r[0] == 0\n Log.write_log('not_met_preconditions', \"Row does not satisfy pre condition. Pre-query: #{pre_query}\")\n return false\n end\n end\n\n return true\nend", "def validate_filter(filter)\r\n # Each field in the filter array must be a valid fieldname in the\r\n # table.\r\n filter.each { |f|\r\n raise 'Invalid field name: %s in filter!' % f unless \\\r\n @field_names.include?(f)\r\n }\r\n end", "def generate_overlap_sql_conditions(record)\n starts_at_attr, ends_at_attr = attributes_to_sql(record)\n main_condition = condition_string(starts_at_attr, ends_at_attr)\n if record.new_record?\n self.sql_conditions = main_condition\n else\n self.sql_conditions = \"#{main_condition} AND #{record_table_name(record)}.id != #{record.id}\"\n end\n end", "def valid_rows?\n valid = true\n row = 0\n while (row < @board.length && valid)\n valid = false if !unique_arr?(@board[row])\n row += 1\n end\n valid\n end", "def vend_present?\n \n sql = \"SELECT COUNT(*)\n FROM vendors_lists\n WHERE business_type = '#{@type}' AND\n city_name = '#{@city}' AND\n branch_name = '#{@area}' AND\n vendor_name = '#{@name}'\"\n\n db.execute(sql).map{|i| i[0] == 0 ? nil : 1 }[0]\n \n end", "def multi_exists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_exists\", *keys], multi: true, proc: T_VBOOL\n end\n end", "def check_if_record_exists\n\tif MenuItem.exists?(:name =>self.name,:vendor_id=>self.vendor_id)\n\t\tputs\"This record already exists\"\n\t\tthrow:abort\n\telse\n\t\treturn true\n\tend\n end", "def multi_exists(keys)\n keys = Array(keys) unless keys.is_a?(Array)\n mon_synchronize do\n perform [\"multi_exists\", *keys], :multi => true, :proc => T_VBOOL\n end\n end", "def validate args, valid = Array.new\n invalid = args.keys.reject { |field| valid.include? field }\n invalid.empty? || raise(create_invalid_fields_message invalid)\n end", "def verify_record_or_report_errors(record, status, record_checks)\n record_checks.collect { |check| check.verify_or_report_errors(record, status) }.\n reject { |r| r }.empty? # does the result contain anything that isn't truthy?\n end", "def check rowkey, cond\n raise ArgumentError, 'invalid check condition' unless cond.length == 1\n col, val = cond.first\n\n cf, cq, type = lookup_and_parse(col, true)\n\n # If the passed value is null, the check is for the lack of column\n CheckedOperation.new self, @mutation, Util.to_bytes(rowkey),\n cf, cq,\n (val.nil? ? nil : Util.to_typed_bytes(type, val))\n end", "def exists(*args); end", "def schema_array?(value, id, uniqueness_check = true)\n non_empty_array?(value, uniqueness_check) &&\n value.to_enum.with_index.all? do |schema, index|\n full_id = [id, index].join('/')\n valid_schema? schema, full_id\n end\n end", "def is_barber_exists? db, name\n db.execute(\"select * from Barbers where name=?\", [name]).length > 0\nend", "def validate_columns(table_name, column_names, clause)\n\n connection = ActiveRecord::Base.connection\n config = GenericSearch.config[table_name.intern]\n config_for_where = (config and config[:for_where]) || {}\n config_for_select = (config and config[:for_select]) || {}\n\n if !connection.table_exists?(table_name) and !self.base_class.reflections.has_key?(table_name)\n self.errors.add(:base, \"'#{table_name}' table is invalid (in '#{clause}')\")\n return\n end\n\n if !connection.table_exists?(table_name)\n if !self.base_class.reflections.has_key?(table_name)\n self.errors.add(:base, \"'#{table_name}' table is invalid (in '#{clause}')\")\n return\n else\n table_name = self.base_class._relation_table[table_name.intern]\n end\n end\n\n return if column_names.blank?\n\n unknown_columns = []\n\n column_names.each do |column_name|\n next if config_for_select and config_for_select.has_key?(column_name.intern)\n next if config_for_where and config_for_where.has_key?(column_name.intern)\n\n if !connection.column_exists?(table_name, column_name) and !config_for_select.has_key?(column_name.intern) and !config_for_where.has_key?(column_name.intern)\n unknown_columns << column_name\n end\n end\n\n if !unknown_columns.blank?\n self.errors.add(:base, \"'#{unknown_columns.join(', ')}' column#{unknown_columns.size > 1 ? 's' : ''} not found in '#{table_name}' table (in '#{clause}')\")\n end\n\n end", "def exists(*keys); end", "def exists?\n values.exists?\n end", "def must_contain(parms, list)\n list.each do |i|\n raise \"#{i.to_s} required\" unless parms[i]\n end\nend", "def check?(fields)\n @check.call(fields)\n end", "def check_rules_on_insert\n logger.debug \"Running INSERT checks for #{name}\"\n\n db.query(\"SELECT * FROM #{audit} WHERE `_copied_at` IS NULL\").each do |audit_row|\n pkey = audit_row.select { |k,v| primary_key.include?(k) }\n logger.debug \"Checking row: #{pkey}\"\n\n fields.each do |f|\n violations = f.on_insert(audit_row)\n violations.compact.each { |v| record_violation(v[:description], v[:item], v[:rule_name], audit_row['_last_version'], f.name) }\n end\n\n rules[:insert].each do |rule|\n v = rule.execute(audit_row, self)\n record_violation(v, audit_row, rule.name, audit_row['_last_version']) if v\n end\n end\n end", "def find_by(conditions={})\n raise ArgumentError if conditions.empty?\n query = %(SELECT * FROM #{table_name} #{build_condition(conditions)})\n res = connection.execute(query).first\n\n if res.nil?\n raise RecordNotFound\n end\n res.extend Result::Behavior\n end", "def check_rules\n tables.each(&:check_rules_on_update)\n tables.each(&:check_rules_on_insert)\n end", "def add_where(arr:)\n @where_conditions << \" AND (#{arr.first}) \" # put in parenthesis for good measure\n @where_params << arr[1..]\n @where_params.flatten!\n end", "def validate_fields_clause(errors)\n return errors unless options[:fields]\n\n options[:fields].each_with_object(errors) do |(key, attributes), errors|\n attributes.each do |attribute|\n next errors if allowed_fields[key]&.include?(attribute)\n\n errors.push(\n source: { parameter: 'fields' },\n title: 'Invalid Query Parameter',\n detail: \"#{key.capitalize} with attribute #{attribute}.\"\n )\n end\n end\n end", "def LinkingTableValueExists(db, linkingTable, valueIdColumn, valueId, cardId)\n\texists = db.execute(\"SELECT \" + valueIdColumn.to_s + \" FROM \" + linkingTable + \" WHERE CardId = ? AND \" + valueIdColumn + \" = ?;\", [cardId, valueId])\t\n\treturn exists.length != 0\nend", "def valid?\n validate_survivors and validate_items && validate_records\n end", "def validate_inputs(env, rec, args)\n # check size\n return false unless inputs.size == args.size\n\n # check type\n inputs.each_with_index do |input, i|\n input = get_type(env, input, rec)\n unless input.match(env, args[i])\n return false\n end\n end\n return true\n end", "def matching_records_arel(table_name)\n s = Arel::Table.new(\"#{table_name}_view\")\n v = Arel::Table.new(valid_values_view)\n arel_nodes = column_names_for_matching.map do |c|\n if required_column_names.include? c\n v[c].eq(s[c])\n else\n # if optional, check if NULL is allowed for this particular combination\n # e.g. unit code can be blank only if paired with certain terms\n v[c].eq(s[c]).or(v[c].eq(nil).and(s[c].eq(nil)))\n end\n end\n valid_values = s.project(s['*']).join(v).on(arel_nodes.inject(&:and))\n scoped_records_arel(s).except(valid_values)\n end", "def search?\n [first_name, last_name, email].any?(&:present?)\n end", "def valid_value?(row, column)\n return false unless %w[A B C].include?(row)\n return false unless [1,2,3].include?(column)\n true\n end", "def validate(*values)\n values.all?{|val| @validators.any?{|validator| validator.validate(val)}}\n end", "def matches?(actual, &block)\n @actual = actual\n result = @actual.table_exists?(@table_name)\n the_block = block || @block\n the_block.call(@actual[@table_name]) if result && the_block\n result\n end", "def exists?(id)\n rec = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{id};\").first\n if rec.nil?\n false\n else\n self.new(rec)\n end\n end", "def check_record; end", "def check_record_field assertions, input_fields, record_input_type_fields, expected_record\n count = 0\n assert_equal record_input_type_fields.length, input_fields.length\n input_fields.each do |input_field|\n expected_name = record_input_type_fields[count]\n assertions.each do |assertion|\n assertion.call(input_field, expected_name)\n end\n count += 1\n end\n end", "def validate_business_uniqueness( column_name )\n cond_str = \"#{column_name.to_s} = ? AND business_id = ?\";\n if ! self.new_record?\n cond_str = \"id != #{self.id} AND \" + cond_str;\n end\n \n count = self.class.count(:conditions=>[cond_str, self.send(column_name), self.business_id]);\n return (count == 0);\n end" ]
[ "0.62262666", "0.60879207", "0.58493316", "0.58382636", "0.58099544", "0.5785698", "0.57691896", "0.57451737", "0.5638104", "0.55933505", "0.5590019", "0.5579047", "0.5554377", "0.54853755", "0.54511994", "0.5392826", "0.5361285", "0.53538", "0.5304673", "0.5295494", "0.5281627", "0.5277485", "0.52619004", "0.5252758", "0.52375406", "0.52288353", "0.5220254", "0.52107376", "0.5192101", "0.51877034", "0.51831144", "0.51523924", "0.51505077", "0.5132263", "0.5127962", "0.5123777", "0.5112566", "0.5098951", "0.5096971", "0.5095604", "0.5076519", "0.5071713", "0.50710034", "0.5070804", "0.50637656", "0.5048342", "0.50451565", "0.5033473", "0.5031672", "0.5031672", "0.50127953", "0.49897698", "0.49592775", "0.49511266", "0.4939388", "0.49373552", "0.49132788", "0.491131", "0.49094245", "0.48964968", "0.48958534", "0.48923618", "0.4892317", "0.4890756", "0.48885027", "0.48854947", "0.48790848", "0.48784646", "0.48647794", "0.48570618", "0.4848301", "0.48334852", "0.48282582", "0.48250127", "0.48124483", "0.48113328", "0.48086965", "0.48083436", "0.48008326", "0.47979677", "0.47887474", "0.47863606", "0.47839096", "0.47814903", "0.4778684", "0.4775574", "0.4773305", "0.4758664", "0.47568813", "0.47551963", "0.47534388", "0.47524524", "0.47451708", "0.47434095", "0.47427386", "0.4736574", "0.47353706", "0.47351307", "0.47324684", "0.4730873", "0.47051775" ]
0.0
-1
Build an order by expression for the given db relation based on the criteria
def order(criteria, relation) return relation unless criteria.order? order_str = convert_order_exprs(criteria.order_by) relation.order(order_str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordered_expression_sql(oe)\n \"#{literal(oe.expression)} #{oe.descending ? 'DESC' : 'ASC'}\"\n end", "def order_clause\n col = case sort_params[:sort_col]\n when 'title'\n 'data_management_plans.title'\n when 'funder'\n 'affiliations_fundings.name'\n else\n 'data_management_plans.updated_at'\n end\n { \"#{col}\": :\"#{sort_params[:sort_dir]}\" }\n end", "def add_order_by_for_association_limiting!(sql, options)\n return sql if options[:order].blank?\n\n order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)\n order.map! {|s| $1 if s =~ / (.*)/}\n order = order.zip((0...order.size).to_a).map { |s,i| \"alias_#{i}__ #{s}\" }.join(', ')\n\n sql << \" ORDER BY #{order}\"\n end", "def sort_expression\n col = sort_mappings[params[:sort].to_sym] || \n \"#{model_class.table_name}.#{params[:sort]}\"\n \"#{col} #{sort_dir}\"\n end", "def sort_criteria_clause\n return nil unless sort_criteria.present?\n sort_criteria.map { |name, order| order_clause(name, order) if name != group_by }.reject(&:blank?).join(',')\n end", "def order(expr)\n from(default_table).order(expr)\n end", "def order_by_expression(order_by)\n return false unless order_by && order_by.presence.present?\n\n to_ordered_table_path(order_by)\n .tap { |order_args| process_ordering_arguments!(order_args) }\n .tap { |order_args| scope_preprocess_order_args(order_args) }\n end", "def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end", "def sort_clause\n sorter.to_sql\n end", "def ordering_sql_string\n\t\tif order\n\t\t\torder.collect{|col,dir| absolute_column_name( col ) + ((dir.eql?(:asc))?(''):(' DESC')) if item_class.column_names.include?( col ) }.compact.join(',')\n\t\tend\n\tend", "def add_order_by_for_association_limiting!(sql, options)\n return sql if options[:order].blank?\n\n order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)\n order.map! { |s| 'DESC' if s =~ /\\bdesc$/i }\n order = order.zip((0...order.size).to_a).map { |s,i| \"id_list.alias_#{i} #{s}\" }.join(', ')\n\n sql.replace \"SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}\"\n end", "def add_order_by_for_association_limiting!(sql, options)\n return sql if options[:order].blank?\n\n order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)\n order.map! { |s| 'DESC' if s =~ /\\bdesc$/i }\n order = order.zip((0...order.size).to_a).map { |s,i| \"id_list.alias_#{i} #{s}\" }.join(', ')\n\n sql.replace \"SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}\"\n end", "def add_order_by_for_association_limiting!(sql, options)\n return sql if options[:order].blank?\n\n order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)\n order.map! { |s| 'DESC' if s =~ /\\bdesc$/i }\n order = order.zip((0...order.size).to_a).map { |s,i| \"id_list.alias_#{i} #{s}\" }.join(', ')\n\n sql.replace \"SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}\"\n end", "def order!(*args)\n args.flatten!\n validate_order_args args\n\n references = args.reject { |arg|\n Arel::Node === arg || Squeel::Nodes::Node === arg\n }\n references.map! { |arg| arg =~ /^([a-zA-Z]\\w*)\\.(\\w+)/ && $1 }.compact!\n references!(references) if references.any?\n\n # if a symbol is given we prepend the quoted table name\n args = args.map { |arg|\n arg.is_a?(Symbol) ?\n Arel::Nodes::Ascending.new(klass.arel_table[arg]) :\n arg\n }\n\n self.order_values += args\n self\n end", "def order_by(*props)\n @query[:order_by] = props.join(',')\n self\n end", "def apply_sorting_to_relation(rel)\n return rel if !params[:sort]\n\n sorts = params[:sort].split(',')\n\n sorts.each do |sort|\n if sort =~ /^([-+]?)(.*)$/\n desc = ($1 && $1 == '-')\n attrname = $2\n\n (attr, path) = rel.nested_attribute(attrname)\n\n rel = rel.joins { path[1..-1].inject(self.__send__(path[0]).outer) { |a,x| a.__send__(x).outer } } if path.any?\n\n # Call .asc explicitly to overcome a bug in pgsql adapter leading to undefined method to_sql\n attr = desc ? attr.desc : attr.asc\n\n rel = rel.order(attr)\n end\n end\n\n rel\n end", "def ordering_query; end", "def build_order_string(fields, mode=\"ASC\")\n fields.collect{ |f| \"#{self.table_name}.#{f}\" }.join(\",\") + \" \" + mode\n end", "def set_conditions_and_sort_order(query, sdb_type)\n conditions = [\"simpledb_type = '#{sdb_type}'\"]\n # look for query.order.first and insure in conditions\n # raise if order if greater than 1\n\n if query.order && query.order.length > 0\n query_object = query.order[0]\n #anything sorted on must be a condition for SDB\n conditions << \"#{query_object.property.name} IS NOT NULL\" \n order = \"order by #{query_object.property.name} #{query_object.direction}\"\n else\n order = \"\"\n end\n\n query.conditions.each do |operator, attribute, value|\n operator = case operator\n when :eql then '='\n when :not then '!='\n when :gt then '>'\n when :gte then '>='\n when :lt then '<'\n when :lte then '<='\n else raise \"Invalid query operator: #{operator.inspect}\" \n end\n conditions << \"#{attribute.name} #{operator} '#{value}'\"\n end\n [conditions,order]\n end", "def to_json_query_ordering\n order_operations = []\n if order && order.any?\n order.map do |direction|\n order_operations << case direction.operator\n when :asc then \"[\\/#{direction.target.field}]\"\n when :desc then \"[\\\\#{direction.target.field}]\"\n end\n end\n end\n\n order_operations.join(\"\")\n end", "def ordering_by\n order && order.to_s.gsub(/^(ascend|descend)_by_/, '')\n end", "def orders\n \"assetcode ASC\"# \"staffgrade_id ASC\"\n end", "def to_sparql(**options)\n \"ASC(#{operands.last.to_sparql(**options)})\"\n end", "def asc\n OrderedExpression.new(@expression, false, :nulls=>@nulls)\n end", "def ordering_query\n \"#{sql_length}(#{slug_column}) ASC, #{slug_column} ASC\"\n end", "def order_with(expr)\n unless expr.is_a?(String)\n raise \"must call FatTable::Table\\#order_with with a single string expression\"\n end\n\n rev = false\n if expr.match?(/\\s*!\\s*\\z/)\n rev = true\n expr = expr.sub(/\\s*!\\s*\\z/, '')\n end\n sort_sym = rev ? :sort_key! : :sort_key\n dup.select(*headers, sort_key: expr).order_by(sort_sym)\n end", "def sort_order # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n col = sort_column\n # do a case-insensitive sort if we are sort on last name\n col = \"lower(#{col})\" if col.include?('last_name')\n return Arel.sql(\"#{col} #{sort_direction}\") unless col.include?('enumerations')\n\n klass, method = col.split('.')\n values = klass.singularize.capitalize.constantize.send(method.intern)\n .order(Arel.sql(\"value #{sort_direction} \")).pluck('value')\n order_query = values.each_with_index.inject(+'CASE ') do |memo, (val, i)| # rubocop:disable Style/EachWithObject\n memo << \"WHEN( enumerations.value = '#{val}') THEN #{i} \"\n memo\n end\n Arel.sql(\"#{order_query} ELSE #{values.length} END\")\n end", "def lob_order_by_expression(klass, order)\n return order if order.nil?\n changed = false\n new_order = order.to_s.strip.split(/, */).map do |order_by_col|\n column_name, asc_desc = order_by_col.split(/ +/)\n if column = klass.columns.detect { |col| col.name == column_name && col.sql_type =~ /LOB$/i}\n changed = true\n \"DBMS_LOB.SUBSTR(#{column_name},100,1) #{asc_desc}\"\n else\n order_by_col\n end\n end.join(', ')\n changed ? new_order : order\n end", "def order_by(column, order)\n return resource().order(column.to_s + \" \" + order)\n end", "def search_order(query) #:nodoc:\n by = []\n query.order.each do |order|\n next unless order.property.kind_of? Sphinx::Attribute\n by << [order.property.field, order.direction].join(' ')\n end\n by.empty? ? nil : by.join(', ')\n end", "def order(name, direction = :asc, as: nil, sort: nil, sql_column: nil, limit: nil, reorder: false)\n raise 'expected relation to be present' unless relation\n\n sql_column ||= sql_column(name)\n sql_type = (as || sql_type(name))\n\n association = associated(name)\n sql_direction = sql_direction(direction)\n @relation = relation.reorder(nil) if reorder\n\n case sql_type\n when :belongs_to\n relation\n .order(Arel.sql(\"#{is_null(sql_column)} ASC\"))\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n when :belongs_to_polymorphic\n relation\n .order(Arel.sql(\"#{sql_column}_type #{sql_direction}\"))\n .order(Arel.sql(\"#{sql_column}_id #{sql_direction}\"))\n when :has_and_belongs_to_many, :has_many, :has_one\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :effective_addresses\n relation\n .order(order_by_associated_conditions(associated(:addresses), sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :effective_roles\n relation.order(Arel.sql(\"#{sql_column(:roles_mask)} #{sql_direction}\"))\n when :string, :text\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column}='' ASC, #{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n when :time\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"EXTRACT(hour from #{sql_column}) #{sql_direction}, EXTRACT(minute from #{sql_column}) #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n else\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n end\n end", "def asc(arg, opts=OPTS)\n SQL::OrderedExpression.new(arg, false, opts)\n end", "def arel_order\n text_columns = if params[:order]\n params[:order].split(' ')\n elsif self.default_sort\n [self.default_sort].flatten\n else\n [model_class.primary_key].flatten\n end\n sort_columns = text_columns.map do |column|\n if column.to_s.include?('.')\n name,direction = column.to_s.split('.',2)\n raise \"Illegal sort direction: #{direction} in #{column}\" unless %w{asc desc}.include?(direction)\n table[name].send(direction)\n else\n table[column]\n end\n end\n sort_columns\n end", "def to_cql\n \"ORDER BY #{@field} #{@dir.to_s.upcase}\"\n end", "def sort_criteria\n @sort_criteria ||=\n sort_params.reduce('') do |sum, (key, value)|\n comparables = [\"a[:#{key}]\", \"b[:#{key}]\"]\n comparables.reverse! if value == :desc\n sum + \"comp = comp == 0 ? #{comparables.join(' <=> ')} : comp; \"\n end\n end", "def order(*attrs)\n new(dataset.sort(*schema.project(*attrs).map(&:to_sort_expr)))\n end", "def item_number_conditions( object )\n\t\t# nothing to do: no order specified\n\t\treturn {} if order.nil?\n\n\t\ts = ''\n\t\tv = []\n\n# First, we'll start with the last and we'll build our query from the inside out\n\t\tordering = order.reverse\n# End case: the last query:\n\t\to = ordering.shift\n\t\tif o\n\t\t\tcolumn = o.first\n\t\t\tdirection = o.last\n\t\t\ts = \"( #{absolute_column_name( column )} #{order_to_sign( direction )}= ? )\"\n\t\t\tif table_join_accessors.has_key?( column )\n\t\t\t\tv << table_join_accessors[column].call( object )\n\t\t\telse\n\t\t\t\tv << object.send( column )\n\t\t\tend\n\t\tend\n\n# Now, the rest of the clauses are built to include all previous clauses\n\t\tordering.each do |column, direction|\n\t\t\ts = \"( #{absolute_column_name( column )} #{order_to_sign( direction )} ? OR ( #{absolute_column_name( column )} = ? AND #{s} ) )\"\n\t\t\tif table_join_accessors.has_key?( column )\n\t\t\t\tv << table_join_accessors[column].call( object )\n\t\t\t\tv << table_join_accessors[column].call( object )\n\t\t\telse\n\t\t\t\tv << object.send( column )\n\t\t\t\tv << object.send( column )\n\t\t\tend\n\t\tend\n\n\t\t{ :conditions => [\"(#{s})\"].concat(v.reverse) }\n\tend", "def order(name, direction = :asc, as: nil, sort: nil, sql_column: nil, limit: nil, reorder: false)\n raise 'expected relation to be present' unless relation\n\n sql_column ||= sql_column(name)\n sql_type = (as || sql_type(name))\n\n association = associated(name)\n sql_direction = sql_direction(direction)\n @relation = relation.reorder(nil) if reorder\n\n case sql_type\n when :belongs_to\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n when :belongs_to_polymorphic\n relation\n .order(Arel.sql(\"#{sql_column}_type #{sql_direction}\"))\n .order(Arel.sql(\"#{sql_column}_id #{sql_direction}\"))\n when :has_and_belongs_to_many, :has_many, :has_one\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :effective_addresses\n relation\n .order(order_by_associated_conditions(associated(:addresses), sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :active_storage\n relation\n .send(\"with_attached_#{name}\")\n .references(\"#{name}_attachment\")\n .order(Arel.sql(\"active_storage_blobs.filename #{sql_direction}\"))\n when :effective_roles\n relation\n .order(Arel.sql(\"#{sql_column(:roles_mask)} #{sql_direction}\"))\n when :time\n relation\n .order(Arel.sql(\"EXTRACT(hour from #{sql_column}) #{sql_direction}, EXTRACT(minute from #{sql_column}) #{sql_direction}\"))\n when :string, :text\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column}='' ASC, #{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n when :date, :datetime\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n else\n relation\n .order(Arel.sql(\"#{sql_column} #{sql_direction}\"))\n end\n end", "def order_by(ids, klass=nil)\n column = namespaced_column(:id, klass)\n if ids.empty?\n nil\n elsif ::ActiveRecord::Base.is_mysql_adapter?\n \"FIELD(#{column},#{ids.join(',')})\"\n else\n order = ''\n ids.each_index { |i| order << \"WHEN #{column}=#{ids[i]} THEN #{i+1} \" }\n \"CASE \" + order + \" END\"\n end\n end", "def task_type_order_clause\n task_types_sorted_by_label = Task.descendants.sort_by(&:label).map(&:name)\n task_types_sql_array = \"array#{task_types_sorted_by_label}::varchar[]\".tr('\"', \"'\")\n task_type_sort_position = \"#{task_types_sql_array}, tasks.type\"\n \"array_position(#{task_type_sort_position}) #{sort_order}\"\n end", "def apply_sort(query, table, column_name, allowed, direction)\n validate_query_table_column(query, table, column_name, allowed)\n validate_sorting(column_name, allowed, direction)\n\n # allow sorting by field mappings\n sort_field = @build.build_custom_calculated_field(column_name)&.fetch(:arel)\n sort_field = table[column_name] if sort_field.blank?\n\n if sort_field.is_a? String\n sort_field\n elsif direction == :desc\n Arel::Nodes::Descending.new(sort_field)\n else\n #direction == :asc\n Arel::Nodes::Ascending.new(sort_field)\n end => sort_field_by\n\n query.order(sort_field_by)\n end", "def order(params = {})\n return self if params.blank? && @owner.attributes[@name].blank?\n params = Hash[params, :asc] if params.is_a? ::Symbol\n params = { sort: @klass.attribute_map.map(params, :to => :source).flatten.join('_') }\n AssociationProxy.new self.clone.tap { |a| a.params.merge! params }\n end", "def agregate_order_by(params, options)\n case params[:order_by].to_s\n when \"direction\" then\n order_by = \"destinations.direction_code\"\n when \"destination\" then\n order_by = \"destinations.name\"\n when \"customer_orig\" then\n order_by = \"nice_user\"\n when \"customer_term\" then\n order_by = \"terminators.name\"\n when \"billed_orig\" then\n order_by = \"originating_billed\"\n when \"billed_term\" then\n order_by = \"terminating_billed\"\n when \"billsec_orig\" then\n order_by = \"originating_billsec\"\n when \"billsec_term\" then\n order_by = \"terminating_billsec\"\n when \"duration\" then\n order_by = \"duration\"\n when \"answered_calls\" then\n order_by = \"answered_calls\"\n when \"total_calls\" then\n order_by = \"total_calls\"\n when \"asr\" then\n order_by = \"asr\"\n when \"acd\" then\n order_by = \"acd\"\n else\n options[:order_by] ? order_by = options[:order_by] : order_by = \"\"\n end\n\n without = order_by\n order_by = \"users.first_name \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", users.last_name\" if order_by.to_s == \"users.first_name\"\n order_by = \"ds.direction_code \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", ds.name\" if order_by.to_s == \"destinations.name\"\n order_by = \"ds.direction_code \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", ds.subcode\" if order_by.to_s == \"destinations.name\"\n order_by = \"t.name\" if order_by.to_s == \"terminators.name\"\n\n order_by += \" ASC\" if options[:order_desc] == 0 and order_by != \"\"\n order_by += \" DESC\" if options[:order_desc] == 1 and order_by != \"\"\n return without, order_by\n end", "def orders\n \"staffgrade_id ASC\"\n end", "def orders\n \"staffgrade_id ASC\"\n end", "def group_by_sort_clause\n return nil unless grouped?\n order_clause group_by, \n (default_order_for(group_by) || :asc), \n (sortable_for(group_by) || true)\n end", "def typus_order_by\n\n order = []\n\n begin\n fields = self.send(\"admin_order_by\").map { |a| a.to_s }\n rescue\n config = Typus::Configuration.config[self.name]\n return \"`#{self.table_name}`.id ASC\" unless config && config['order_by']\n fields = config['order_by'].split(', ')\n end\n\n fields.each do |field|\n order_by = (field.include?(\"-\")) ? \"`#{self.table_name}`.#{field.delete('-')} DESC\" : \"`#{self.table_name}`.#{field} ASC\"\n order << order_by\n end\n\n return order.join(', ')\n\n end", "def order(*attributes)\n sorted = relation.sort_by { |r| attributes.map { |attribute| r.send(attribute) } }\n new(name, sorted, aliases)\n end", "def to_find_order\n if @order.blank?\n nil\n else\n @order.collect do |col|\n col.respond_to?(:full_name) ? (col.full_name + (col.negative? ? \" DESC\" : \"\")) : col\n end.join(\", \")\n end\n end", "def order_union_sentence(*args)\n @union_query_elements ||= {}\n @union_query_elements[:order] = \" ORDER BY \" + order_union_attributes(*args).join(', ')\n end", "def order(order_str:)\n @order_by = \"ORDER BY #{order_str}\"\n end", "def to_find_conditions(join_association = {})\n return nil if operator.nil?\n \n op, arg_format, values = operator, \"?\", [operand]\n op, arg_format, values = case operator\n when :<=> then [ \"BETWEEN\", \"? AND ?\", [ operand.first, operand.last ] ]\n when :=~ then\n case operand\n when String then [ \"LIKE\", arg_format, values ]\n when Regexp then [ \"REGEXP\", arg_format, values.map(&:source) ]\n end\n when :==, :=== then\n case operand\n when Array then [ \"IN\", \"(?)\", values ]\n when Range then [ \"IN\", \"(?)\", values ]\n when Condition then [ \"=\", operand.full_name, [] ]\n when nil then [ \"IS\", \"NULL\", [] ]\n else [ \"=\", arg_format, values ]\n end\n when :contains then [ \"LIKE\", arg_format, values.map{|v| \"%#{v}%\" } ]\n else\n case operand\n when Condition then [ op, oprand.full_name, [] ]\n else [ op, arg_format, values ]\n end\n end\n sql = \"#{full_name} #{op} #{arg_format}\"\n sql = \"NOT (#{sql})\" if @negative\n [ sql, *values ]\n end", "def to_find_order\n @conditions.to_find_order\n end", "def get_order_by\n @order_by\n end", "def ordered_by(attribute_name)\n ordering[attribute_name]\n end", "def condition_sort(input)\n poke_name = input.poke_name\n product_db = SearchRecord::For.klass(Entity::Product)\n case input.sort\n when 'id'\n product_db.find_full_name(poke_name)\n when 'likes_DESC'\n product_db.order_by_desc_likes(poke_name)\n when 'likes_ASC'\n product_db.order_by_asc_likes(poke_name)\n when 'rating_DESC'\n product_db.order_by_desc_rating(poke_name)\n when 'rating_ASC'\n product_db.order_by_asc_rating(poke_name)\n when 'price_DESC'\n product_db.order_by_desc_price(poke_name)\n else\n # priceASC\n product_db.order_by_asc_price(poke_name)\n end\n end", "def add_order_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"in_#{col}_order\", { :order => \"#{col}\" }\n politely_add_named_scope :\"in_reverse_#{col}_order\", { :order => \"#{col} DESC\" }\n end\n end", "def order_by(property_name)\n query_proxy = OData::Model::QueryProxy.new(self)\n query_proxy.order_by(property_name.to_sym)\n end", "def order(*args)\n sql_records = records.__send__ :order, *args\n end", "def parse_string\n direction = clause.split[1]\n field = clause.split[0]\n direction = \"asc\" unless %w(asc desc).include?(direction)\n [\"$order_by\", [\"$#{direction}\", field]]\n end", "def attrs_to_orderings(order)\n order.map do |o|\n Arel::Attribute === o ? o.asc : o\n end\n end", "def order_by(field)\n ensure_valid_parameter('sorting order', field, %w(price age))\n @request[:order_by] = field.to_s \n self\n end", "def order_by *columns\n @order += [columns].flatten\n end", "def order_by(attribute)\n @order_by = Dynamicloud::API::Criteria::OrderByClause.asc(attribute)\n self\n end", "def build_order\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tif p['order']\n\t\t\t\tattribute, asc_desc = p['order'].split(\" \")\n\t\t\t\tif ['terms', 'count', 'updated_at'].include?(attribute) && ['asc', 'desc'].include?(asc_desc)\n\t\t\t\t\treturn \"#{attribute} #{asc_desc}\"\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn \"updated_at desc\"\n\t\tend", "def search_get_order_sql(sort_by, order_by, default)\n sql = []\n\n sort_by.each_with_index do |value, index|\n next if value.blank?\n next if order_by[index].blank?\n\n sql.push( \"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)} #{order_by[index]}\" )\n end\n\n if sql.blank?\n sql.push(\"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(default)}\")\n end\n\n sql.join(', ')\n end", "def add_order_scopes(col)\n if self.column_names.include?(col.to_s)\n politely_add_named_scope :\"in_#{col}_order\", lambda { order(\"#{col}\") }\n politely_add_named_scope :\"in_reverse_#{col}_order\", lambda { order(\"#{col} DESC\") }\n end\n end", "def reverse_order_clause(order)\n raise \"reversing multiple order clauses not supported\" if order.split(',').size > 1\n raise \"order clause format not understood; expected 'column_name (ASC|DESC)?'\" unless order =~ /^\\s*(\\S+)\\s*(ASC|DESC)?\\s*$/\n column_name = $1\n reversed_order = {'ASC' => 'DESC', 'DESC' => 'ASC'}[$2 || 'ASC']\n return \"#{column_name} #{reversed_order}\"\n end", "def select_from_order_columns(columns)\n columns.compact.map do |column|\n if column.kind_of?(Arel::Nodes::Ordering)\n column.expr\n else\n column = column.to_sql if column.respond_to?(:to_sql)\n column.kind_of?(String) ? column.gsub(/ (DESC|ASC)/i, '') : column\n end\n end.reject do |column|\n column.kind_of?(Arel::Attributes::Attribute) ||\n column.kind_of?(Symbol) ||\n (column.kind_of?(String) && column =~ /^(\"?[a-z_0-9]+\"?[.])?\"?[a-z_0-9]+\"?$/i)\n end\n end", "def apply_criteria_options\n if spec = criteria.options[:sort]\n query.sort(spec)\n end\n if spec = criteria.options[:fields]\n query.select(spec)\n end\n end", "def asc\n OrderedExpression.new(self, false)\n end", "def getSortingOrder #:doc:\n sorting = @default_sorting.dup\n ordering = [\"DESC\", \"ASC\", \"ASC\", \"ASC\"] # default ordering\n \n if @queryparams[:sort_by]\n # get given sort_by-values\n sorts = @queryparams[:sort_by].split(\" \")\n # get given order-values and make sure sorts.size == orders.size\n orders = Array.new(sorts.size, \"DESC\")\n if @queryparams[:order]\n orders = @queryparams[:order].split(\" \")\n if orders.size < sorts.size\n orders += Array.new(sorts.size - orders.size, \"DESC\")\n elsif orders.size > sorts.size\n orders = orders.slice(0, sorts.size)\n end\n orders.each do |o|\n if not (o.upcase == \"ASC\" or o.upcase == \"DESC\") then o = \"ASC\" end\n end \n end\n \n # first sort_by-value has to be processed last (so it gets first on the list)\n sorts = sorts.reverse\n orders = orders.reverse\n \n # check sort_by-values\n sorts.each_index do |i|\n if @sort_by.has_key?(sorts[i])\n # move the sort-attribute to first\n sort_value = @sort_by[sorts[i]]\n ind = sorting.index(\"LOWER(\" + @sort_by[sorts[i]] + \")\")\n if ind != nil\n sorting.delete_at(ind)\n ordering.delete_at(ind)\n sort_value = \"LOWER(\" + sort_value + \")\"\n end\n sorting.unshift(sort_value)\n ordering.unshift(orders[i].upcase)\n end\n end\n end\n \n #combine everything together\n returnable = sorting[0] + \" \" + ordering[0]\n sorting.each_index do |i|\n next if i == 0\n returnable += \", \" + sorting[i] + \" \" + ordering[i]\n end\n return returnable\n end", "def order(*names)\n order_attributes = names.map { |attribute| attributes.field_name(attribute) }\n order_attributes.concat(attributes.fields).uniq!\n new(relation.order(*order_attributes))\n end", "def query_sort(query, table, *order_by_params)\n\tquery = \"select #{query} from #{table}\"\n\tif order_by_params != nil\n\t\tquery += \" order by\"\n\t\torder_by_params.each do |param|\n\t\t\tquery += \" #{param}\"\n\t\tend\n\tend\n\treturn query\nend", "def all\n relation.order(\"CASE WHEN property_type IN ('land', 'mobile_home') THEN 1 ELSE 0 END, selling_date DESC\")\n end", "def format_order(sub_order, klass = self)\n case sub_order\n when Hash\n sub_order.map do |name, value|\n format_order(value, klass.reflect_on_association(name.to_sym).klass)\n end.flatten.join(',')\n when Array\n sub_order.map do |column|\n format_order(column, klass)\n end.flatten.join(',')\n else\n \n return (sub_order.to_s.split(/\\s*,\\s*/).collect do |str|\n # regex matches 'table_name.[column_name] asc' or 'column_name'\n # ('table_name.', 'asc', '[', and ']' are optional) $1 =\n # 'table_name.[column_name]' $2 = 'column_name' $3 = ' asc'\n str =~ /(\\w+\\.)?\\[?(\\w+)\\]?(\\s+asc|\\s+desc)?/i\n \n if $2 && klass.column_names.include?($2)\n \"#{$1 || klass.table_name+'.'}#{$2}#{$3}\"\n else\n str\n end\n end).join(',')\n\n end #case sub_order\n end", "def order_string\n \"#{params[:sort]} #{params[:direction]}\"\n end", "def joins_for_order_statement(order_options)\n joins = []\n\n if order_options\n if order_options.include?('authors')\n joins << \"LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id\"\n end\n order_options.scan(/cf_\\d+/).uniq.each do |name|\n column = available_columns.detect {|c| c.name.to_s == name}\n join = column && column.custom_field.join_for_order_statement\n if join\n joins << join\n end\n end\n end\n\n joins.any? ? joins.join(' ') : nil\n end", "def sort_column\n \n @sort_field = ''\n if params[:sort].to_s == MadConstants.donor_name\n @sort_field = 'concat(donours.first_name,donours.last_name)'\n elsif params[:sort].to_s == MadConstants.donation_amount\n @sort_field = 'donations.donation_amount'\n elsif params[:sort].to_s == MadConstants.donation_type\n @sort_field = 'donations.donation_type'\n elsif params[:sort].to_s == MadConstants.product\n @sort_field = 'cfr_products.name'\n elsif params[:sort].to_s == MadConstants.fundraiser_name\n @sort_field = 'users.first_name'\n elsif params[:sort].to_s == MadConstants.donation_status\n @sort_field = 'donations.donation_status'\n elsif params[:sort].to_s == MadConstants.eighty_g_required\n @sort_field = 'donations.eighty_g_required'\n else\n @sort_field = 'donations.id' \n end\n \n Donation.joins(:donour).joins('inner join cfr_products as cfr_products on cfr_products.id = donations.product_id').\n joins('inner join users as users on users.id = donations.fundraiser_id').\n cfr_txn_search(params[:search]).order(@sort_field + ' ' + sort_direction).\n paginate(:per_page => 10, :page => params[:page])\n end", "def order_statement_regex\n /^(?<table>\\w+)\\.(?<column>\\w+) (?<direction>asc|desc)$/\n end", "def visit_Squeel_Nodes_Order(o, parent)\n if defined?(Arel::Nodes::Descending)\n if o.descending?\n Arel::Nodes::Descending.new(visit(o.expr, parent))\n else\n Arel::Nodes::Ascending.new(visit(o.expr, parent))\n end\n else\n visit(o.expr, parent).send(o.descending? ? :desc : :asc)\n end\n end", "def order_by(order_by)\n @order_bys << CGI.escape(order_by)\n self\n end", "def order_by(*args)\n clone.tap do |crit|\n arguments = args.size == 1 ? args.first : args\n setup_sort_options(crit.options) unless args.first.nil?\n if arguments.is_a?(Array)\n #[:name, :asc]\n if arguments.size == 2 && (arguments.first.is_a?(Symbol) || arguments.first.is_a?(String))\n build_order_options(arguments, crit)\n else\n arguments.each { |argument| build_order_options(argument, crit) }\n end\n else\n build_order_options(arguments, crit)\n end\n end\n end", "def order_by(opt)\n raise ArgumentError, \"invalid order by value\" unless %w(sld tld nsstatus expdate renew).include?(opt)\n @options['orderby'] = opt\n self\n end", "def sort_and_order_sql\n {:sort => ATTACH_MAPPING[@sort], :order => @order}\n end", "def sort_sql_helper(param)\n return param.gsub('_reverse',\" DESC\")\n end", "def ordered_by(statement)\n @expected_options[:order] = statement\n self\n end", "def define_order(s_order)\n s_order=='Crescente' ? :asc : :desc\n end", "def build_order_options(arguments, crit)\n case arguments\n when Hash\n if arguments.size > 1\n raise ArgumentError, \"Please don't use hash to define multiple orders \" +\n \"due to the fact that hash doesn't have order this may cause unpredictable results\"\n end\n arguments.each_pair do |field, direction|\n merge_options(crit.options[:sort], [ localize(field), direction ])\n end\n when Array\n merge_options(crit.options[:sort], arguments.map{ |field| localize(field) })\n when Complex\n merge_options(crit.options[:sort], [ localize(arguments.key), arguments.operator.to_sym ])\n end\n end", "def build_query(table_name, where_expression)\n query = %Q{SELECT *\\n FROM \"#{table_name}\"}\n unless where_expression.nil?\n query << \"\\n WHERE #{where_expression}\"\n end\n unless (pk = find_primary_key(table_name)).empty?\n query << \"\\n ORDER BY \" << pk.join(', ')\n end\n return query\nend", "def summary_order_by(params, options)\n case params[:order_by].to_s\n when \"orig_name\" then\n order_by = \"u.first_name\"\n when \"orig_calls\" then\n order_by = \"total_calls\"\n when \"orig_exec_billsec\" then\n order_by = \"exact_billsec\"\n when \"orig_billsec\" then\n order_by = \"originator_billsec\"\n when \"orig_price\" then\n order_by = \"originator_price\"\n\n when \"term_name\" then\n order_by = \"provider_name\"\n when \"term_calls\" then\n order_by = \"total_calls\"\n when \"term_exec_billsec\" then\n order_by = \"exact_billsec\"\n when \"term_billsec\" then\n order_by = \"provider_billsec\"\n when \"term_price\" then\n order_by = \"provider_price\"\n else\n options[:order_by] ? order_by = options[:order_by] : order_by = \"\"\n end\n without = order_by\n\n order_by = \"users.first_name \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", users.last_name\" if order_by.to_s == \"users.first_name\"\n\n order_by += \" ASC\" if options[:order_desc] == 0 and order_by != \"\"\n order_by += \" DESC\" if options[:order_desc] == 1 and order_by != \"\"\n return without, order_by\n end", "def order_by(val)\n raise \"order_by requires a String.\" unless val.is_a? String\n @orderby = val\n self\n end", "def order_by_field\n self.find_field(self.order_by)\n end", "def name\n if active\n expr.descending ? \"#{expr.expression}_desc\" : \"#{expr.expression}_asc\"\n else\n expr.expression\n end.to_s\n end", "def set_order\n unless params[:order_by]\n @order = @model.typus_order_by\n else\n @order = \"#{params[:order_by]} #{params[:sort_order]}\"\n end\n end", "def order_by\n ActiveSupport::StringInquirer.new(@params[:order_by]) unless @params[:order_by].nil?\n end", "def selects_all_bears_names_and_orders_in_alphabetical_order\n 'SELECT bears.name FROM bears ORDER BY name'\nend", "def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end", "def search_get_order_select_sql(sort_by, order_by, default)\n sql = []\n\n sort_by.each_with_index do |value, index|\n next if value.blank?\n next if order_by[index].blank?\n\n sql.push( \"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)}\" )\n end\n\n if sql.blank?\n sql.push(\"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(default)}\")\n end\n\n sql.join(', ')\n end", "def order_by\n if params[:order_by]\n if params[:order_by] == 'created_at'\n # If created at, get newest first\n params[:order_by] + ' DESC'\n else\n # Otherwise, get closest to now\n params[:order_by] + ' ASC'\n end\n else\n # Default to start date, ascending\n 'starts_at ASC'\n end\n end" ]
[ "0.75010216", "0.7099373", "0.68840533", "0.67797357", "0.67084724", "0.66659886", "0.6641338", "0.65924454", "0.6576974", "0.65731865", "0.6567868", "0.6567868", "0.6567868", "0.64731634", "0.64426976", "0.6419537", "0.64078844", "0.6319218", "0.62645566", "0.6216829", "0.6180314", "0.6141831", "0.6092047", "0.6091275", "0.60811895", "0.60573673", "0.603424", "0.60293275", "0.60242605", "0.60188967", "0.6015674", "0.600983", "0.6003395", "0.6001929", "0.5940977", "0.58820283", "0.5868588", "0.58678705", "0.5863984", "0.5839087", "0.5834002", "0.58329463", "0.58308727", "0.5826446", "0.5826446", "0.58122355", "0.57973814", "0.57690316", "0.5737156", "0.5734036", "0.56752735", "0.5661411", "0.56550103", "0.56383866", "0.56334436", "0.5628384", "0.5618907", "0.56179047", "0.56113034", "0.56026644", "0.5593163", "0.5588336", "0.5585069", "0.5583332", "0.5579523", "0.55710745", "0.5556421", "0.55467445", "0.5542856", "0.5536856", "0.5533731", "0.5528672", "0.5520747", "0.55206823", "0.5491657", "0.54891783", "0.54870594", "0.5465434", "0.54483324", "0.54462117", "0.54443777", "0.5443214", "0.543669", "0.5426209", "0.54050165", "0.53999233", "0.5397292", "0.5393776", "0.5384187", "0.53719497", "0.5352938", "0.5347387", "0.5342268", "0.5336281", "0.5322254", "0.5313754", "0.53087837", "0.5306027", "0.5297403", "0.5295079" ]
0.7313954
1
Eventhough there is no mapping here we add the interface for consistency.
def limit(criteria, relation) return relation unless criteria.limit? relation.limit(criteria.limit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface; end", "def interface; end", "def extended_interfaces; end", "def implementation; end", "def implementation; end", "def implemented_in; end", "def included_interfaces; end", "def interface_methods; end", "def interface_cache; end", "def private; end", "def interface; self.class.interface; end", "def interface=(_arg0); end", "def map\n raise NotImplementedError\n end", "def protocol\n raise NotImplementedError\n end", "def define_mapping\n fail NotImplementedError, \" Error: the subclass #{self.class} needs \" \\\n \"to implement the method: define_mapping from its base class\".red\n end", "def mapping; end", "def mapping; end", "def internal; end", "def map_to_interface\n Octothorpe.new(to_h)\n end", "def dispatch\n raise NotImplementedError\n end", "def interface_decls; end", "def traits; end", "def transformationinterfaceforrepl(*)\n super\n end", "def polymorphic_mappings; end", "def protocol; end", "def protocol; end", "def protocol; end", "def protocol; end", "def overrides; end", "def object\n raise NotImplementedError\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def type\n\t\traise NotImplementedError\n\tend", "def define_mapping\n # no additional parameters\n nil\n end", "def service; raise NotImplementedError; end", "def map\n end", "def wrapper; end", "def one_interface_ancestors_cache; end", "def interface_ancestors_cache; end", "def map\n end", "def map\n end", "def protocol\n super\n end", "def provide\n raise NotImplementedError\n end", "def call\n raise NotImplementedError\n end", "def call\n raise NotImplementedError\n end", "def map\n\n end", "def resolver; end", "def implementation=(implementation); end", "def typify(api_map); end", "def proxy\n super\n end", "def custom; end", "def custom; end", "def implements()\n return %i[on_collection on_step on_step_end on_phrase on_source]\n end", "def definition\n super\n end", "def definition\n super\n end", "def registry; end", "def registry; end", "def delegating_method; end", "def commence\n raise NotImplementedError\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def to_slot( _ )\n raise \"Not implemented for #{self}\"\n end", "def map_name; end", "def map\n self\n end", "def abstract!; end", "def methods() end", "def apply\n raise NotImplementedError\n end", "def refinement\n raise NotImplementedError\n end", "def map; end", "def type\n\t\t\traise NotImplementedError\n\t\tend", "def type; super; end", "def init\n raise NotImplementedError\n end", "def abstract?; end", "def internal_methods; end", "def visit_upgrade\n raise NotImplementedError, 'This is an interface'\n end", "def reflection; end", "def reflection; end", "def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end", "def virtual; end", "def add_accessors_to( packet )\r\n raise NotImplementedError\r\n end", "def call\n raise NotImplementedError\n end", "def map_proxy_state\n super\n end", "def binder; end", "def binder; end", "def run; raise NotImplementedError; end", "def run; raise NotImplementedError; end", "def delegate_method; end", "def map\n self\n end", "def get_type; raise NotImplementedError end", "def subtype; end", "def registers; end", "def realize_self\n raise NotImplementedError\n end", "def map\n raise \"Do not call me when inspecting!\"\n end", "def reflector; end" ]
[ "0.7398163", "0.7398163", "0.69439346", "0.6828789", "0.6828789", "0.6798203", "0.6726874", "0.6680803", "0.66495556", "0.65726215", "0.65630645", "0.6488888", "0.6428369", "0.6422376", "0.64166355", "0.6409539", "0.6409539", "0.6286831", "0.61982375", "0.61192346", "0.61124027", "0.60543096", "0.6053066", "0.6050122", "0.6042589", "0.6042589", "0.6042589", "0.6042589", "0.5985776", "0.5956495", "0.5939996", "0.5939996", "0.5939996", "0.5939996", "0.59368163", "0.59368163", "0.59368163", "0.59286565", "0.5911959", "0.586822", "0.5865913", "0.5865166", "0.58566815", "0.5831781", "0.58303267", "0.58303267", "0.5829737", "0.58258474", "0.5790327", "0.5790327", "0.5782382", "0.57809633", "0.57418376", "0.5738752", "0.57364243", "0.5723326", "0.5723326", "0.57124144", "0.57101077", "0.57101077", "0.57020766", "0.57020766", "0.56988066", "0.56975853", "0.56955844", "0.56955844", "0.56955844", "0.56955844", "0.56950593", "0.569452", "0.56673557", "0.56579244", "0.5652602", "0.5649747", "0.56447905", "0.5643025", "0.5640274", "0.56384313", "0.5626628", "0.56259793", "0.56259704", "0.5618239", "0.5599875", "0.5599875", "0.55969816", "0.55958146", "0.55675125", "0.55660325", "0.55531275", "0.55417484", "0.55417484", "0.5540169", "0.5540169", "0.5539413", "0.55355626", "0.5530533", "0.5516406", "0.55163926", "0.55163187", "0.55161613", "0.5498475" ]
0.0
-1
Creates a new EOTSocketWrapper around a socket
def initialize(socket) @socket = socket @buf = '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_socket\n @socket = Socket.new(:INET, :DGRAM)\n @socket.connect_nonblock Socket.sockaddr_in(@port, @host)\n end", "def initialize(socket)\n @socket = socket\n end", "def initialize(socket)\n @socket = socket\n end", "def socket(address, type)\n SSocket.new(address, type)\n end", "def socket\n @socket ||= TCPSocket.new(host, port)\n end", "def open_socket()\n socket = nil\n if @socket\n socket = @socket\n else\n Timeout::timeout(@sock_timeout) { socket = TCPSocket.new(@server, @port) }\n BasicSocket.do_not_reverse_lookup = true\n end\n\n return(socket)\n end", "def initialize(socket, context = nil)\n socket = socket.respond_to?(:io) ? socket.io || socket : socket\n context ? orig_initialize(socket, context) : orig_initialize(socket)\n end", "def initialize(type, endpoint = nil, context = nil)\n @context = context || Context.instance.xs_context\n @sock = @context.socket xs_const(type)\n @endpoint = endpoint\n\n fail \"Creating socket #{type} failed\" unless @sock\n end", "def initialize_socket(uri, opts = {})\n return if opts[:socket]\n\n @socket = TCPSocket.new(uri.host, uri.port)\n opts.merge!({:socket => @socket})\n @intentional_termination = false\n end", "def socket_setup()\n ctx = { 'Msf' => self.options['Msf'], 'MsfExploit' => self.options['MsfExploit'] }\n self.socket = case self.handle.protocol\n\n when 'ncacn_ip_tcp'\n Rex::Socket.create_tcp(\n 'PeerHost' => self.handle.address,\n 'PeerPort' => self.handle.options[0],\n 'Context' => ctx,\n 'Timeout' => self.options['connect_timeout']\n )\n\n when 'ncacn_np'\n begin\n socket = Rex::Socket.create_tcp(\n 'PeerHost' => self.handle.address,\n 'PeerPort' => 445,\n 'Context' => ctx,\n 'Timeout' => self.options['connect_timeout']\n )\n rescue ::Timeout::Error, Rex::ConnectionRefused\n socket = Rex::Socket.create_tcp(\n 'PeerHost' => self.handle.address,\n 'PeerPort' => 139,\n 'Context' => ctx,\n 'Timeout' => self.options['connect_timeout']\n )\n end\n socket\n else nil\n end\n\n # Add this socket to the exploit's list of open sockets\n options['MsfExploit'].add_socket(self.socket) if (options['MsfExploit'])\n end", "def init_socket\n @socket = Sockets::MasterServerSocket.new @ip_address, @port\n end", "def create_ssl_socket(raw_socket)\n SSLSocketWrap.new(raw_socket, @ssl_config, (DEBUG_SSL ? @debug_dev : nil))\n end", "def init_socket\n @rcon_socket = RCONSocket.new @ip_address, @port\n @socket = SourceSocket.new @ip_address, @port\n end", "def create_socket\n socket = ::Socket.new(::Socket::AF_INET, ::Socket::SOCK_STREAM, 0)\n sockaddr = ::Socket.sockaddr_in(PORTS.sample, self.hostname)\n begin # emulate blocking connect\n socket.connect_nonblock(sockaddr)\n rescue IO::WaitWritable\n IO.select(nil, [socket]) # wait 3-way handshake completion\n begin\n socket.connect_nonblock(sockaddr) # check connection failure\n rescue Errno::EISCONN\n end\n end\n socket\n end", "def set_socket\r\n @socket = TCPSocket.new(@server, @port) \r\n end", "def initialize(socket)\n @socket = socket\n end", "def socket\n return @socket if @socket\n s = TCPSocket.new(host || '127.0.0.1', port || 2003) # CORRECT DEFAULT PORT?\n @socket = s\n @socket\n rescue ::SystemExit, ::Interrupt, ::SignalException\n raise\n rescue ::Exception => exc\n STDERR.puts \"#{self} socket: failed #{exc.inspect}\\n #{exc.backtrace * \"\\n \"}\"\n sleep 10\n retry\n end", "def create_socket\n if @uri.scheme == 'wss'\n create_ssl_socket.tap(&:connect)\n else\n TCPSocket.new(@uri.host, @port)\n end\n end", "def create(param)\n\t\tsock = nil\n\n\t\t# Notify handlers before we create the socket\n\t\tnotify_before_socket_create(self, param)\n\n\t\tcase param.proto\n\t\t\twhen 'tcp'\n\t\t\t\tsock = net.socket.create(param)\n\t\t\telse\n\t\t\t\traise Rex::UnsupportedProtocol.new(param.proto), caller\n\t\tend\n\n\t\t# Notify now that we've created the socket\n\t\tnotify_socket_created(self, sock, param)\n\n\t\t# Return the socket to the caller\n\t\tsock\n\tend", "def tls_socket socket\n socket = OpenSSL::SSL::SSLSocket.new socket, create_ssl_context\n socket.sync_close = true\n socket.hostname = @host unless RE_IP_ADDR.match(@host)\n socket.connect\n socket\n end", "def socket(options = {})\n @socket ||= Net::SSH::Test::Socket.new\n end", "def initialize\n # we create this particular socket connection just to keep it open\n @soc = dtnsoc\n end", "def socket=(s)\n unless(s.respond_to?(:<<))\n raise ArgumentError.new('Please supply a socket')\n end\n @socket = s\n end", "def create(param)\n\t\tsock = nil\n\n\t\t# Notify handlers before we create the socket\n\t\tnotify_before_socket_create(self, param)\n\n\t\tsock = net.socket.create(param)\n\n\t\t# sf: unsure if we should raise an exception or just return nil. returning nil for now.\n\t\t#if( sock == nil )\n\t\t# raise Rex::UnsupportedProtocol.new(param.proto), caller\n\t\t#end\n\n\t\t# Notify now that we've created the socket\n\t\tnotify_socket_created(self, sock, param)\n\n\t\t# Return the socket to the caller\n\t\tsock\n\tend", "def socket type\n sock = nil\n begin\n sock = Socket.new @context, type\n rescue ContextError => e\n sock = nil\n end\n\n sock\n end", "def real_connect(*args)\n super(*args)\n @fd = socket\n @io = IO.new(socket)\n end", "def socket; @socket; end", "def socket(type, opts={})\n opts[:context] = self\n ZMQ::Socket.new type, opts\n end", "def create_ssl_socket\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.set_params ssl_version: :TLSv1_2\n\n socket = TCPSocket.new(@uri.host, @port)\n OpenSSL::SSL::SSLSocket.new(socket, ctx)\n end", "def wrap s\n raise \"already wrapped a socket!\" if @socket\n @socket = s\n\n if defined? OpenSSL::SSL::SSLSocket and s.is_a? OpenSSL::SSL::SSLSocket\n @descr = s.io.remote_address.inspect_sockaddr\n else\n @descr = s.remote_address.inspect_sockaddr\n end\n\n @sil = FrameSerialiser.new {|b|\ncyan \"@sil: _write #{hex b}\"\n_write s, b rescue nil }\n @dsil = FrameDeserialiser.new do |f|\n begin\nbrown \"dsil: received #{frm f}\"\n @hook << f\n rescue ConnectionError => e\n @logger.info \"connection error [#{e.code}:#{e}] in client #{@descr} {1}\"\n die e.code\n end\n end\n\n handle_prefaces s\n send_frame Settings.frame_from(initial_settings), true\n\n loop do\n bytes = begin\n s.readpartial(4*1024*1024)\n rescue EOFError\n nil\n rescue IOError, Errno::ECONNRESET\n raise unless s.closed?\n end\n if bytes.nil? or bytes.empty?\n @logger.info \"client disconnected from #{@descr}\"\n break\n end\nred \"read #{hex bytes}\"\n @dsil << bytes\n Thread.pass\n end\n rescue ConnectionError => e\n @logger.info \"connection error [#{e.code}:#{e}] in client #{@descr} {2}\"\n die e.code\n ensure\n _close_socket\n end", "def socket\n @socket ||= ::UDPSocket.new\n end", "def socket\n if !block_given?\n if @cached_socket != nil\n return @cached_socket\n end\n return @cached_socket = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:socket, []).call(),::Vertx::NetSocket)\n end\n raise ArgumentError, \"Invalid arguments when calling socket()\"\n end", "def from_socket(socket)\n ensure_state :disconnected\n raise TypeError, \"expected #{@socket_class}, got #{socket.class}\" unless socket.is_a?(@socket_class)\n @socket = socket\n @state = :connected\n\n self\n end", "def socket\n throw Exception(\"socket must be implemented\")\n end", "def sockopen(host, port)\n socket = nil\n msg = nil\n timeout = 5.0\n socket = turbina_timeout(timeout, proc {TCPSocket.open(host, port)})\n return socket\n end", "def attach_socket output_socket\n @socket = output_socket\n end", "def initialize( * )\n\t\t@socket = UDPSocket.new\n\tend", "def establish_socket_server\n @socket_server = Uninterruptible::Binder.new(server_configuration.bind).bind_to_socket\n\n if server_configuration.tls_enabled?\n @socket_server = Uninterruptible::TLSServerFactory.new(server_configuration).wrap_with_tls(@socket_server)\n end\n @socket_server\n end", "def initialize(socket)\n @socket = socket\n @closed = false\n end", "def open_socket()\n used_socket = @ssl ? open_ssl_socket : open_tcp_socket\n # try to close the old connection if any\n close_socket\n\n @closed = false\n if @parameters # nil in some rspec tests\n unless @reconnect_delay\n @reconnect_delay = @parameters[:initial_reconnect_delay] || iosto1\n end\n end\n # Use keepalive\n used_socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)\n\n # TCP_NODELAY option (disables Nagle's algorithm)\n used_socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, !!(@parameters && @parameters[:tcp_nodelay]))\n\n @iosto = @parse_timeout ? @parse_timeout.to_f : 0.0\n\n used_socket\n end", "def new_socket sock\n #\n # allocate some memory for a new socket if\n # there is no free socket in the free_list\n sock_new = SockDesc.new sock\n\n # attach the new connection to the socket list\n $fSet << sock\n\n # set the socket as non-blocking\n sock.fcntl Fcntl::F_SETFL, Fcntl::O_NONBLOCK unless RUBY_PLATFORM =~ /win32/\n\n # update the linked list of sockets\n $dsock_list << sock_new\n\n # send the greeting\n sock_new.text_to_buffer $greeting\n sock_new.text_to_buffer \"What is your name? \"\n\n # initialize socket events\n init_events_socket sock_new\n\n # everything went as it was supposed to\n return true\nend", "def open_socket(host, domain = nil, timeout = 5, port = 22, &_block)\n Timeout.timeout(timeout) do\n target_host = host\n target_host = \"#{host}.#{domain}\" if domain\n sock = TCPSocket.new target_host, port\n begin\n yield sock if block_given?\n ensure\n sock.close\n end\n end\n end", "def socket #:nodoc:\n return @socket\n end", "def make_persistent!(socket)\n unless socket == @socket\n close_persistent!\n @socket = socket\n end\n @socket\n end", "def setup_socket\n self.socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)\n address = Socket.pack_sockaddr_in(@options[:port], @options[:host])\n socket.bind(address)\n socket.listen(@options[:max_connection_queue])\n log.info(\"Listening on #{@options[:host]}:#{@options[:port]}\")\n end", "def checkout_new_socket\n begin\n socket = TCPSocket.new(@host, @port)\n socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)\n rescue => ex\n raise ConnectionFailure, \"Failed to connect socket: #{ex}\"\n end\n @sockets << socket\n @checked_out << socket\n socket\n end", "def initialize(\n read_timeout: Socketry::Timeout::DEFAULT_TIMEOUTS[:read],\n write_timeout: Socketry::Timeout::DEFAULT_TIMEOUTS[:write],\n timer: Socketry::Timeout::DEFAULT_TIMER.new,\n resolver: Socketry::Resolver::DEFAULT_RESOLVER,\n socket_class: ::Socket\n )\n @state = :disconnected\n\n @read_timeout = read_timeout\n @write_timeout = write_timeout\n\n @socket_class = socket_class\n @resolver = resolver\n @addr_family = nil\n @socket = nil\n\n @remote_host = nil\n @remote_addr = nil\n @remote_port = nil\n @local_addr = nil\n @local_port = nil\n\n start_timer timer\n end", "def initialize(domain, type, protocol)\n @descriptor = Winsock.socket(domain, type, protocol)\n SocketError.check if @descriptor == -1\n return @descriptor\n end", "def to_io\n socket\n end", "def checkout_new_socket(host, port)\n return nil if @all.size >= @size\n\n begin\n socket = TCPSocket.new(host, port)\n socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)\n rescue => ex\n raise ConnectionFailure, \"Failed to connect to host #{@host} and port #{@port}: #{ex}\"\n end\n\n # If any saved authentications exist, we want to apply those\n # when creating new sockets.\n @connection.apply_saved_authentication(:socket => socket)\n\n socket\n end", "def get_transporter\n TCPSocket.open(@host, @port)\n end", "def socket\n @socket\n end", "def initialize(socket, *args)\n raise TypeError.new(\"#{socket.inspect} is not a valid ZMQ::Socket instance\") unless ZMQ::Socket === socket\n @socket = socket\n end", "def socket\n return @sock if @sock and not @sock.closed?\n\n @sock = nil\n\n # If the host was dead, don't retry for a while.\n return if @retry and @retry > Time.now\n\n # Attempt to connect if not already connected.\n begin\n @sock = connect_to(@host, @port, @timeout)\n @sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1\n @retry = nil\n @status = 'CONNECTED'\n rescue Errno::EPIPE, Errno::ECONNREFUSED => e\n puts \"Socket died... socket: #{@sock.inspect}\\n\" if $debug\n @sock.close\n retry\n rescue SocketError, SystemCallError, IOError => err\n puts \"Unable to open socket: #{err.class.name}, #{err.message}\" if $debug\n mark_dead err\n end\n\n return @sock\n end", "def create_outbound_tcp_socket\n label = \"#{@remote_host}:#{@remote_port}\"\n if @proxy_url\n log.info(\"Connecting to #{label} through proxy #{@proxy_url}\")\n\n popts = {}\n popts[:user_agent] = ENV['HTTP_USER_AGENT'] if ENV['HTTP_USER_AGENT']\n\n if popts[:user_agent]\n log.debug('Passing User-Agent: ' + popts[:user_agent].inspect)\n end\n\n @proxy = Proxifier::Proxy(@proxy_url, popts)\n tcp_socket = @proxy.open(@remote_host, @remote_port)\n else\n log.info(\"Connecting to #{label}\")\n tcp_socket = TCPSocket.new(@remote_host, @remote_port)\n end\n\n if @use_ssl\n create_ssl_socket(tcp_socket, @ssl_opts)\n else\n tcp_socket\n end\n end", "def create_server_socket\n if @hostname\n s = TCPServer.open(@hostname, @port)\n else\n s = TCPServer.open(@port)\n end\n @port = s.addr[1]\n\n s.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n\n return s\n end", "def cork_socket(socket); end", "def initialize(socket)\n @socket = socket\n @socket.onmessage(&method(:trigger_on_message))\n @socket.onclose(&method(:trigger_on_close))\n end", "def initialize( socket, server )\n\t\t@socket = socket\n\t\t@server = server\n\t\t@obuffer = ''\n\t\t@ibuffer = ''\n\t\t@peerHost = @socket.peeraddr[2]\n\t\t@peerPort = @socket.peeraddr[1]\n\t\t@connected = true\n\tend", "def to_io\n IO.try_convert(@socket) || @socket\n end", "def socket\n if !block_given?\n if @cached_socket != nil\n return @cached_socket\n end\n return @cached_socket = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:socket, []).call(),::VertxWeb::SockJSSocket)\n end\n raise ArgumentError, \"Invalid arguments when calling socket()\"\n end", "def initialize_abstraction\n self.lsock, self.rsock = Rex::Socket.udp_socket_pair\n end", "def create_socket\n\t\tiaddr = self.class.bind_addr\n\t\tsocket = UDPSocket.new\n\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_ADD_MEMBERSHIP, iaddr )\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_MULTICAST_TTL, self.class.multicast_ttl )\n\t\tsocket.setsockopt( :IPPROTO_IP, :IP_MULTICAST_LOOP, 1 )\n\t\tsocket.setsockopt( :SOL_SOCKET, :SO_REUSEPORT, 1 )\n\n\t\treturn socket\n\tend", "def initialize(domain, type, protocol)\r\n SocketError.check if (@fd = Winsock.socket(domain, type, protocol)) == -1\r\n @fd\r\n end", "def to_io\n return @socket\n end", "def socket; end", "def socket; end", "def socket; end", "def socket; end", "def socket; end", "def socket()\n #This is a stub, used for indexing\n end", "def get_socket(host, port, timeout, error)\n\n begin\n\n addr = Socket.getaddrinfo(host, nil)\n\n if addr.nil?\n return\n end\n\n sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)\n\n if timeout\n secs = Integer(timeout)\n usecs = Integer((timeout - secs) * 1_000_000)\n optval = [secs, usecs].pack(\"l_2\")\n sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval)\n sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval)\n end\n\n sock.connect(Socket.pack_sockaddr_in(port, addr[0][3]))\n return sock\n\n rescue Exception => e\n error = e.message\n return nil\n end\n\n\tend", "def initialize( socket, server )\n\t\t@socket = socket\n\t\t@server = server\n\t\t@obuffer = ''\n\t\t@ibuffer = ''\n\t\t@peer_host = @socket.peeraddr[2]\n\t\t@peer_port = @socket.peeraddr[1]\n\t\t@connected = true\n\tend", "def initialize(sock_type,address,sock_ctype)\n @context = ZMQ::Context.new(1)\n @socket = @context.socket(sock_type)\n if sock_ctype == :bind\n @socket.bind(address)\n else\n @socket.connect(address)\n end\n end", "def initialize(app, socket, options = {})\n @app = app\n @socket = socket\n @options = options\n @debug = options[:debug] || false\n @ssl = socket.backend.respond_to?(:ssl?) && socket.backend.ssl?\n\n socket.websocket = self\n socket.comm_inactivity_timeout = 0\n\n debug [:initialize]\n end", "def initialize(host='127.0.0.1')\n @sock = Socket.new(:INET, :STREAM)\n @sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n @sock.bind(Socket.sockaddr_in(0, host))\n @host, @port = @sock.connect_address.ip_unpack\n @addr = \"#{@host}:#{@port}\"\n if block_given?\n begin\n yield self\n ensure\n close\n end\n end\n end", "def init_socket\n @socket.close if @socket\n retry_count = 0\n begin\n @logger.info(\"[MSGPACK-RPC] Connecting to Msgpack-RPC server...\") if @logger\n @socket = TCPSocket.new(host, port)\n configure_socket_keepalive\n init_ssl if use_ssl\n rescue Errno::ECONNREFUSED\n @logger.error(\"[MSGPACK-RPC] Connection refused\") if @logger\n retry_count += 1\n if retry_count == max_connect_retries\n raise MsgpackRpcClient::Error, \"Could not connect to MsgPack-RPC server\"\n else\n sleep(connect_retry_wait)\n # might have a chance with a different instance\n retry\n end\n end\n # Attach streaming packer/unpacker to the socket\n @packer = MessagePack::Packer.new(@socket)\n @unpacker = MessagePack::Unpacker.new(@socket, symbolize_keys: true)\n end", "def inherit_socket; end", "def setup_socket\n ctx = setup_certificate\n\n APN.log(:debug, \"Connecting to #{@host}:#{@port}...\")\n\n socket_tcp = TCPSocket.new(@host, @port)\n OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|\n s.sync = true\n s.connect\n end\n end", "def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end", "def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end", "def initialize(socket, logger, timeout = T.unsafe(nil)); end", "def socket\n return @socket if @socket\n linger = @heartbeat_timeout * 1000\n pubkey = Directory[@id].pubkey\n @socket = ClientServer.new @addr, linger, pubkey\n @socket.farewell = farewell\n transition :connected\n @socket\n end", "def configure_socket(options, env)\n bind = request_options(env)[:bind]\n return unless bind\n\n options[:bind] = {\n host: bind[:host],\n port: bind[:port]\n }\n end", "def mock_socket(ip,port)\n addr = [\"\",port,ip.split('.')]\n sock = stub(\"client socket\")\n peername = stub(\"peer name\")\n sock.stubs(:getpeername).returns(peername)\n peername.stubs(:unpack).returns(addr)\n sock\n end", "def initialize(app, socket, options = {})\n @app = app\n @socket = socket\n @options = options\n @debug = options[:debug] || false\n @ssl = socket.backend.respond_to?(:ssl?) && socket.backend.ssl?\n\n socket.websocket = self\n socket.comm_inactivity_timeout = 0\n\n debug [:initialize]\n end", "def initialize(type, opts={})\n @type = type\n @raw_socket = create_raw_socket(type)\n @linger = opts.fetch(:linger, 0)\n @retries = opts.fetch(:retries, 3)\n @timeout = opts.fetch(:timeout, 10)\n self.raw_socket.identity = opts[:identity]\n at_exit do\n self.close\n end\n log('initialized')\n end", "def initialize(socket)\r\n @socket = socket\r\n @params = {}\r\n\r\n parse_params\r\n end", "def connect(socket_class, host, port, nodelay = T.unsafe(nil)); end", "def initialize (socket, team)\n @socket = socket\n @team = team\n end", "def create_client_socket\n\t\tself.log.debug \"Creating a CLIENT socket bound to: %s\" % [ self.server ]\n\t\tsock = CZTop::Socket::CLIENT.new\n\n\t\tclient_cert = Assemblage::Auth.local_cert\n\t\tserver_cert = Assemblage::Auth.remote_cert( 'server' )\n\n\t\tself.log.debug \"Connecting with %p and %p\" % [ client_cert, server_cert ]\n\t\tsock.CURVE_client!( client_cert, server_cert )\n\t\tsock.connect( self.server )\n\n\t\treturn sock\n\tend", "def obtain_socket(uri)\n socket = TCPSocket.new(uri.host, uri.port || socket_port(uri))\n\n if secure_uri?(uri)\n ctx = OpenSSL::SSL::SSLContext.new\n\n if ENV['DISCORDRB_SSL_VERIFY_NONE']\n ctx.ssl_version = 'SSLv23'\n ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE # use VERIFY_PEER for verification\n\n cert_store = OpenSSL::X509::Store.new\n cert_store.set_default_paths\n ctx.cert_store = cert_store\n else\n ctx.set_params ssl_version: :TLSv1_2 # rubocop:disable Naming/VariableNumber\n end\n\n socket = OpenSSL::SSL::SSLSocket.new(socket, ctx)\n socket.connect\n end\n\n socket\n end", "def initialize(socket, opts = {})\n @socket = socket\n @verb = @resource = @version = @code = @message = @request = nil\n @content = ''\n @content_length = nil\n @headers = []\n @transfer_encodings = []\n @is_server = opts[:is_server]\n @logger = opts[:logger]\n end", "def socket\n connect unless connected?\n @ssl_sock\n end", "def get_socket\n sock = UDPSocket.new\n sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)\n\n count = 0\n bound = false\n begin\n port = rand(2 ** 16 - 1024) + 1024\n debug \"Attempting to bind to #{@listen_ip}:#{port}\"\n sock.bind(@listen_ip, port)\n bound = true\n rescue \n warn \"Failed to bind to #{@listen_ip}:#{port}\"\n if count < MaxBindAttempts\n count += 1\n redo\n end\n end\n\n if bound\n info \"Handler #{@key} bound to #{@listen_ip} on port #{port}\"\n else\n raise TftpError, \"Can't seem to find a spare port to bind to.\"\n end\n\n return sock\n end", "def proxified_socket(host, port)\n proxy = ENV[\"https_proxy\"] || ENV[\"http_proxy\"] || false\n\n if proxy && !fuzzy_hostname_match_any?(host, ENV[\"no_proxy\"])\n Proxifier.Proxy(proxy).open(host, port)\n else\n TCPSocket.new(host, port)\n end\n end", "def add_socket(sock)\n self.sockets << sock\n end", "def initialize(remote_host, remote_port, local_host = nil, local_port = nil)\n @host, @port = remote_host, remote_port\n handle_socket_errors do\n socket = TCPSocket.new(remote_host, remote_port, local_host, local_port)\n super(socket)\n to_io.sync_close = true\n connect\n end\n end", "def default_socket_class=(_arg0); end", "def initialize(uri, soc, config={})\n @uri = uri\n @socket = soc\n @config = config\n @acl = config[:tcp_acl]\n @msg = DRbMessage.new(config)\n set_sockopt(@socket)\n end" ]
[ "0.6944357", "0.6882511", "0.6882511", "0.687172", "0.68658364", "0.68256104", "0.6817308", "0.6766037", "0.67635745", "0.6750334", "0.67347884", "0.671933", "0.6696477", "0.6682419", "0.6666936", "0.6605963", "0.65808684", "0.6578559", "0.6574825", "0.65638435", "0.65493625", "0.65379936", "0.6519747", "0.65188485", "0.645079", "0.6429541", "0.6411267", "0.64079136", "0.63866186", "0.63750976", "0.63694257", "0.6359479", "0.6323555", "0.6311833", "0.63085914", "0.6276032", "0.62743735", "0.6270907", "0.62685823", "0.6244096", "0.6233023", "0.6232873", "0.6224806", "0.62236476", "0.61841273", "0.6182708", "0.6149836", "0.6140537", "0.61370546", "0.613593", "0.6126683", "0.6123898", "0.6103796", "0.6072032", "0.6070024", "0.6065055", "0.606126", "0.6054749", "0.6022051", "0.6016456", "0.5997431", "0.59968865", "0.5989826", "0.59834856", "0.59685695", "0.5944647", "0.5944647", "0.5944647", "0.5944647", "0.5944647", "0.59368175", "0.5935401", "0.5930529", "0.5929129", "0.592486", "0.59246683", "0.59054196", "0.5896131", "0.5893777", "0.58919626", "0.58919626", "0.58835536", "0.5881385", "0.58669794", "0.5866367", "0.5851921", "0.58331734", "0.5823647", "0.5819983", "0.5816963", "0.58065826", "0.58003855", "0.57966816", "0.57863224", "0.5785137", "0.57809615", "0.5766293", "0.57662565", "0.57469726", "0.5737275" ]
0.62662816
39
Reads from the socket until an EOT is found Extra characters may be read from the socket, but they are kept in a buffer to be used with the next call to read_until_eot(). If there is a gap in transmission longer than the timeout, nil will be returned. The total time spent waiting for data may be longer than the timeout. If the timeout is nil, the read will never time out.
def read_until_eot(timeout) #Read until eot or timeout. eot_index = @buf.index("\004") received = nil gotMessage = nil #Do we already have a message ready? unless eot_index #Read until EOT or timeout while gotMessage = IO.select([@socket], nil, nil, timeout) do received = @socket.readpartial(1024) rescue nil break unless received eot_index = received.index("\004") @buf << received if eot_index eot_index += @buf.length - received.length break end end #If we didn't find an EOT, return nil. return nil unless eot_index end message = @buf[0 ... eot_index] @buf = @buf[eot_index + 1 .. -1] return message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read timeout = DEFAULT_READ_TIMEOUT\n return @responses.shift unless @responses.empty?\n\n results = select([ @socket ], nil, nil, timeout)\n\n @buff += @socket.recv(4 * 1024) if (results and results[0].include? @socket) # results nil on timeout\n\n if @buff =~ /^(.*\\r\\n)(.*)$/m # network responses can split at odd boundries; check for completed messages ending with \\r\\n.\n @buff = $2 # save potential partial response for later..\n @responses += $1.split(/\\r\\n/) # and sock away all of the completed responses\n end\n\n @responses.shift # return next queued message or nil if we've timed out\n end", "def timed_read( length=65535, timeout=def_read_timeout )\n\t\tresult = ''\n\n\t\tbegin\n\t\t\tTimeout.timeout( timeout ) {\n\t\t\t\twhile( true )\n\t\t\t\t\tif( @datagrams.empty? )\n\t\t\t\t\t\tRex::ThreadSafe.sleep( 0.2 )\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t\tresult = self.read( length )\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t}\n\t\trescue Timeout::Error\n\t\t\tresult = ''\n\t\tend\n\n\t\treturn result\n\tend", "def read_until_eof(timeout) #:nodoc:\n read_until(timeout){@eof_found}\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 readWithTimeout(socket, length, timeout)\n rc = IO.select([socket], nil, nil, timeout)\n if ! rc\n raise \"Waiting for response from UDP tracker #{@host}:#{@trackerPort} timed out after #{@timeout} seconds\"\n elsif rc[0].size > 0\n socket.recvfrom(length)[0]\n else\n raise \"Error receiving response from UDP tracker #{@host}:#{@trackerPort}\"\n end\n end", "def timed_read(length = 65535, timeout=def_read_timeout)\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and (rv[0][0] == fd)\n )\n return read(length)\n else\n return ''\n end\n rescue Exception\n return ''\n end\n end", "def read_wait(timeout: nil)\n !!IO.select([io], [], [], timeout)\n end", "def wait_for_data(timeout)\n return if timeout == -1\n\n ready = false\n begin\n ready = IO.select([self], nil, [self], timeout)\n rescue IOError => exception\n logger.warn \"#read Connection failure while waiting for data: #{exception.class}: #{exception.message}\"\n close if close_on_error\n raise Net::TCPClient::ConnectionFailure.new(\"#{exception.class}: #{exception.message}\", address.to_s, exception)\n rescue Exception\n # Close the connection on any other exception since the connection\n # will now be in an inconsistent state\n close if close_on_error\n raise\n end\n\n unless ready\n close if close_on_error\n logger.warn \"#read Timeout after #{timeout} seconds\"\n raise Net::TCPClient::ReadTimeout.new(\"Timedout after #{timeout} seconds trying to read from #{address}\")\n end\n end", "def read_timeout(timeout = nil)\n timeout.nil? ? @read_timeout || DEFAULT_READ_TIMEOUT : @read_timeout = timeout\n end", "def timed_read(length = nil, wait = def_read_timeout, opts = {})\n if (wait and wait > 0)\n Timeout.timeout(wait) {\n return read(length, opts)\n }\n else\n return read(length, opts)\n end\n end", "def read_till(prompt: current_prompt, timeout: read_till_timeout, hard_timeout: read_till_hard_timeout, hard_timeout_factor: read_till_hard_timeout_factor, **_opts)\n raise Error::UndefinedMatch, 'no prompt given or default_prompt defined' unless prompt\n hard_timeout = (read_till_hard_timeout_factor * timeout) if timeout and hard_timeout == true\n hard_timeout = nil if hard_timeout == true\n\n with_prompt(prompt) do\n ::Timeout.timeout(hard_timeout, Error::ReadTillTimeout, \"#{current_prompt.inspect} didn't match on #{stdout.inspect} within #{hard_timeout}s\") do\n soft_timeout = Time.now + timeout if timeout\n until prompt_in_stdout? do\n if timeout and soft_timeout < Time.now\n raise Error::ReadTillTimeout, \"#{current_prompt.inspect} didn't match on #{stdout.inspect} within #{timeout}s\"\n end\n process\n sleep 0.01 # don't race for CPU\n end\n end\n end\n read\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_data_available?(timeout = 0)\n (rh, wh, eh) = IO::select([@io], nil, nil, timeout)\n ! rh.nil?\n end", "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 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 recvall(timeout: nil)\n recvn(1 << 63, timeout: timeout)\n rescue ::Pwnlib::Errors::EndOfTubeError, ::Pwnlib::Errors::TimeoutError\n @buffer.get\n end", "def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end", "def read(timeout = TIMEOUT, str = \"\")\n while true\n Timeout::timeout(timeout) do\n str << output.readline\n break if output.eof?\n end\n end\n\n return str\n rescue Timeout::Error, EOFError, Errno::EIO\n return str\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_timeout\n @read_timeout\n end", "def read_timeout=(sec); end", "def receive(opts={})\n\t\ttimeout = opts.fetch(:timeout, 40).to_i\n\t\twait_for_null = opts.fetch(:wait_for_null, true)\n\t\t\n\t\tresponse = \"\"\n\t\t\n\t\t# Wait for data to become available on the socket\n\t\tres = select([@sock], nil, nil, timeout)\n\t\tif (res == nil)\n\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\tend\n\t\t\n\t\tif (wait_for_null)\n\t\t\tbegin\n\t\t\t\ttimeout(timeout) {\n\t\t\t\t\tresponse = @sock.gets(\"\\0\")\n\t\t\t\t}\n\t\t\trescue Timeout::Error\n\t\t\t\traise \"Timeout waiting for reader response.\" if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\tresponse.strip!\n\t\t\t\n\t\t\tif response.include? \"Error\"\n\t\t\t\traise response if @raise_errors\n\t\t\tend\n\t\t\t\n\t\t\t# If this is a response to a Quit command, the reader will close the socket. \n\t\t\t# If there is an active connection, the reader will reject our attempt to connect.\n\t\t\t# Either way, we're not connected anymore...\n\t\t\tif (response.include? \"Goodbye!\")\n\t\t\t\tclose(false)\n\t\t\tend\n\t\t\t\n\t\t\treturn response\n\t\telse\n\t\t\t# Simply try to read up to 1 kB and return it (no timeout)\n\t\t\treturn @sock.recv(1024)\n\t\tend\n\tend", "def recvfrom(maxlen, timeout: @read_timeout)\n set_timeout(timeout)\n\n begin\n while (result = recvfrom_nonblock(maxlen)) == :wait_readable\n next if @socket.wait_readable(time_remaining(timeout))\n\n raise Socketry::TimeoutError, \"recvfrom timed out after #{timeout} seconds\"\n end\n ensure\n clear_timeout(timeout)\n end\n\n result\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 ping_reply(timeout = 1.0)\n\t\tloop do\n\t\t\tst = Time.now.to_f\n\t\t\tact = select([@sock], [], [@sock], timeout)\n\t\t\treturn nil if !act or act.first.empty?\n\t\t\tpkt = @sock.recv(1514)\n\t\t\ticmp = icmp_offset(pkt)\n\t\t\treturn pkt if icmp and pkt[icmp] == \"\\x00\"\n\t\t\ttimeout = timeout - Time.now.to_f + st\n\t\t\treturn nil if timeout <= 0\n\t\tend\n\tend", "def ping_reply(timeout = 1.0)\n\t\tloop do\n\t\t\tst = Time.now.to_f\n\t\t\tact = select([@sock], [], [@sock], timeout)\n\t\t\treturn nil if !act or act.first.empty?\n\t\t\tpkt = @sock.recv(1514)\n\t\t\ticmp = icmp_offset(pkt)\n\t\t\treturn pkt if icmp and pkt[icmp] == \"\\x00\"\n\t\t\ttimeout = timeout - Time.now.to_f + st\n\t\t\treturn nil if timeout <= 0\n\t\tend\n\tend", "def timedout_read(duration)\n begin \n timeout(duration) do\n @sock.wait_readable\n end\n rescue Celluloid::TaskTimeout\n return true\n end\n false\n end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def recvmsg(timeout=@timeout)\n if select([@socket], nil, nil, timeout)\n mesg, sender, _, _ = @socket.recvmsg\n raise EOFError unless mesg\n sender = sender.to_sockaddr if sender.respond_to? :to_sockaddr\n NLSocket.check_sockaddr(sender)\n mesg\n else\n raise \"Timeout\"\n end\n end", "def readable?(timeout)\n readable, writable, errors = IO.select([@socket], nil, nil, timeout)\n return !readable.nil?\n end", "def wait_readable(timeout = nil)\n return self if @read_buffer && !@read_buffer.empty?\n\n if timeout\n move_on_after(timeout) do\n Polyphony.backend_wait_io(self, false)\n self\n end\n else\n Polyphony.backend_wait_io(self, false)\n self\n end\n end", "def read_response(timeout=nil)\n end_time = Time.now.to_f + timeout if timeout\n head = timed_recv(socket, 12, timeout)\n magic, type, len = head.unpack('a4NN')\n raise ProtocolError, \"Invalid magic '#{magic}'\" unless magic == \"\\0RES\"\n buf = len > 0 ?\n timed_recv(socket, len, timeout ? end_time - Time.now.to_f : nil) : ''\n type = Packet::COMMANDS[type]\n raise ProtocolError, \"Invalid packet type #{type}\" unless type\n [type, buf]\n end", "def read_data(read_timeout = self.timeout)\n buf = read_buffer(read_timeout)\n return {'Error' => \"Socket closed\"} if buf.nil?\n return if buf.empty?\n parse_package(buf)\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_next_event\n\t\tself.log.debug \"Reading next event.\"\n\t\tdata = @socket.recv_nonblock( MAX_EVENT_BYTES, exception: false )\n\n\t\tif data == :wait_readable\n\t\t\tIO.select( [@socket], nil, nil, LOOP_TIMER )\n\t\t\treturn nil\n\t\telsif data.empty?\n\t\t\treturn nil\n\t\telse\n\t\t\tself.log.info \"Read %d bytes\" % [ data.bytesize ]\n\t\t\treturn JSON.parse( data )\n\t\tend\n\tend", "def recvuntil(delims, drop: false, timeout: nil)\n delims = Array(delims)\n max_len = delims.map(&:size).max\n @timer.countdown(timeout) do\n data = Buffer.new\n matching = +''\n begin\n while @timer.active?\n s = recv(1)\n\n return '' if s.empty?\n\n matching << s\n\n sidx = matching.size\n match_len = 0\n delims.each do |d|\n idx = matching.index(d)\n next unless idx\n\n if idx + d.size <= sidx + match_len\n sidx = idx\n match_len = d.size\n end\n end\n\n if sidx < matching.size\n r = data.get + matching.slice!(0, sidx + match_len)\n r.slice!(-match_len..-1) if drop\n return r\n end\n\n data << matching.slice!(0...-max_len) if matching.size > max_len\n end\n ''\n ensure\n unrecv(matching)\n unrecv(data)\n end\n end\n end", "def read_timeout=(_arg0); end", "def read_timeout=(_arg0); end", "def read_timeout=(_arg0); 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 ping_reply(timeout = 1.0)\n loop do\n st = Time.now.to_f\n act = select([@sock], [], [@sock], timeout)\n return nil if !act or act.first.empty?\n pkt = @sock.recv(1514)\n icmp = icmp_offset(pkt)\n return pkt if icmp and pkt[icmp] == \"\\x00\" # type = Echo Reply\n timeout = timeout - Time.now.to_f + st\n return nil if timeout <= 0\n end\n end", "def read_timeout\n timeout_from_env = ENV[\"CHEF_API_READ_TIMEOUT\"] || config[\"CHEF_API_READ_TIMEOUT\"]\n\n Integer(timeout_from_env) unless timeout_from_env.nil?\n end", "def read_timeout\n @agent.read_timeout\n end", "def has_read_data?(timeout = nil)\n\n # Allow a timeout of \"0\" that waits almost indefinitely for input, this\n # mimics the behavior of Rex::ThreadSafe.select() and fixes some corner\n # cases of unintentional no-wait timeouts.\n timeout = 3600 if (timeout and timeout == 0)\n\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and\n (rv[0][0] == fd))\n true\n else\n false\n end\n rescue ::Errno::EBADF, ::Errno::ENOTSOCK\n raise ::EOFError\n rescue StreamClosedError, ::IOError, ::EOFError, ::Errno::EPIPE\n # Return false if the socket is dead\n return false\n end\n end", "def wait_readable(timeout = nil)\n if timeout\n move_on_after(timeout) do\n Polyphony.backend_wait_io(self, false)\n self\n end\n else\n Polyphony.backend_wait_io(self, false)\n self\n end\n 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 get(timeout=nil)\n data, saddr, sport = recvfrom(65535, timeout)\n return data\n end", "def readchar_nonblock io, &block\n begin\n done = false\n until done do\n ch = io.read_nonblock(1)\n done = block.call(ch)\n end\n rescue IO::WaitReadable\n logger.trace \"got WaitReadable exception\"\n t1 = Time.now\n IO.select([io], [io], [io])\n logger.trace \"got event, waited #{Time.now - t1}\"\n retry\n end\n end", "def recvfrom(length = 65535, timeout=def_read_timeout)\n\n begin\n if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and\n (rv[0]) and (rv[0][0] == fd)\n )\n data, saddr = recvfrom_nonblock(length)\n af, host, port = Rex::Socket.from_sockaddr(saddr)\n\n return [ data, host, port ]\n else\n return [ '', nil, nil ]\n end\n rescue ::Timeout::Error\n return [ '', nil, nil ]\n rescue ::Interrupt\n raise $!\n rescue ::Exception\n return [ '', nil, nil ]\n end\n end", "def recv(num_bytes = nil, timeout: nil)\n return '' if @buffer.empty? && !fillbuffer(timeout: timeout)\n\n @buffer.get(num_bytes)\n end", "def read_packet(sock, timeout=nil)\n hostport = @client.get_hostport_for_socket(sock)\n if not hostport\n raise RuntimeError, \"Client doesn't know host/port for socket \" +\n sock.inspect\n end\n type, data = Util.read_response(sock, timeout)\n case type\n when :job_created\n handle_job_created(hostport, data)\n when :work_complete\n handle_work_complete(hostport, data)\n when :work_fail\n handle_work_fail(hostport, data)\n when :work_status\n handle_work_status(hostport, data)\n else\n Util.log \"Got #{type.to_s} from #{hostport}\"\n end\n nil\n end", "def read_timeout_exceeded?\n @read_timeout_ms && duration_since_received > @read_timeout_ms\n end", "def gets_safe(socket, timeout=nil)\n if r = select([socket], nil, nil, timeout)\n return r[0].first.gets\n else\n return :timeout\n end\nrescue Exception => ex\n log_error(\"gets_safe: #{ex.class}: #{ex.message}\\n\\t#{ex.backtrace[0]}\")\n return :exception\nend", "def receive_data(io)\n data = nil\n time = Time.now if @nonblock\n ext = String.method_defined? :<<\n\n loop do\n begin\n buf = io.recv(RECV_BUF, @nonblock ? Socket::MSG_DONTWAIT : 0)\n\n if !data\n data = buf\n elsif ext\n data << buf\n else\n data += buf\n end\n\n return data if buf.size != RECV_BUF\n rescue\n next if (Time.now - time) < @timeout\n end\n end\n end", "def get_once(length = -1, timeout = def_read_timeout)\n\n if (has_read_data?(timeout) == false)\n return nil\n end\n\n bsize = (length == -1) ? def_block_size : length\n data = read(bsize)\n raise EOFError if data.nil?\n data\n end", "def shell_read_until_token(token, wanted_idx = 0, timeout = 5, absolute_timeout = 30)\n timeout = 5 if timeout.nil?\n if timeout > absolute_timeout\n absolute_timeout = timeout + absolute_timeout\n end\n\n parts_needed = if wanted_idx.zero?\n 2\n else\n 1 + (wanted_idx * 2)\n end\n buf = ''\n timeout_count = timeout\n # Read until we get the data between two tokens or absolute timeout.\n begin\n ::Timeout.timeout(absolute_timeout) do\n loop do\n if timeout_count <= 0\n # puts \"TIMEOUT=0\"\n vprint_debug(\"got timeout during reading from shell\")\n vprint_debug(\"last data: #{buf.dump}\")\n break\n end\n\n if (tmp = shell_read(-1, 1)) # BUG\n\n if tmp.empty?\n vprint_debug(\"shell_read() is empty: timeoutcount=#{timeout_count}|#{$ERROR_INFO}\") # XXX for testing\n timeout_count -= 1\n # sleep 0.5\n Rex::ThreadSafe.select(nil, nil, nil, 0.5)\n next\n end\n\n timeout_count = timeout\n # buf << do_encoding_terminal(tmp)\n buf << tmp\n #########################\n if wanted_idx.zero?\n break if buf.match(token)\n else\n parts = buf.split(token, -1)\n break if parts.length == parts_needed\n end\n\n else\n timeout_count -= 0.1\n # sleep 1\n Rex::ThreadSafe.select(nil, nil, nil, 0.1)\n end\n end\n\n return nil if buf.empty?\n parts = buf.split(token, -1)\n if parts.length == parts_needed\n output = parts[wanted_idx].to_s\n # \"Token found\"\n else\n # \"Token NOT found\"\n ################\n # try to recover\n if parts.length > 1\n # i = 0\n vprint_debug(\"...recovering output...\")\n parts.length.times do |i|\n if parts[i].to_s.end_with?(\"echo \")\n vprint_debug(\"...found...\")\n output = parts[i + 1]\n end\n end\n end\n end\n return nil if output.nil?\n return output\n end\n rescue\n vprint_debug(\"shell_read_until_token(): read timeout #{$ERROR_INFO}\") # XXX for testing\n return buf\n # nothing, just continue\n end\n # failed to get any data or find the token!\n nil.to_s\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 readpartial(maxlen, outbuf = \"\")\n data = @socket.readpartial(maxlen, outbuf)\n log :read, data\n data\n end", "def wait_for_io_eof(timeout)\n start = Time.now\n Timeout.timeout(timeout) do\n sleep(0.1) until @process.eof?\n end\n FFMPEG.logger.debug \"IO#eof? #{@process.eof?}\"\n Time.now - start\n end", "def read\n @mutex.synchronize {\n if(!@reading)\n @reading = 1\n begin\n str = @sock.gets\n rescue\n end\n\n @reading = nil\n return str\n else\n return nil\n end\n }\n end", "def receive_char(timeout=0)\n response = AGIResponse.new\n command_str = \"RECEIVE CHAR #{(timeout.to_i * 1000)}\"\n begin\n response.native = execute(command_str)\n rescue AGITimeoutError, AGICommandError, AGIHangupError\n raise\n end\n if response.native == -1 then\n raise AGIChannelError.new(@last_response, \"Channel Failure in (#{command_str})\")\n elsif response.native == 0\n raise AGICommandError.new(@last_response, \"Channel doesn't support TEXT in (#{command_str})\")\n else\n response.success = true\n response.data = response.native.chr\n end\n return response\n end", "def blocking_read\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Not connected!\" unless connected?\r\n begin\r\n data=@sock.recvfrom(8192)[0]\r\n return nil if data.empty?\r\n data\r\n rescue\r\n destroy_connection\r\n raise RuntimeError, \"CONN_UDP: blocking_read: Couldn't read from socket! (#{$!})\"\r\n end\r\n end", "def shell_read(length=nil, timeout=1)\n\t\tshell_init\n\n\t\tlength = nil if length < 0\n\t\tbegin\n\t\t\trv = nil\n\t\t\t# Meterpreter doesn't offer a way to timeout on the victim side, so\n\t\t\t# we have to do it here. I'm concerned that this will cause loss\n\t\t\t# of data.\n\t\t\tTimeout.timeout(timeout) {\n\t\t\t\trv = @shell.channel.read(length)\n\t\t\t}\n\t\t\tframework.events.on_session_output(self, rv) if rv\n\t\t\treturn rv\n\t\trescue ::Timeout::Error\n\t\t\treturn nil\n\t\trescue ::Exception => e\n\t\t\tshell_close\n\t\t\traise e\n\t\tend\n\tend", "def read_timeout=(read_timeout); end", "def received_n_timeout(sizemax,timeout_ms,&b)\n timeout(timeout_ms/1000.0) {\n ret=receive_n_bytes(sizemax,false,&b)\n return ret\n }\n rescue Timeout::Error\n return nil\n rescue Exception => e\n $stdout.puts \"#{e} :\\n #{e.backtrace.join(\"\\n \")}\"\n end", "def timeout\n return if @file.nil?\n return if done?\n\n reset_timeout\n\n @stats[:timeouts] += 1\n if @type == :receiving\n # Timeout expecting a frame\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n puts \"Timeout on #{expected_frame}\"\n nacknowledge_frame expected_frame\n else\n # Timeout expecting an ack\n expected_frame = (@next_frame % @options[:window_size]) + (@options[:window_size] * (@window % 2))\n\n # Resend the first frame to not be ack'd\n if @buffer[expected_frame] == \"\"\n # it is acked, wtf\n return\n end\n puts \"Resending #{expected_frame}\"\n send_frame expected_frame\n end\n end", "def with_timeout(timeout, &block)\n block.call\n rescue IO::WaitReadable => e\n if IO::select([self], nil, nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue IO::WaitWritable => e\n if IO::select(nil, [self], nil, timeout)\n retry\n else\n fail Aerospike::Exceptions::Connection, \"Socket timeout: #{e}\"\n end\n rescue => e\n raise Aerospike::Exceptions::Connection, \"Socket error: #{e}\"\n end", "def receive\n complete = \"\"\n while (t = read) != 0.chr\n if t == @char_lead_byte then\n t = read\n end\n\n attempt_to_reconnect if t.nil?\n\n complete << t\n end\n\n complete\n end", "def 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 readable?\n return false if @socket.closed?\n r,_,_ = Kernel.select([@socket], nil, nil, @timeout) rescue nil\n return !(r.nil? or r.empty?)\n end", "def retrieve_socket_data\n return \"\" if @socket.nil?\n\n retval = \"\"\n loop do \n break unless IO.select([@socket], nil, nil, 10)\n packet = @socket.recv(8192)\n retval << packet\n break if packet.length < 8192\n end\n \n return retval\n end", "def call(timeout)\n @time_out_at = read_clock + timeout\n\n yield\n end", "def wait_readable_or_timeout; end", "def select(timeout)\n result = Winsock.select(1, [1, @descriptor].pack('ll'), 0, 0, [timeout, timeout * 1000000].pack('ll'))\n SocketError.check if result == -1\n return result\n end", "def receive_message_on_socket(length, socket)\n begin\n message = receive_data(length, socket)\n rescue OperationTimeout, ConnectionFailure => ex\n socket.close\n\n if ex.class == OperationTimeout\n raise OperationTimeout, \"Timed out waiting on socket read.\"\n else\n raise ConnectionFailure, \"Operation failed with the following exception: #{ex}\"\n end\n end\n message\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 thread_read(timeout)\n deadline = Time.now + timeout\n raw_last_sample = nil\n while data = raw_read_new # sync call from bg thread\n raw_last_sample = data\n event :raw_data, data\n # TODO just emit raw_data and convert it to ruby\n # if someone is listening to (see PortProxy)\n event(:data) { [Typelib.to_ruby(data)] }\n break if Time.now > deadline\n end\n raw_last_sample\n end", "def rx_waitfor(n_packets, timeout_seconds = 1.0)\n t0 = Time.now.to_f\n while true\n rxc = rx_counter\n return rxc if rxc >= n_packets\n return nil if (Time.now.to_f - t0) >= timeout_seconds\n sleep(1.0/25)\n end\n end", "def read(timeout=nil)\n # First strip the additional header indicating the size of the subsequent response\n head = @socket.read(4,nil,timeout)\n length = head.unpack(\"N\")[0]\n response = Response.new.parse_from_string(@socket.read(length))\n # Translate returned path so that minuses are converted to underscores\n response.path.gsub!('-', '_')\n logger.trace('Received') {response.to_hash}\n response\n end", "def non_blocking_gets\n loop do\n result, _, _ = IO.select([@socket], nil, nil, 0.2)\n next unless result\n return result[0].gets\n end\n end", "def mssql_ping(timeout=5)\n\t\tdata = { }\n\n\t\tping_sock = Rex::Socket::Udp.create(\n\t\t\t'PeerHost' => rhost,\n\t\t\t'PeerPort' => 1434,\n\t\t\t'Context' =>\n\t\t\t\t{\n\t\t\t\t\t'Msf' => framework,\n\t\t\t\t\t'MsfExploit' => self,\n\t\t\t\t})\n\n\n\t\tping_sock.put(\"\\x02\")\n\t\tresp, saddr, sport = ping_sock.recvfrom(65535, timeout)\n\t\tping_sock.close\n\n\t\treturn data if not resp\n\t\treturn data if resp.length == 0\n\n\t\tvar = nil\n\n\t\treturn mssql_ping_parse(resp)\n\tend", "def shell_read(length = -1, timeout = 1)\n rv = rstream.read_buffered(length, timeout)\n framework.events.on_session_output(self, rv) if rv\n return rv\n rescue ::Rex::SocketError, ::EOFError, ::IOError, ::Errno::EPIPE => e\n # print_error(\"Socket error: #{e.class}: #{e}\")\n shell_close\n raise e\n end", "def wait_cr(tmo=nil)\n t = Machine.millis + tmo if tmo\n loop {\n rsp = self.gets\n return rsp.chomp if rsp.size > 0\n raise \"XBee response timeout\" if t && t <= Machine.millis\n Machine.delay(10)\n }\n end", "def select(timeout = 1)\n ::IO.select([@io], [@io], [], timeout)\n end", "def recvfrom( length=65535, timeout=def_read_timeout )\n\t\tresult = nil\n\t\t# force a timeout on the wait for an incoming datagram\n\t\tbegin\n\t\t\tTimeout.timeout( timeout ) {\n\t\t\t\twhile( true )\n\t\t\t\t\t# wait untill we have at least one datagram in the queue\n\t\t\t\t\tif( @datagrams.empty? )\n\t\t\t\t\t\tRex::ThreadSafe.sleep( 0.2 )\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\t\t# grab the oldest datagram we have received...\n\t\t\t\t\tresult = @datagrams.shift\n\t\t\t\t\t# break as we have a result...\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t}\n\t\trescue Timeout::Error\n\t\t\tresult = nil\n\t\tend\n\t\t# if no result return nothing\n\t\tif( result == nil )\n\t\t\treturn [ '', nil, nil ]\n\t\tend\n\t\t# get the data from this datagram\n\t\tdata = result[0]\n\t\t# if its only a partial read of this datagram, slice it, loosing the remainder.\n\t\tresult[0] = data[0,length-1] if data.length > length\n\t\t# return the result in the form [ data, host, port ]\n\t\treturn result\n\tend", "def read_from_pipe(pipe, timeout = 0.1, &_block)\n if self.class.readable?(pipe, timeout)\n l = pipe.readpartial(4096)\n # TODO: Log a debug for \"#{Time.now} PIPE> #{l}\"\n # Since readpartial may return a nil at EOF, skip returning that value\n yield l unless l.nil?\n end\n\n nil\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 shell_read_until_token(token, wanted_idx=0, timeout=10)\n return if timeout.to_i == 0\n\n if wanted_idx == 0\n parts_needed = 2\n else\n parts_needed = 1 + (wanted_idx * 2)\n end\n\n # Read until we get the data between two tokens or absolute timeout.\n begin\n ::Timeout.timeout(timeout) do\n buf = ''\n idx = nil\n loop do\n if (tmp = shell_read(-1))\n buf << tmp\n\n # see if we have the wanted idx\n parts = buf.split(token, -1)\n\n if parts.length == parts_needed\n # cause another prompt to appear (just in case)\n shell_write(\"\\n\")\n return parts[wanted_idx]\n end\n end\n end\n end\n rescue\n # nothing, just continue\n end\n\n # failed to get any data or find the token!\n nil\n end", "def non_blocking_gets\n loop do\n result, _, _ = IO.select( [@socket], nil, nil, 0.2 )\n next unless result\n return result[0].gets\n end\n end", "def read_timeout= secs\n if secs\n @read_timeout = secs\n @read_timeout_ms = secs * 1000\n else\n @read_timeout = @read_timeout_ms = nil\n end\n end", "def recv_text(echo=true)\n begin\n Timeout.timeout(ReceiverTimeout) do\n begin\n temp = @connection.gets\n case\n when temp.nil?\n LOG.warn(@mail[:mail_id]) {\"The client abruptly closed the connection\"}\n text = nil\n else\n text = temp.chomp.utf8\n end\n rescue Errno::ECONNRESET => e\n LOG.warn(@mail[:mail_id]) {\"The client slammed the connection shut\"}\n text = nil\n end\n LOG.info(@mail[:mail_id]) {\" -> #{if text.nil? then \"<eod>\" else text end}\"} \\\n if echo && LogReceiverConversation\n puts \" -> #{text.inspect}\" if DisplayReceiverDialog\n return text\n end\n rescue Errno::EIO => e\n LOG.error(@mail[:mail_id]) {\"#{e}#{Unexpectedly}\"}\n raise Quit\n rescue Timeout::Error => e\n LOG.info(@mail[:mail_id]) {\" -> <eod>\"} if LogReceiverConversation\n return nil\n end\n end", "def select(timeout) # timeout in seconds\r\n SocketError.check if (ret = Winsock.select(1, [1, @fd].pack(\"ll\"), 0, 0, [timeout.to_i, \r\n (timeout * 1000000).to_i].pack(\"ll\"))) == -1\r\n ret\r\n end", "def recvline(drop: false, timeout: nil)\n recvuntil(context.newline, drop: drop, timeout: timeout)\n end" ]
[ "0.7202537", "0.6935118", "0.6922779", "0.6868883", "0.68577427", "0.68392587", "0.6663246", "0.6610376", "0.65222", "0.6501486", "0.6442421", "0.6406714", "0.63326937", "0.6298922", "0.62532824", "0.62458324", "0.6205767", "0.61006474", "0.60950625", "0.6082923", "0.6075475", "0.6054806", "0.5979344", "0.59680015", "0.59596676", "0.59596676", "0.59475017", "0.5914594", "0.5914594", "0.5914594", "0.5914594", "0.5914594", "0.5914594", "0.5914594", "0.5914594", "0.59051883", "0.59000254", "0.5898088", "0.58660954", "0.58647573", "0.5854149", "0.58340114", "0.5831575", "0.5827178", "0.5827178", "0.5827178", "0.58009744", "0.5799408", "0.5768174", "0.5768011", "0.5766815", "0.5757208", "0.57382655", "0.5716071", "0.5715986", "0.57039267", "0.5693709", "0.56661475", "0.56577706", "0.565271", "0.5637631", "0.563605", "0.5627505", "0.562301", "0.5562439", "0.5539721", "0.5525415", "0.5496407", "0.54604113", "0.54532087", "0.54513717", "0.54268396", "0.54205084", "0.5411701", "0.5393976", "0.53891206", "0.5384357", "0.5372318", "0.5364021", "0.53608984", "0.5356554", "0.5347434", "0.53246516", "0.5312093", "0.5298404", "0.5292356", "0.528652", "0.52854383", "0.5285146", "0.5284516", "0.5280657", "0.5273554", "0.52724946", "0.5271309", "0.52675253", "0.5266321", "0.5258804", "0.5215486", "0.52053535", "0.51987785" ]
0.8419876
0
Sends the message followed by an EOT The message must not contain any EOT characters.
def send_message(message) @socket.write(message) @socket.write("\004") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(message)\n ## empty\n end", "def raw_send(message)\n TalkerBase.instance.output << \"#{id} send #{message}\"\n end", "def send_message(message)\n check_parenthesis(message)\n puts \"Send: #{message}\" if @debug\n connection{|c| c.write(message)}\n end", "def user_message_end(msg)\n user_message(msg, 0, \"<<<\")\n end", "def send_message(text)\n end", "def send(message)\n LOGGER.debug { \"[OUT] #{message} \" }\n @driver.text(message)\n end", "def handle_etf_message(data)\n data = Vox::ETF.decode(data)\n LOGGER.debug { \"Emitting #{OPCODES[data[:op]]}\" } if OPCODES[data[:op]] != :DISPATCH\n\n @session.seq = data[:s] if data[:s]\n op = OPCODES[data[:op]]\n\n emit(op, data)\n end", "def send(message)\n info(\"[Smartfocus] Send -> #{message}\")\n end", "def send_message(message); end", "def send_message(message); end", "def motd(t)\n @socket << \"MOTD #{t}\"\n end", "def send_message(msg); end", "def send_message(msg)\n session.transport.send_message(msg)\n end", "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def send_command(command)\n SerialPort.open(self.device_path, 9600, 8, 1) do |port|\n # flush anything existing on the port\n port.flush\n flush_read_buffer(port)\n\n byte_string = command.to_bytes.pack('C*')\n\n begin\n while byte_string && byte_string.length != 0\n count = port.write_nonblock(byte_string)\n byte_string = byte_string[count,-1]\n\n port.flush\n end\n rescue IO::WaitWritable\n if IO.select([], [port], [], 5)\n retry\n else\n raise IOError, \"Timeout writing command to #{self.device_path}\"\n end\n end\n\n # wait for expected confirmation signals\n got_eot = false\n got_soh = false\n loop do\n begin\n c = port.read_nonblock(1)\n\n case c\n when \"\\x04\"\n if ! got_eot\n got_eot = true\n else\n raise IOError, \"Got EOT reply twice from #{self.device_path}\"\n end\n when \"\\x01\"\n if got_eot\n if ! got_soh\n got_soh = true\n\n break\n else\n raise IOError, \"Got SOH twice from #{self.device_path}\"\n end\n else\n raise IOError, \"Got SOH before EOT from #{self.device_path}\"\n end\n end\n rescue IO::WaitReadable\n if IO.select([port], [], [], 3)\n retry\n else\n raise IOError, \"Timeout waiting for command reply from #{self.device_path}. EOT:#{got_eot} SOH:#{got_soh}\"\n end\n end\n end\n end\n\n self\n end", "def send_emote(text)\n client.api.send_emote(id, text)\n end", "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def sock_send io, msg\n msg = \"#{msg}\\0\"\n log msg\n io.send msg, 0\n end", "def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend", "def send(message)\n info(\"[Emailvision] Send -> #{message}\")\n end", "def away(message = nil)\n send_data(\"AWAY \" + (message ? \":#{message}\" : \"\"))\n end", "def tell(message, msgtype)\n lines = send_message(\"TELL\", message, 'Message-class' => msgtype)\n end", "def send_message(message)\n @socket.send(message << \"\\n\", 0, nil, @client)\n end", "def received msg\n send <<END\nI see you!\nfailed test: #{@current_test.inspect}\nEND\n\n send <<END\n you sent:\n#{msg}\nEND\n end", "def send(str)\n write(str + 0.chr)\n end", "def send_tick\n msg = Erlang::Encoder.new\n msg.write_4 0\n msg.write ''\n send_data msg\n end", "def send(eiscp)\n connect if @socket.nil? || @socket.closed?\n case eiscp\n when EISCP::Message\n @socket.puts(eiscp.to_eiscp)\n when String\n @socket.puts eiscp\n end\n end", "def put(msg)\n simulation.socket.write(msg + \"\\n\")\n rescue Errno::EPIPE => e\n # :from_origen_sim is added here to ensure this goes straight to the Origen console logger\n # and does not get sent via the simulator since it is clearly having problems\n if simulation.running?\n Origen.log.error 'Communication with the simulator has been lost (though it seems to still be running)!', from_origen_sim: true\n else\n Origen.log.error 'The simulator has stopped unexpectedly!', from_origen_sim: true\n end\n sleep 2 # To make sure that any log output from the simulator is captured before we pull the plug\n exit 1\n end", "def send_message(msg)\n send_data({:type => :message, :body => msg})\n end", "def send_message(io, opcode, args)\n msg = opcode + \"::!!::\" + args.join(\"::!!::\")\n sock_send io, msg\n end", "def send_command(command)\n @client.write \"#{command}\\r\\n\"\n end", "def send\n curate_text\n if @no_send\n self.print\n return\n end\n\n raise NotImplementedError.new(\"#{self.class.name}#send is an abstract method and must be implemented by a subclass.\")\n end", "def send(msg)\n @socket.puts msg\n puts '<< ' << msg\n end", "def send(message)\n if message.length > 0\n # The client will return an empty string\n # on success, or it will return an error\n error = @client.transmit(message)\n if error.length > 0\n new_message(error)\n end\n end\n end", "def send(message)\n message\n end", "def send_data(pipe, data)\n pipe.write(data, \"\\n#{MSG_ENDI}\\n\")\nend", "def send_event(event)\n each { |actor| actor.mailbox.system_event event }\n end", "def send(msg)\n @connection.write(\n @serializer.en(msg))\n rescue Exception => e\n raise\n end", "def peer_send(peer,message)\r\n\t\t\tpeer.socket.puts(message)\r\n\t\tend", "def send\n puts \"a fake implementation of `send`\"\n end", "def attack(msg)\n puts \"\\n\\ntrudy esta conectado y va atacar!\\n\\n\" \n msg += \"MensajeTocado!\"\n end", "def send(text)\n raise \"send(text) must be overridden\"\n end", "def send(message)\n pipe_to.puts(message)\n end", "def send_message(message)\n @networking.send_message(message)\n end", "def send_edition_token(event, speaker)\n @url = edit_event_url(token:event.token)\n @event = event\n @speaker = speaker\n\n email_with_name = \"#{@speaker.name} <#{@speaker.email}>\"\n mail(to: email_with_name, subject: t(\"mails.notifier.tag\") + \" \" + t(\"mails.notifier.send_edition_token.subject\"))\n end", "def send_etf_packet(op_code, data)\n LOGGER.debug { \"Sending #{OPCODES[op_code]} #{data}\" }\n payload = { op: op_code, d: data }\n @websocket.send_binary(Vox::ETF.encode(payload))\n end", "def send(msg=\"\")\n\t\tif @connected\n\t\t\t@sock.write \"\\1#{msg}\\r\\n\" # leading \\1 for terse reply\n\t\tend\n\tend", "def write text=\"\"\n\t\t@message.text = @msg = text.to_s\n\tend", "def send_raw(to, msg, dlr_url='')\n log_an_event(\"Gateway::TestSession\", \"send raw #{[to, msg, dlr_url].join(' ')} \")\n @events.push([\"send_raw\", {:to=>to, :msg=>msg, :dlr_url=>dlr_url}])\n\n wait_for_response = false\n status = \"sent\"\n status_string = \"TestSession\"\n [wait_for_response, status, status_string]\n end", "def send_command(cmd)\n write cmd.chr\n end", "def echo message\r\n command 'echo', message\r\n end", "def send_event(type, name, id, info)\n message = create_message(:cmdtype => type, :target => @@myName, \n :value => name, :appID => id, :message => info) \n send_message(@@myECAddress, message)\n end", "def sendmsg(s)\n @sock.send \"#{s}\\n\", 0 \n end", "def send_string(string)\n Babylon.logger.debug(\"SENDING : #{string}\")\n send_data(\"#{string}\") \n end", "def send(message)\n socket.send(message, 0, address, port)\n end", "def send_text(command)\n @session.connection.puts(command)\n end", "def send_chat_text(msg, type)\n if @socket_srv\n unless msg.empty? \n cmd_to_send = build_cmd(type, msg)\n send_data_to_server(cmd_to_send)\n end\n else\n @cup_gui.log_sometext \"Non collegato in rete\\n\"\n end\n end", "def sync_send\n sync_write.putc(\"!\")\n sync_write.flush\n end", "def enviarMensaje(mensaje)\n @@socket.puts mensaje\n end", "def on_send(node)\n return unless in_spec?(node)\n return unless env_assignment?(node)\n\n add_offense(node, location: :expression, message: MESSAGE)\n end", "def send_ethos_mail\n TeaTimeMailer.delay(run_at: Time.now + 1.hour).ethos(self.user_id)\n end", "def send(data)\n debug [:send, data]\n send_data(\"\\x00#{data}\\xff\")\n end", "def send(data)\n debug [:send, data]\n send_data(\"\\x00#{data}\\xff\")\n end", "def tell(message)\n message message, nil\n end", "def tell(message)\n message message, nil\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 send_event(event, hint = nil)\n client.send_event(event, hint)\n end", "def send_message( msg )\n @session.send_message msg\n self\n end", "def write! page, content, message = nil\n unless message\n message = %Q{bot edit with empty message}\n end\n @client.write! page, content, message\n end", "def send_message(emsg)\n raise \"platform adapter #{self.name} must implement \\\"send_message\\\" method\"\n end", "def send_event( data )\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.sendmsg_nonblock( data, 0, exception: false )\n\n\t\t\tif bytes == :wait_writable\n\t\t\t\tIO.select( nil, [self.socket], nil )\n\t\t\telse\n\t\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\t\tdata[ 0, bytes ] = ''\n\t\t\tend\n\t\tend\n\tend", "def send command\n raise Error.new('implement me via subclass')\n end", "def send_when_clear cmd_msg\n snooze = 0.05 + rand / 100 # 50-60ms\n unless @carrier_sense == 0 and @last_message < Time.now - snooze\n loop do\n @carrier_sense = 0\n sleep snooze\n break if @carrier_sense == 0\n end\n end\n @io.write cmd_msg\n end", "def send_msg(msg)\n s = ''\n case msg\n when Const::MSG_PAUSE\n s = \"#{Const::MSG_PAUSE}\"\n when Const::MSG_GAME_OVER\n s = \"#{Const::MSG_GAME_OVER}\"\n when Const::MSG_BOARD\n s = \"#{Const::MSG_BOARD}:#{@game.get_board_s}\"\n when Const::MSG_GARBAGE\n s = \"#{Const::MSG_GARBAGE}:#{@game.rows_cleared}\"\n end\n begin\n @socket.sendmsg_nonblock(s)\n rescue\n # problem s pripojenim -- game over\n @socket.close\n @window.state = MenuState.new(@window)\n end\n end", "def foward_data data\n puts \"#{data}\"\n if (data == 'E')\n send_data @last_sent_data\n elsif (data == 'N')\n puts \"erro durante a transmissao\"\n end\n end", "def send_message(content, tts = false, embed = nil, attachments = nil, allowed_mentions = nil, message_reference = nil, components = nil)\n @bot.send_message(@id, content, tts, embed, attachments, allowed_mentions, message_reference, components)\n end", "def bye_message\n message = \"Panacea's work is done, enjoy!\"\n say \"\\n\\n\\e[34m#{message}\\e[0m\"\n end", "def say(cmd)\n @socket.send(\"#{cmd}\\n\\n\",0)\n response\n end", "def message_from_mentee_outreach\n MenteeOutreachResponse.process_text(params)\n render :text => ''\n end", "def send_message(message)\n @module_manager.bot.log prefix + message + \"\\e[0m\"\n end", "def send\n # Try to send it.\n conn = Viewpoint::EWS::EWS.instance\n resp = conn.ews.send_item([{ :id => @item_id, :change_key => @change_key }])\n if (resp.status != 'Success')\n raise EwsError, \"Could not send Message. #{resp.code}: #{resp.message}\"\n end\n end", "def tell(message)\n puts message\n end", "def send_raw(data)\n # puts \"Sending data\"\n # puts_data(data)\n write(data)\n end", "def tell (message)\n\t\t\tactor.tell message\n\t\tend", "def tell(command, params = {})\n msg_id = Random.new.rand(2**16)\n @connection.write({ method: command, params: params, id: msg_id }.to_json)\n end", "def chatroom_emote(msg, cl, state)\n body = msg.body.to_s\n body = body[1..body.length - 2]\n \n # Being invited back to a chat room: '_henry invited gossbot2@gmail.com_' \n if(match = /^(.*) invited you to '#{ROOM_NAME}'/.match(body))\n out(\"coming back after being kicked\")\n respond(msg, cl, \"hello again\")\n return\n end\n\n # handle users being kicked \n if (match = /(\\S*) kicked (\\S*)/.match(body))\n out(\"User was kicked. match: #{match.inspect}\")\n\n if match[1] != \"gossbot\" && match[1] != \"gossbot2\" \n respond(msg, cl, \"/kick #{match[1]}\")\n respond(msg, cl, \"#{match[1]} is a jerk.\")\n\n # if person was kicked by email re-invite, otherwise look them up first\n if (match[2].include?(\"@\"))\n respond(msg, cl, \"/invite #{match[2]}\")\n else\n respond(msg, cl, \"/invite #{state[:user_map][match[2]]}\") if state[:user_map][match[2]]\n end\n end\n end\nend", "def send(cmd)\n puts send_cmd(cmd)\n end", "def send(message)\n\t\t\t@conn.send(message)\n\t\tend", "def send(str)\r\n @socket.write(str + 0.chr)\r\n end", "def send(message)\n\t\tbegin\n\t\t\t@conn.send_message(message)\n\t\trescue IOException, NativeException\n\t\t\traise IOError, 'Failed to send message to USAR server'\n\t\tend\n\tend", "def event(msg)\n unknown(\"=====> #{msg}\")\n end", "def write(s)\n @port.write(s)\n sleep(@wait_after_send / 1000.0) if @wait_after_send\n end", "def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end", "def send_cmd(cmd)\n # Write the command plus a newline to the input\n @pipe.write_input(cmd + \"\\n\")\n end", "def ignore_test_sendtext\r\n\t\t@mailer.subject = 'test ruby smtp lib'\r\n\t\t@mailer.body = [\r\n\t\t\t'test ruby smtp', \r\n\t\t\t'test ruby sendmail',\r\n\t\t\t]\r\n\t\t@mailer.sendtext()\r\n\tend", "def send_event(msg, hash)\n client = Dogapi::Client.new(@api_key)\n event = Dogapi::Event.new(msg, hash)\n client.emit_event(event)\n end", "def send_event( data )\n\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.send( data, 0, self.multicast_address, self.port )\n\n\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\tdata[ 0, bytes ] = ''\n\t\tend\n\tend", "def send(a)\n\t\t@connection.puts a\n\tend", "def send_message(body)\n # checksum\n body << ((~body.sum+1) & 0x7F)\n\n # sysex wrapper and header\n msg = [\n 0xF0,\n 0x00,0x01,0x73,0x7E, # header: iConnectivity's manufacturer ID and message class\n *body,\n 0xF7\n ]\n\n # send sysex\n output = UniMIDI::Output.first\n output.puts(msg)\nend" ]
[ "0.6222513", "0.5871565", "0.5838897", "0.57932895", "0.57378227", "0.573628", "0.573301", "0.5667312", "0.5657688", "0.5657688", "0.5655679", "0.5630043", "0.5626042", "0.56259376", "0.56259376", "0.56123877", "0.55861443", "0.5558713", "0.55460066", "0.5545948", "0.5533304", "0.55179924", "0.5502476", "0.5497614", "0.54661673", "0.5458323", "0.5448717", "0.5436774", "0.5423565", "0.541895", "0.5398603", "0.539197", "0.5384461", "0.53816336", "0.5380549", "0.53694123", "0.5345102", "0.52977455", "0.5294057", "0.5289688", "0.5289109", "0.5285819", "0.52816886", "0.5275894", "0.52704227", "0.5253645", "0.52536136", "0.52454", "0.52351534", "0.5229672", "0.52145404", "0.52108127", "0.51941913", "0.5183572", "0.51812184", "0.5178762", "0.517087", "0.516664", "0.51572704", "0.5155848", "0.5154918", "0.51471394", "0.5143301", "0.5143301", "0.51372373", "0.51372373", "0.51336604", "0.5118699", "0.51172394", "0.51159066", "0.51144004", "0.5114296", "0.51016396", "0.5091295", "0.50869846", "0.5084406", "0.5076459", "0.507605", "0.5072519", "0.50599617", "0.50586045", "0.5056545", "0.5054835", "0.50541013", "0.5052324", "0.50408554", "0.5035704", "0.5035046", "0.50324875", "0.50312483", "0.5013671", "0.50133073", "0.5005547", "0.50045735", "0.50035053", "0.5003434", "0.5001232", "0.4995854", "0.4992903", "0.49918044" ]
0.5795542
3
Use callbacks to share common setup or constraints between actions.
def set_tender @tender = Core::Tender.find(params[:tender_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def documents_params params.permit(:collaboration_id, files: {} ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
I don't think this matters in this code in particular, but I added it to see it if threw errors.
def initialize(flavors, empty = true) @flavors = flavors @pez_num = @flavors.count @empty = empty if @pez_num > 0 @empty = false else @empty = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error?()\n #This is a stub, used for indexing\n end", "def error?; end", "def error?; end", "def error?; end", "def check_errors;\n end", "def recover_from(_error); end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error?\n true\n end", "def errorhandling\n end", "def check_errors;\n end", "def original_error; end", "def original_error; end", "def catch_exceptions; end", "def failed?\n raise 'Not implemented!'\n end", "def continued_exception; end", "def failed?\n true\n end", "def error?\n return !ok?\n end", "def error?\n false\n end", "def failures; end", "def failures; end", "def failures; end", "def failed?\n error.present?\n end", "def error(exception) nil ; end", "def has_error?\n status == ERROR \n end", "def recover_from(_error)\n end", "def do_failure; end", "def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend", "def error?\n false\n end", "def run_failed; end", "def is_exception?; end", "def errored_during_import?\n import_errors.present?\n end", "def error?\n false\n end", "def error?\n false\n end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def exceptions; end", "def check_for_errors\n return unless @chunks.any? { |chunk| chunk.first[0] == :error }\n errors = @chunks.find_all { |chunk| chunk[0] == :error }\n $stderr.puts \"WARNING: found the following errors: #{errors.map(&last).inspect}\"\n end", "def missed?; end", "def error\n nil\n end", "def error_threshold; end", "def error?\n !failure?\n end", "def error\n end", "def errors?\n\t\treturn !self.okay?\n\tend", "def errors?\n\t\treturn !self.okay?\n\tend", "def ok?\n !@error\n end", "def error\n nil\n end", "def call_error?(rc) (rc.respond_to?(:ok?) and rc.ok?) ? false : true end", "def missing?; false; end", "def fatal?; end", "def fatal?; end", "def phantom_load_raise?(e); end", "def unsuccessful\n end", "def check_errors\n unless valid? \n bigmessage = self.errors.full_messages.join \"\\n\" \n raise bigmessage unless bigmessage.empty?\n \n raise \"format should not be nil\" if format.nil?\n raise \"invalid format #{format}\" unless format.valid? \n raise \"#{self.errors.to_a}, error encountered while saving #{@datafile_id}, #{@bitstream_id} \" \n end\n end", "def missing?; end", "def handle_perform_error(_e); end", "def raise_errors?\n @raise_errors != false\n end", "def error?\n get_last_error['err'] != nil\n end", "def error?\n get_last_error['err'] != nil\n end", "def handle_failed_rows?\n false\n end", "def error?\n !success?\n end", "def fail\n # no-op\n end", "def error?\n last_error.present?\n end", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def error?\n !success?\n end", "def load_error; end", "def failed?\n not @ok\n end", "def lost?\n errors_allowed == 0\n end", "def server_error?; end", "def error?\n raise NotImplementedError.new\n end", "def error\n\t\traise StandardError\n\tend", "def has_errors?\n return @exitcode == 2 || @exitcode == 1\n end", "def underlying_exception; end", "def client_error?; end", "def error?\n error\n end", "def error?\n !error.nil?\n end", "def not_errored?\n errors.values.map(&:empty?).reduce(true, &:&) == true\n end", "def checks; end", "def error?\n !success?\n end", "def ok?\n errors.empty?\n end", "def error\n\t\t\traise 'Test'\n\t\tend", "def hasError?\r\n\t\t@expected != nil\r\n\tend", "def error\n end", "def error?\n !error.nil?\n end", "def error?\n !error.nil?\n end" ]
[ "0.73161227", "0.69901925", "0.69901925", "0.69901925", "0.6862229", "0.67636776", "0.67267555", "0.67267555", "0.67267555", "0.67267555", "0.67267555", "0.67267555", "0.67267555", "0.6686846", "0.6682008", "0.66449404", "0.6588388", "0.6588388", "0.65459013", "0.6542581", "0.65178627", "0.6502892", "0.6488169", "0.64776844", "0.6454632", "0.6454632", "0.6454632", "0.6390441", "0.6357301", "0.63423157", "0.6337934", "0.6337821", "0.633712", "0.6334081", "0.6330774", "0.63219357", "0.6321212", "0.63173026", "0.63173026", "0.63154995", "0.63154995", "0.63154995", "0.63154995", "0.63154995", "0.63154995", "0.63154995", "0.63154995", "0.63154995", "0.6300643", "0.62934464", "0.62901515", "0.62826437", "0.62528515", "0.6239588", "0.6228756", "0.6224694", "0.6224694", "0.62094396", "0.6204843", "0.6183622", "0.6180309", "0.617236", "0.617236", "0.6169324", "0.61649865", "0.6160609", "0.6157487", "0.6151831", "0.6141592", "0.6114343", "0.6114343", "0.610616", "0.60974276", "0.60969037", "0.6074247", "0.60585284", "0.60585284", "0.60585284", "0.60585284", "0.60585284", "0.6043357", "0.6039702", "0.6038623", "0.6037263", "0.60362023", "0.60299546", "0.60283935", "0.6027266", "0.6022229", "0.6019761", "0.60185343", "0.601403", "0.60100853", "0.60089034", "0.6008062", "0.6007146", "0.6006949", "0.6006529", "0.60013264", "0.59932894", "0.59932894" ]
0.0
-1
Can improve grid for any size using info here
def display_grid puts %Q( +---+---+---+---+---+ | | | | | | @ = Player | #{$grid[0][0]} | #{$grid[0][1]} | #{$grid[0][2]} | #{$grid[0][3]} | #{$grid[0][4]} | #{$mtoken} = Monster | | | | | | £ = Treasure +-------------------+ > = Exit | | | | | | | #{$grid[1][0]} | #{$grid[1][1]} | #{$grid[1][2]} | #{$grid[1][3]} | #{$grid[1][4]} | | | | | | | Your HP is #{$playerhp} +-------------------+ Your AT is #{$playeratt} | | | | | | Your DF is #{$playerdef} | #{$grid[2][0]} | #{$grid[2][1]} | #{$grid[2][2]} | #{$grid[2][3]} | #{$grid[2][4]} | | | | | | | +-------------------+ Kills: #{$kills} | | | | | | Treasure: #{$treasure} | #{$grid[3][0]} | #{$grid[3][1]} | #{$grid[3][2]} | #{$grid[3][3]} | #{$grid[3][4]} | | | | | | | Floor: #{$floor} +---+---+---+---+---+ Debug info Monster goal is #{$mgoaly}, #{$mgoalx} Monster AT #{$monsteratt} Monster DF #{$monsterdef} Monster HP #{$monsterhp} Monster Treasure #{$mtreasure} ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_grid size\n self.tiles.clear\n size.to_i.times do |row|\n size.to_i.times do |column|\n self.tiles.build({\n x: column,\n y: row\n })\n end\n end\n end", "def size \n\n\t\t# Set the basic metrics\n\t\tcase @board_size\n\t\twhen :small \t\t\t\t# A 20x20 grid\n\t\t\t@width = 30\n\t\t\t@height = 20\n\t\t\t@dragon_count = 50 * @board_level\n\t\t\t@cell_size = 30\n\t\t\t@cover_png = 'sprites/cover_30.png'\n\t\t\t@dragon_png = 'sprites/dragon_30.png'\n\t\t\t@gold_png = 'sprites/gold_30.png'\n\t\t\t@cell_png = [ 'sprites/cell0_30.png', 'sprites/cell1_30.png', 'sprites/cell2_30.png', \n\t\t\t\t\t\t 'sprites/cell3_30.png', 'sprites/cell4_30.png', 'sprites/cell5_30.png',\n\t\t\t\t\t\t 'sprites/cell6_30.png', 'sprites/cell7_30.png', 'sprites/cell8_30.png' ]\n\t\tend\n\n\t\t# Clear and resize the board array\n\t\t@spawned = false\n\t\t@victorious = false\n\t\t@burniation = -1\n\t\t@burn_size = 1\n\t\t@dragons = Array.new( @width * @height, 0 )\n\t\t@cell_status = Array.new( @width * @height, :status_covered )\n\n\t\t# Decide how big the stuff on the right hand side should be\n\t\t@label_size = -2.5\n\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size )\n\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size )\n\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size )\n\n\t\twhile [ @size_restart.x, @size_dragon.x, @size_time.x ].max < ( $gtk.args.grid.w - ( ( @width + 6 ) * @cell_size ) )\n\n\t\t\t# Try some slightly bigger sizes then\n\t\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size+0.1 )\n\t\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size+0.1 )\n\t\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size+0.1 )\n\n\t\t\t# And nudge up the label size\n\t\t\t@label_size += 0.1\n\t\tend \n\n\t\t@label_size -= 0.1\n\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size )\n\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size )\n\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size )\n\t\t\n\t\t# Lastly, work out some sensible offsets\n\t\t@board_w = @width * @cell_size\n\t\t@board_h = @height * @cell_size\n\t\t@board_x = 2 * @cell_size \n\t\t@board_y = $gtk.args.grid.center_y - ( @board_h / 2 )\n\n\t\t@label_x = @board_x + @board_w + ( 2 * @cell_size )\n\t\t@label_time_y = $gtk.args.grid.center_y + ( @size_time.y + 20 ) * 1.5\n\t\t@label_dragon_y = @label_time_y - 20 - @size_dragon.y - 20\n\t\t@label_restart_y = @label_dragon_y - 20 - @size_restart.y - 20\n\n\t\t@label_width = [ @size_restart.x, @size_dragon.x, @size_time.x ].max + 20\n\n\tend", "def adapt_design_size \n hits = 0\n while space_factor < Constants::Min_allowed_factor and hits < 3\n if @vertical \n @height /= Constants::Shrink_factor\n @height += @height%20 == 0 ? 0 : 20-@height%20\n elsif not @vertical\n @width /= Constants::Shrink_factor\n @width += @width%20 == 0 ? 0 : 20-@width%20\n end\n composite_main_image_position\n generate_white_spaces\n white_space_area = white_space_w * white_space_h\n hits +=1\n end\n end", "def grid_page_size\n GRID_PAGE_SIZE\n end", "def make_grid\n @grid = Array.new(4){Array.new(4)}\n end", "def draw_grid\n print_cap\n (0...@vertical).each do |vert_index|\n (0..@v_size).each do |block_height|\n (0...@horizontal).each do |horizontal_index|\n if block_height == (@v_size/2)\n print \"|\" + \" \"*(@h_size/2)\n \"#{print @contents[horizontal_index][vert_index]}|\"\n print \" \"*(@h_size/2-1)\n else\n print \"|\"; print \" \"*@h_size\n end\n end\n print \"|\\n\" \n \n end\n print_cap\n end\n end", "def gridhelper ()\n $helper = \"\"\n $g = 0\n items = MEASURES\n $LEN = items.length\n $parsed = 0\n\n until $g == $LEN\n $TYPE = items[$g]['TYPE']\n if $g == 0\n $NAME = \"default\"\n else\n $NAME = \"$bp-\" + items[$g]['NAME']\n end\n $FROM = items[$g]['FROM']\n $COLS = items[$g]['COLS']\n $FLUID = items[$g]['FLUID']\n $RATIOPREGOLDEN = items[$g]['RATIOPREGOLDEN']\n $GOLDEN = items[$g]['GOLDEN']\n $RATIO = $RATIOPREGOLDEN * $GOLDEN\n $COLW = items[$g]['COLW']\n $GUTW = items[$g]['GUTW']\n $MAXW = items[$g]['MAXW']\n $COLBG = items[$g]['COLBG']\n\n \n if $TYPE == \"grid_bp\"\n $helper += \"\\n/* %s GRID */\" % [$NAME]\n $helper += \"\\n@media (min-width: #$FROM){\"\n if $FLUID == \"f\" || $FLUID == \"F\"\n $HALW = \"cal(-#$MAXW/2)\"\n $GUTW = \"cal(100%/(#$COLS+(#$COLS*#$RATIO)))\"\n $MRGW = \"cal(50%/(#$COLS+(#$COLS*#$RATIO)))\"\n $COLW = \"cal(100%*#$RATIO/(#$COLS+(#$COLS*#$RATIO)))\" \n\n else \n $HALW = \"cal(-#$COLS/2*(#$COLW+#$GUTW))\"\n $MAXW = \"cal(#$COLS*(#$COLW+#$GUTW))\"\n $MRGW = \"cal(#$GUTW/2)\"\n end\n $helper += \"\n #grid {\n margin-left: #$HALW;\n max-width: #$MAXW; \n }\n #grid div.vert {\n background: #$COLBG;\n width: #$COLW;\n margin: 0 #$MRGW;\n }\n #grid div.vert.first-line {\n margin-left: #$MRGW;\n }\n #grid div.vert.cols#$COLS { /* this grid uses #$COLS cols */\n margin-right: 0;\n }\n \"\n if $parsed > 0\n $target = $parsed - 1\n $PREVCOLS = getPreviousGridCols ( $target )\n\n $helper += \"\n #grid div.vert.cols#$PREVCOLS { /* reset previous #$PREVCOLS cols grid */\n margin-right: #$MRGW;\n }\n \"\n end\n $helper += \"\\n}\"\n\n $parsed += 1\n else\n if $FLUID == \"f\" || $FLUID == \"F\"\n $HALW = \"cal(-#$MAXW/2)\"\n\n else\n $HALW = \"cal(-#$COLS/2*(#$COLW+#$GUTW))\"\n $MAXW = \"cal(#$COLS*(#$COLW+#$GUTW))\"\n end\n $helper += \"\n /* extra breakpoint */\n @media (min-width: #$FROM){\n #grid {\n margin-left: #$HALW;\n max-width: #$MAXW; \n }\n #grid div.vert {\n background: #$COLBG;\n }\n }\n \"\n end\n $g += 1\n end\n\nreturn $helper\nend", "def represent\n # grid_array will be an array of strings that represent our grid in NxN format\n grid_array=[]\n @h.times{|r| grid_array<<@grid[r*@w,@w].split('')*' '}\n grid_array\n end", "def test_example_part_two\n input = ['1, 1', '1, 6', '8, 3', '3, 4', '5, 5', '8, 9'].join(\"\\n\")\n grid = Grid.new(input, true, 32)\n\n assert_equal 16, grid.region_size\n end", "def build_grid\n x = 0\n 10.times do\n row = []\n y = 0\n 10.times do\n row.push({display: \"~~\", ship: false, coord: [x, y]})\n y += 1\n end\n self.grid << row\n x += 1\n end\n p self.grid\n end", "def size=(dimension); end", "def grid\n if 1 <= poster_slot && poster_slot <= 66\n offset = 1\n number_per_row = 11\n total_rows = 6\n group = 1\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 67 <= poster_slot && poster_slot <= 96\n offset = 67\n number_per_row = 15\n group = 2\n total_rows = 2\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 97 <= poster_slot && poster_slot <= 144\n offset = 97\n number_per_row = 6\n group = 3\n total_rows = 8\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.odd? # invert\n elsif 145 <= poster_slot && poster_slot <= 184\n offset = 145\n number_per_row = 20\n group = 4\n total_rows = 2\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 185 <= poster_slot && poster_slot <= 284\n offset = 185\n number_per_row = 25\n group = 5\n total_rows = 4\n row = total_rows - 1 - (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n elsif 285 <= poster_slot && poster_slot <= 314\n offset = 285\n number_per_row = 5\n group = 6\n total_rows = 6\n row = (poster_slot - offset).div(number_per_row)\n col = (poster_slot - offset).modulo(number_per_row)\n col = number_per_row - 1 - col if row.even? # invert\n else\n return nil\n end\n Grid.new(col, row, group)\n end", "def grid(*)\n super\n end", "def create_grid\n @grid = {\"1a\" => \" \", \"1b\" => \" \", \"1c\" => \" \", \"1d\" => \" \", \"1e\" => \" \",\n \"2a\" => \" \", \"2b\" => \" \", \"2c\" => \" \", \"2d\" => \" \", \"2e\" => \" \",\n \"3a\" => \" \", \"3b\" => \" \", \"3c\" => \" \", \"3d\" => \" \", \"3e\" => \" \",\n \"4a\" => \" \", \"4b\" => \" \", \"4c\" => \" \", \"4d\" => \" \", \"4e\" => \" \",\n \"5a\" => \" \", \"5b\" => \" \", \"5c\" => \" \", \"5d\" => \" \", \"5e\" => \" \"}\n end", "def initialize(size = 3)\n @size = size\n @grid = Array.new(size) { Array.new(size) }\n end", "def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end", "def default_grid\n array = Array.new(8) { Array.new(8) }\n\n array[0][0] = Rook.new('white', [0,0], 'slide')\n array[1][0] = Knight.new('white', [1,0], 'step')\n array[2][0] = Bishop.new('white', [2,0], 'slide')\n array[3][0] = Queen.new('white', [3,0], 'slide')\n array[4][0] = King.new('white', [4,0], 'step')\n array[5][0] = Bishop.new('white', [5,0], 'slide')\n array[6][0] = Knight.new('white', [6,0], 'step')\n array[7][0] = Rook.new('white', [7,0], 'slide')\n array[0..7].each_with_index { |column, index| \n column[1] = Pawn.new('white', [index,1], 'step') }\n\n array[0][7] = Rook.new('black', [0,7], 'slide')\n array[1][7] = Knight.new('black', [1,7], 'step')\n array[2][7] = Bishop.new('black', [2,7], 'slide')\n array[3][7] = Queen.new('black', [3,7], 'slide')\n array[4][7] = King.new('black', [4,7], 'step')\n array[5][7] = Bishop.new('black', [5,7], 'slide')\n array[6][7] = Knight.new('black', [6,7], 'step')\n array[7][7] = Rook.new('black', [7,7], 'slide')\n array[0..7].each_with_index { |column, index| \n column[6] = Pawn.new('black', [index,6], 'step') }\n\n array\n end", "def create_grid\n grid = Array.new(6, Array.new(7, BLANK))\n end", "def initialize(size)\n @grid = Array.new(size) {Array.new(size, :N)}\n @size = size * size\n end", "def build_grid\n header = [\" \", \" a \", \" b \", \" c \", \" d \", \" e \", \" f \", \" g \", \" h \"]\n grid_display = @board.grid.map.with_index do |row, index|\n [8 - index] + build_row(row, index)\n end\n grid_display.unshift(header)\n end", "def grid\n @grid ||= if @opts.key? \"grid\"\n @opts.slice(\"grid\", \",\")\n else\n %w[0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%]\n end\n end", "def set_grid(grid)\r\n @grid = grid\r\n @size = grid.length\r\n calculate_number_of_neighbouring_bombs\r\n end", "def test_that_grid_generation_is_accurate\n end", "def initialize (width=7)\n @grid = Array.new(width) {[]}\n\n end", "def update\n update_grid = Array.new(@grid_height) { Array.new(@grid_width, 0) }\n update_grid.each_index do |row|\n update_grid[row].each_index do |col|\n num_neighbours = get_num_neighbours col, row\n if (@grid[row][col] == 1 && num_neighbours.between?(2, 3)) ||\n (@grid[row][col] == 0 && num_neighbours == 3)\n update_grid[row][col] = 1\n end\n end\n end\n @grid = update_grid\n end", "def set_grid_dimensions(row_count, col_count)\n \n # Forbid resetting grid dimensions\n if @grid_dimensions_set\n Vizkit.warn(\"Error: You may set grid dimensions before configuration only.\")\n return\n else\n @grid_dimensions_set = true\n end\n \n # Remove all parent widgets from grid.\n child = nil\n while(child = @grid.take_at(0)) \n widget = child.widget\n widget.set_parent(nil)\n widget = nil\n child = nil\n end\n \n # Generate container widgets with label if not yet existent\n counter = 0\n for row in 0..row_count-1 do\n for col in 0..col_count-1 do\n container = nil\n if not @container_hash[counter]\n widget_pos = (row * col_count) + col\n container = ContainerWidget.new(widget_pos)\n @container_hash[counter] = container\n else\n container = @container_hash[counter]\n end\n \n # Add parent widget to grid\n @grid.add_widget(container, row, col) # TODO does this make @grid the parent of the widget?\n container.show\n counter = counter + 1\n end\n end\n \n # Delete useless container widgets if any\n @container_hash.delete_if {|pos, conatiner| pos >= counter}\n \n end", "def cell_sizes?\n cell_w && cell_h\n end", "def initialize\n\t\t@grid = Array.new(10){Array.new(10)}\n\tend", "def gridit(xd, yd, zd, nx, ny)\n nd = equal_length(xd, yd, zd)\n inquiry [{ double: nx }, { double: ny }, { double: nx * ny }] do |px, py, pz|\n super(nd, xd, yd, zd, nx, ny, px, py, pz)\n end\n end", "def initialize\n\t\t@rows = 8\n\t\t@cols = 8\n\t\t@grid = Array.new(rows) { Array.new(cols) }\n\tend", "def initialize(width: 100, height: 100, size: 5)\n @width = width.clamp(0, 1000) # width of cell grid\n @height = height.clamp(0, 1000) # height of cell grid\n @size = size.clamp(3, 100) # size of each cell on viewport\n\n # calculate game viewport size\n @viewport_width = width * size\n @viewport_height = height * size\n\n # setup game environment\n @environment = Environment.new(\n width: width,\n height: height\n )\n\n # populate environment with random\n # population of live cells\n @environment.seed_random\n\n # setup tick\n @tick = Tick.new(@environment)\n\n # setup gosu window config\n super @viewport_width, @viewport_height\n self.caption = \"Game of Life\"\n end", "def render_grid\n\t\t@grid_w.times.with_index do |x|\n\t\t\t@grid_h.times.with_index do |y|\n\t\t\t\tif !@has_enviroment_rendered\n \t \t\trender_wall x, y if @grid[x][y]==1\n\t\t\t\tend\n\t\t \trender_player x, y if @grid[x][y]==2\n \tend\n end\n #each_cell do |x, y, v|\n # render_wall x, y if !@has_environment_rendered && v == 1 \n # render_player x, y if v == 2\n #end\n\t\t@has_enviroment_rendered = true\n\tend", "def draw_grid\n case view\n when :south_east\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, x, y)\n end\n end\n when :south_west\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, size_x - 1 - y, x)\n end\n end\n when :north_west\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, size_x - 1 - x, size_y - 1- y)\n end\n end\n when :north_east\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, y, size_y - 1 - x)\n end\n end\n else\n throw Exception.new(\"view was out of bounds!\")\n end\n\n end", "def grid_image\n s = ''\n s << \" %s %s %s \\n\" % [own(256), own(128), own(64)]\n s << \" %s %s %s \\n\" % [own(32), own(16), own(8)]\n s << \" %s %s %s \\n\" % [own(4), own(2), own(1)]\n s\n end", "def initialize(size = 20)\n @size = size\n @drivers = []\n @grid = []\n for i in 1..size\n temp = Array.new(size, '.')\n @grid << temp\n end\n end", "def proper_size\n unless (self.width.to_i * self.height.to_i) == self.gamedata.length || self.gamedata.length.zero?\n self.errors.add :gamedata, '-- The length of gamedata should be equal to the width times height. Your grid is %d pixels by %d pixels, so gamedata should be %d digits' % [self.width, self.height, (self.width.to_i * self.height.to_i)]\n end\n end", "def randomize\n (@grid_height * @grid_width / 5).times do\n @grid[rand(@grid_height)][rand(@grid_width)] = 1\n end\n end", "def create_grid_from_size(size_arr)\n rows = size_arr[0]\n columns = size_arr[1]\n Array.new(rows) { Array.new(columns) }\n end", "def printGrid(number_of_pieces)\n size = number_of_pieces.to_s.length\n print_horizontal_line((size+1) * @width + 1)\n \n (@height - 1).downto(0) do |hIdx|\n print '|'\n @width.times do |wIdx|\n print fixed_string(@grid[wIdx][hIdx].to_s, size)\n print ' ' if wIdx < @width - 1\n end\n print '|'\n print \"\\n\"\n end\n \n print_horizontal_line((size+1) * @width + 1)\n end", "def initiate_grid\n new_grid = []\n @width.times do |x|\n new_grid[x] = []\n @height.times do |y|\n new_grid[x][y] = 0\n end\n end\n new_grid\n end", "def console_grid\n i = self.height\n grid.map do |row|\n puts row.map { |cell| \"[#{cell.value.empty? ? \"_\" : cell.value}]\" }.join(\"\") + \" #{i}\"\n i-=1\n end\n end", "def show\n 1.upto(width).each { |x| print \" \" + \"#{x}\"}\n print \"\\n\"\n\n grid.each_with_index do |row, index|\n print \"#{index + 1} #{row} \\n\"\n end\n end", "def cells_grid_1by1\n [\n [\n MazeMagic::Maze::Edge.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::Edge.instance\n ],\n [\n MazeMagic::Maze::VerticalWall.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::VerticalWall.instance\n ]\n ]\n end", "def grid_nodes(width=@width, height=@height, nodeset=@nodes)\n num_cols = (Math.sqrt(nodeset.length)*(width/height)).ceil\n num_rows = (nodeset.length/num_cols.to_f).ceil\n col_len = width/num_cols\n row_len = height/num_rows\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = \n Vector[(0.5 + (i%num_cols))*col_len,(0.5 + (i/num_cols))*row_len] if !nodeset[key].static}\n end", "def default_grid\n Array.new(3) { Array.new(3) {Cell.new} }\n end", "def print_grid\n puts \"Generation: #{@generation}\"\n @width.times do |x|\n @height.times do |y|\n print \"#{@current_generation[x][y]}\" + \" \"\n end\n puts\n end\n puts \"-------------------------------------------------\"\n end", "def number_of_cells(size)\n size * size\n end", "def show_grid=(value)\n old = @show_grid\n @show_grid = value\n if old != @show_grid\n @array.each do |tile|\n if @show_grid\n if !tile.sprites[999]\n tile.sprites[999] = Sprite.new($visuals.viewport, {special: true})\n tile.sprites[999].set_bitmap(GRIDBITMAP)\n tile.sprites[999].x = tile.sprites[0].x\n tile.sprites[999].y = tile.sprites[0].y\n tile.sprites[999].z = 999\n end\n else\n if tile.sprites[999]\n tile.sprites[999].dispose\n tile.sprites.delete(999)\n end\n end\n end\n end\n end", "def prepare_grid\n\t\tArray.new(rows) do |row|\n\t\t\tArray.new(columns) do |col|\n\t\t\t\tCell.new(row, col)\n\t\t\tend\n\t\tend\n\tend", "def grid\n Matrix.build(@row_count, @column_count) { Cell.new }.to_a\n end", "def setCells(info, rows, maxcols, sub_size)\n if rows > @rows\n rows = @rows\n end\n\n # Copy in the new info.\n (1..rows).each do |x|\n (1..@cols).each do |y|\n if x <= rows && y <= sub_size[x]\n @info[x][y] = @info[x][y][0..[@colwidths[y], @info[x][y].size].min]\n else\n self.cleanCell(x, y)\n end\n end\n end\n end", "def print\n grid_array = []\n @height.times do |r|\n grid_array << @grid[r * @width, @width].split('') * ' '\n end\n grid_array\n end", "def gridmaxwidths ()\n # write a media query for each breakpoint\n $g = 0\n items = MEASURES\n $LEN = items.length\n $buffer = \"\"\n\n until $g == $LEN\n if $g == 0\n $NAME = 0\n $NAMETXT = \"default\"\n else\n $NAME = \"$bp-\" + items[$g]['NAME']\n $NAMETXT = $NAME\n end\n $FROM = items[$g]['FROM']\n $MAXW = items[$g]['MAXW']\n $buffer += \"\n /* #$NAMETXT breakpoint (#$FROM) */\n @media (min-width: #$NAME){\n .wrapbox {\n max-width: #$MAXW; \n }\n }\n \"\n\n $g += 1\n end\n\n return $buffer\nend", "def initialize(grid_size)\n @grid_size = grid_size\n @cell_ct = (grid_size * 2) + 1\n @board = Array.new(cell_ct){Array.new(cell_ct)}\n\n populate_board_guide(board)\n end", "def show \n for i in 0...size\n for j in 0...size\n print @grid[i][j] + \" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "def setup_grid\n empty_rows\n [:white, :light_yellow].each do |color|\n back_rows(color)\n pawn_rows(color)\n end\n end", "def settings\n size 400, 300\nend", "def default_grid\n Array.new(7) { Array.new(6) { Cell.new } }\n end", "def length\n grid_shape.length\n end", "def grid(cols, rows, col_size=1, row_size=1)\n (0..cols*rows).map do |i|\n x = col_size * (i % cols)\n y = row_size * i.div(cols)\n yield x, y\n end\n end", "def grid; @parameters['GRiD']; end", "def size\n\t\t@w * @h\n\tend", "def populate_grid\n start_rows = { red: (0..2), black: (5..7) }\n\n 8.times do |x|\n 8.times do |y|\n [:red, :black].each do |color|\n if (x + y).even? && start_rows[color].include?(y)\n self[[x, y]] = Piece.new(color, [x, y], self)\n end\n end\n end\n end\n\n grid.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n puts \"x=#{x}, y=#{y}, cell.class=#{cell.class}\"\n end\n end\n end", "def generate_grid(grid_size)\n # TODO: generate random grid of letters\n alphabet = (\"A\"..\"Z\").to_a\n grid = []\n grid_size.times { grid.push(alphabet[rand(1...alphabet.length)]) }\n grid\n end", "def col_max; [(width - standard_padding) / (24 + spacing), item_max].min; end", "def grid(cols, rows, col_size=1, row_size=1)\n (0...cols*rows).map do |i|\n x = col_size * (i % cols)\n y = row_size * i.div(cols)\n yield x, y\n end\n end", "def print_grid\n for i in 0..@height-1\n for j in 0..@width-1\n print @grid[i][j]\n print \" \"\n end\n print \"\\n\"\n end\n end", "def print_grid # prints 3 X 3 grid with values\n puts \"\\n\"\n @grid.each_slice(3) { |row| puts row.join(' | ') }\n puts \"\\n\"\n end", "def initialize(width=30, height=30, random=true, random_seed=[true,false].to_a)\n\n @width=width\n @height=height\n\n #create an array\n @cells = ConwayModel::create_grid(width, height, random, random_seed)\n end", "def setup_grid(skip_render, skip_set_pieces)\n @grid = Array.new(8) { Array.new(8) { EmptySquare.new } }\n unless skip_set_pieces\n set_major_minor\n set_pawns\n end\n\n render unless skip_render\n end", "def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end", "def draw_clues_windows(clues)\n heightpx = @board.height*@scale\n widthpx = @board.width*@scale\n windows = {}\n windows[:rows] = TkCanvas.new(@root, bg: \"#aaaaaa\") { grid(:row => 1, :column => 0) }\n windows[:rows].height = heightpx\n windows[:rows].width = (@scale*clues[:rows].map { |row| row.length }.max)\n windows[:columns] = TkCanvas.new(@root, bg: \"#aaaaaa\") { grid(:row => 0, :column => 1) }\n windows[:columns].height = (@scale*clues[:columns].map { |column| column.length }.max)\n windows[:columns].width = widthpx\n windows\n end", "def game_over \n # all the grid's cells are full and different numbers \n end", "def row(grid_size, row_num)\n row_values = ' ' * grid_size\n row_values[row_num - 1] = '*'\n row_values[grid_size / 2] = '*'\n row_values[grid_size - row_num] = '*'\n row_values\nend", "def test_grid\n t = TreeShape.new(8)\n count = 0\n t.grid.each_index do |xi|\n t.grid[xi].each_index do |yi|\n count += 1\n end\n end\n assert_equal(count, t.height * t.width)\n end", "def display_grid\n # variables for grid display\n @grid = \" A B C \\n\" \\\n \"1 #{@a1} | #{@b1} | #{@c1} \\n\" \\\n \" ---+---+--- \\n\" \\\n \"2 #{@a2} | #{@b2} | #{@c2} \\n\" \\\n \" ---+---+--- \\n\" \\\n \"3 #{@a3} | #{@b3} | #{@c3} \\n\"\n end", "def p11\n\tgrid = Matrix[\n\t\t[8,\t2, 22,97,38,15,0, 40,0, 75,4, 5, 7, 78,52,12,50,77,91,8],\n\t\t[49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,4, 56,62,0],\n\t\t[81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,3, 49,13,36,65],\n\t\t[52,70,95,23,4, 60,11,42,69,24,68,56,1, 32,56,71,37,2, 36,91],\n\t\t[22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80],\n\t\t[24,47,32,60,99,3, 45,2, 44,75,33,53,78,36,84,20,35,17,12,50],\n\t\t[32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70],\n\t\t[67,26,20,68,2, 62,12,20,95,63,94,39,63,8, 40,91,66,49,94,21],\n\t\t[24,55,58,5, 66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72],\n\t\t[21,36,23,9, 75,0, 76,44,20,45,35,14,0, 61,33,97,34,31,33,95],\n\t\t[78,17,53,28,22,75,31,67,15,94,3, 80,4, 62,16,14,9, 53,56,92],\n\t\t[16,39,5, 42,96,35,31,47,55,58,88,24,0, 17,54,24,36,29,85,57],\n\t\t[86,56,0, 48,35,71,89,7, 5, 44,44,37,44,60,21,58,51,54,17,58],\n\t\t[19,80,81,68,5, 94,47,69,28,73,92,13,86,52,17,77,4, 89,55,40],\n\t\t[4,\t52,8, 83,97,35,99,16,7, 97,57,32,16,26,26,79,33,27,98,66],\n\t\t[88,36,68,87,57,62,20,72,3, 46,33,67,46,55,12,32,63,93,53,69],\n\t\t[4,\t42,16,73,38,25,39,11,24,94,72,18,8, 46,29,32,40,62,76,36],\n\t\t[20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,4, 36,16],\n\t\t[20,73,35,29,78,31,90,1, 74,31,49,71,48,86,81,16,23,57,5, 54],\n\t\t[1,\t70,54,71,83,51,54,69,16,92,33,48,61,43,52,1, 89,19,67,48]\n\t]\n\tproducts = []\n\t(0...grid.row_count).each do |row|\n\t\t(0...grid.column_count).each do |col|\n\t\t\tright = col + 3 < grid.row_count\n\t\t\tdown = row + 3 < grid.column_count\n\t\t\tleft = col - 3 >= 0\n\t\t\tif right\n\t\t\t\tset = grid.minor(row..row,col..col+3)\n\t\t\t\tproducts << set.reduce(:*)\n\t\t\tend\n\t\t\tif down and right\n\t\t\t\tdiagonal = []\n\t\t\t\t(0..3).each do |x|\n\t\t\t\t\tdiagonal << grid.minor(row+x..row+x,col+x..col+x).component(0,0)\n\t\t\t\tend\n\t\t\t\tproducts << diagonal.reduce(:*)\n\t\t\tend\n\t\t\tif down\n\t\t\t\tset = grid.minor(row..row+3,col..col)\n\t\t\t\tproducts << set.reduce(:*)\n\t\t\tend\n\t\t\tif down and left\n\t\t\t\tdiagonal = []\n\t\t\t\t(0..3).each do |x|\n\t\t\t\t\tdiagonal << grid.minor(row+x..row+x,col-x..col-x).component(0,0)\n\t\t\t\tend\n\t\t\t\tproducts << diagonal.reduce(:*)\n\t\t\tend\n\t\tend\n\tend\n\tproducts.max\nend", "def initialize()\n @grid = []\n @rows = 0\n @cols = 0\n end", "def initialize\n @grid = []\n (0..5).each do |row|\n @grid[row] = []\n (0..6).each do |col|\n @grid[row][col] = \"_ \"\n end\n end\n end", "def grid(n, m)\n arr = Array.new(n) { Array.new(m, :N) }\n arr\nend", "def create_board(size, num_mines)\n\t\tfinal_board = []\n\t\t# Create outer loop\n\t\t1.upto(size) do |row|\n\t\t\trow_buffer = []\n\t\t\t# Create inner loop\n\t\t\t1.upto(size) do |column|\n\t\t\t\trow_buffer << Square.new([column,((size+1)-row)], size)\n\t\t\tend\n\t\t\t# Once each row is composed add it to \n\t\t\t# the final board.\n\t\t\tfinal_board << row_buffer\n\t\tend\n\t\tset_mines(final_board, num_mines) # Now that we have the board, lets add some mines\n\t\tfinal_board\n\tend", "def initialize\n\t\t @grid = []\n\t\t 9.times { @grid << \" \" }\n\t\tend", "def grid_nodes_in_box(nodeset=@nodes, topleft=Vector[0,0], size=Vector[@width,@height], spacing=Vector[0,0])\n num_cols = (Math.sqrt(nodeset.length)*(size[0]/size[1].to_f)).round\n num_rows = (nodeset.length/num_cols.to_f).ceil\n col_len = size[0]/num_cols\n row_len = size[1]/num_rows\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = \n Vector[topleft[0] + (0.5 + (i%num_cols))*col_len + spacing[0]*i, topleft[1] + (0.5 + (i/num_cols))*row_len + spacing[1]*i]}\n end", "def widthcell\n 10\n end", "def grid_params\n params.require(:grid).permit(:name, :title, :col, :size)\n end", "def render_gridlines_if_needed args\n if args.state.show_gridlines && args.static_lines.length == 0\n args.static_lines << 65.times.map do |i|\n [\n [CENTER_OFFSET + i * TINY_SCALE + 1, 0,\n CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128],\n [CENTER_OFFSET + i * TINY_SCALE, 0,\n CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128],\n [CENTER_OFFSET, 0 + i * TINY_SCALE,\n CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128],\n [CENTER_OFFSET, 1 + i * TINY_SCALE,\n CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128]\n ]\n end\n elsif !args.state.show_gridlines\n args.static_lines.clear\n end\nend", "def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end", "def grid_modified!\n end", "def grids\n @grids ||= {}\n end", "def draw_grid_square(x,y,color,z,padding=0,xmargin=@xmargin,ymargin=@ymargin)\n super\n end", "def grid\n rows = []\n (1..self.height).to_a.each do |h|\n rows << row(h)\n end\n rows.reverse\n end", "def create_grid\n spaces = create_spaces\n assign_spaces_to_rows.map do |row|\n row.each.with_index do |coordinates, index|\n row[index] = {coordinates => spaces[coordinates]}\n end\n end\n end", "def tile_size level\n\t\t\t2 ** level\n\t\tend", "def resize_gfx_points(players)\r\n left_align_off = 20\r\n offlbl_y = 20\r\n start_toty = 110\r\n #label for scopa\r\n players.each do |pl_match|\r\n player_label = pl_match.name.to_sym\r\n lbl_gfx_scopa = @points_status[player_label][:widg_scopa]\r\n lbl_gfx_tot = @points_status[player_label][:widg_tot] \r\n \r\n lbl_gfx_scopa.pos_x = left_align_off\r\n lbl_gfx_tot.pos_x = left_align_off\r\n \r\n if pl_match.type == :human_local\r\n human_start_toty = start_toty - 30\r\n #lbl_gfx_scopa.pos_y = @curr_canvas_info[:height] - ( human_start_toty + 2 * offlbl_y)\r\n #lbl_gfx_tot.pos_y = @curr_canvas_info[:height] - ( human_start_toty + 3 * offlbl_y) \r\n lbl_gfx_scopa.pos_y = @model_canvas_gfx.info[:canvas][:height] - ( human_start_toty + 2 * offlbl_y)\r\n lbl_gfx_tot.pos_y = @model_canvas_gfx.info[:canvas][:height] - ( human_start_toty + 3 * offlbl_y) \r\n else\r\n lbl_gfx_scopa.pos_y = start_toty + offlbl_y\r\n lbl_gfx_tot.pos_y = start_toty\r\n end\r\n end\r\n end", "def repack\n @widths = Array.new(@rows.empty? ? 0 : @rows[0].size, 0)\n @heights = Array.new(@rows.size, 0)\n\n filled_columns = []\n filled_rows = []\n\n # Calculate the maximum widths of each column and the maximum height of each row.\n @rows.each_with_index do |row, row_num|\n row.each_with_index do |element, column_num|\n fills = (element.align_h == :fill)\n @widths[column_num] = [fills ? element.min_width : element.outer_width, @widths[column_num]].max\n filled_columns.push fills\n\n fills = (element.align_v == :fill)\n @heights[row_num] = [fills ? element.min_width : element.outer_height, @heights[row_num]].max\n filled_rows.push fills\n end\n end\n\n # Expand the size of each filled column to make the minimum size required.\n unless @widths.empty?\n num_filled_columns = filled_columns.select {|value| value }.count\n total_width = @widths.inject(0, :+) + (padding_left + padding_right) + ((@num_columns - 1) * spacing_h)\n extra_width = min_width - total_width\n if extra_width > 0\n if num_filled_columns > 0\n @widths[filled_columns.index true] += extra_width\n else\n @widths[-1] += extra_width\n end\n end\n end\n\n # Expand the size of each filled row to make the minimum size required.\n unless @heights.empty?\n num_filled_rows = filled_rows.select {|value| value }.count\n total_height = @heights.inject(0, :+) + (padding_left + padding_right) + ((@num_rows - 1) * spacing_v)\n extra_height = min_height - total_height\n if extra_height > 0\n if num_filled_rows > 0\n @heights[filled_rows.index true] += extra_height\n else\n @heights[-1] += extra_height\n end\n end\n end\n\n # Actually place all the elements into the grid positions, modified by valign and align.\n current_y = y + padding_top\n @rows.each_with_index do |row, row_num|\n current_x = x + padding_left\n\n row.each_with_index do |element, column_num|\n element.x = current_x + element.border_thickness\n\n case element.align_h # Take horizontal alignment into consideration.\n when :fill\n if element.width < @widths[column_num]\n element.width = @widths[column_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.x += (@widths[column_num] - element.width) / 2\n when :right\n element.x += @widths[column_num] - element.width\n end\n\n current_x += @widths[column_num]\n current_x += spacing_h unless column_num == @num_columns - 1\n\n element.y = current_y + element.border_thickness\n\n case element.align_v # Take horizontal alignment into consideration.\n when :fill\n if element.height < @heights[row_num]\n element.height = @heights[row_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.y += (@heights[row_num] - element.height) / 2\n when :bottom\n element.y += @heights[row_num] - element.height\n else\n end\n end\n\n self.width = current_x - x + padding_left if row_num == 0\n\n current_y += @heights[row_num] unless row.empty?\n current_y += spacing_h unless row_num == num_rows - 1\n end\n\n self.height = current_y - y + padding_top\n\n nil\n end", "def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << nil\n end\n grid << row\n end\n grid\n end", "def width\n TILE_WIDTH\n end", "def scale_up(cell)\n if cell.size == 2\n return {\n x: cell.x * grid.cell_size,\n y: cell.y * grid.cell_size,\n w: grid.cell_size,\n h: grid.cell_size\n }\n else\n return {\n x: cell.x * grid.cell_size,\n y: cell.y * grid.cell_size,\n w: cell.w * grid.cell_size,\n h: cell.h * grid.cell_size\n }\n end\n end", "def size\n\t\t@rows * @columns\n\tend", "def display\n p \"#{@grid[0..2].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[3..5].join(\" | \")}\"\n p \"--|---|--\"\n p \"#{@grid[6..8].join(\" | \")}\"\n\n end", "def grid\n @grid ||= {}\nend" ]
[ "0.7394661", "0.678781", "0.6545926", "0.6526463", "0.6403333", "0.6317571", "0.6317076", "0.6288921", "0.6278691", "0.6259219", "0.6254892", "0.62515086", "0.6251438", "0.6251086", "0.62305075", "0.616885", "0.61599207", "0.6143663", "0.6141863", "0.61374235", "0.613372", "0.6128271", "0.61142945", "0.6109837", "0.61094654", "0.60906863", "0.6050216", "0.60383934", "0.6032551", "0.6030283", "0.6019041", "0.6007862", "0.59987766", "0.5996167", "0.59585816", "0.59147686", "0.59041625", "0.59035444", "0.59012496", "0.58976454", "0.58808744", "0.58771515", "0.58679694", "0.5860478", "0.5844216", "0.5834424", "0.5827286", "0.5820565", "0.5799988", "0.57871586", "0.5779219", "0.5778003", "0.5775726", "0.57751596", "0.57719463", "0.5763844", "0.57588017", "0.5747312", "0.5739142", "0.5736044", "0.5733752", "0.57337385", "0.57311434", "0.5728471", "0.5724453", "0.5723802", "0.57208323", "0.5704932", "0.5704815", "0.5696904", "0.5692055", "0.56886935", "0.56866884", "0.56865376", "0.56863606", "0.56840163", "0.5666861", "0.56617093", "0.56552905", "0.5645915", "0.5643421", "0.56419307", "0.56381375", "0.5632028", "0.56316406", "0.56214124", "0.56155366", "0.5612399", "0.561218", "0.56095946", "0.5605885", "0.5596645", "0.5594625", "0.5584703", "0.5579867", "0.5576303", "0.55710655", "0.556457", "0.55540156", "0.5553123", "0.5548354" ]
0.0
-1
Esto debe ser par las graficas
def espacios_disponibles_carros Space.where(sp_state: false, sp_type: 'CARRO').count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graficas\n end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def subgenres; end", "def gallaries\n paintings.map{|paint| paint.gallery}\n\n end", "def locations; end", "def getgraphics(*)\n super.to_s\n end", "def legionnairs\n\n end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def relatorios\n end", "def groups; end", "def groups; end", "def groups; end", "def probers; end", "def variables; end", "def variables; end", "def get_grasas\n @_100=((@grasas*100)/@peso)\n @ir_100=(@_100/70)*100\n @porcion=((@grasas*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/70)*100\n [ @grasas , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end", "def values() end", "def mapping; end", "def mapping; end", "def initialize\r\n @grafo = Hash.new()\r\n end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def private; end", "def registers; end", "def components; end", "def get_glade_all(obj = self)\r\n get_glade_active_record(obj)\r\n get_glade_variables(obj)\r\n end", "def fields_map\n super.merge({\n sub_collection_title: \"#{sub_collection_xpath}/#{Ead::SubCollection.fields_map[:title]}\",\n sub_collection_id: \"#{sub_collection_xpath}/#{Ead::SubCollection.fields_map[:id]}\", \n series_title: \"#{series_xpath}/#{Ead::Series.fields_map[:title]}\",\n series_id: \"#{series_xpath}/#{Ead::Series.fields_map[:id]}\"\n })\n end", "def guct\n end", "def objects; end", "def map\n end", "def map\n\n end", "def load_Obj\n @grupos = Grupo.all\n @nivels = Nivel.select(:id, :nombre).where(\"nombre != ?\", \"CAPITULO\" )\n# @papa = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ? \", false, true) \n @ajuste = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ?\", true, true )\n @laux = Libroauxiliar.select(:id, :descripcion).where(\"activo = ?\", true)\n end", "def home\n @all_properties = Property.all\n @all_categories = Category.all\n @all_components = Component.all\n @all_products = Product.all\n @all_images = Image.all\n @all_datafiles = DataFile.all\n @all_aliases = TableAlias.all.sort {|x,y| x.tableName <=> y.tableName }\n end", "def values_for_properties; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def profiles; end", "def zuruecksetzen()\n end", "def _defensio_keys\n self.class._defensio_keys\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def letzte_komponente\n \n end", "def i_groups; end", "def fill_from_gemo\r\n end", "def list_of_pvas\n super\n end", "def calculate_projections\r\n Runtime::Projections.setup\r\n end", "def index\n @germinations = Germination.all\n #Para traer todas las imagenes\n @pictures = GeneticBankPicture.group(:genetic_bank_id) \n @germinationsGrid = initialize_grid(Germination,\n include: [:seed])\n @geneticBankImagesPath = \"/assets/images/geneticBank/\"\n end", "def map_name; end", "def labels; end", "def fields; end", "def fields; end", "def fields; end", "def renglon_a_grafica\n\t\tgenera_renglon_total\n\t\tdevuelto = Hash.new\n\t\t@renglones_reporte[0].id_columnas.each do |key|\n\t\t\tdevuelto[key] = @total[key][:promedio]\n\t\tend\n\t\tdevuelto\n\tend", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def sichtbar_machen()\n # TODO\n end", "def properties\n []\n end", "def map\n end", "def map\n end", "def sichtbar_machen()\n end", "def sitemaps; end", "def galleries\n self.paintings.map{|painitng| painitng.gallery}.uniq\n end", "def sichtbar_machen\n @backgrund.sichtbar_machen\n @baum1.sichtbar_machen\n @baum2.sichtbar_machen\n @baum3.sichtbar_machen\n @haus1.sichtbar_machen\n @haus2.sichtbar_machen\n @haus3.sichtbar_machen\n @hund1.sichtbar_machen\n @hund2.sichtbar_machen\n end", "def get_map;\t@map \t\tend", "def configurations; end", "def keys; @caesars_properties.keys; end", "def collections; end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def keys\n end", "def packages; end", "def catalog; end", "def lookups; end", "def mi_carrera\n\n\tend", "def atributos\n p \"El Modelo del carro es: #{@modelo}, la Marca es: #{@marca} y el Color es: #{@color}\"\n end", "def formation; end", "def keys\n end" ]
[ "0.7505228", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6015003", "0.59437126", "0.58620274", "0.5850691", "0.5816513", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.56836236", "0.5636026", "0.5636026", "0.5636026", "0.5621913", "0.5597821", "0.5597821", "0.5570125", "0.555868", "0.55460566", "0.55460566", "0.5523911", "0.55230796", "0.55230796", "0.55230796", "0.55230796", "0.55230796", "0.54967684", "0.5495519", "0.5492353", "0.5487232", "0.5478441", "0.54772586", "0.5469115", "0.54655284", "0.545442", "0.5432029", "0.54274", "0.5414975", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.54086906", "0.54085684", "0.5400385", "0.5392317", "0.5392317", "0.5392317", "0.5392317", "0.5378076", "0.53766584", "0.5357877", "0.5356322", "0.5351026", "0.5347098", "0.534682", "0.5346575", "0.5343318", "0.5343318", "0.5343318", "0.5339326", "0.5330988", "0.53305286", "0.5326229", "0.531741", "0.531741", "0.5309882", "0.5301722", "0.53016895", "0.5299535", "0.52914166", "0.52853864", "0.52776074", "0.5277281", "0.5274501", "0.5274501", "0.5274501", "0.52682114", "0.5265525", "0.5264875", "0.52620876", "0.5262075", "0.52477074", "0.52295744", "0.52275705" ]
0.0
-1
Esto debe ser par las graficas
def espacios_disponibles_motos Space.where(sp_state: false, sp_type: 'MOTO').count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graficas\n end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def properties; end", "def subgenres; end", "def gallaries\n paintings.map{|paint| paint.gallery}\n\n end", "def locations; end", "def getgraphics(*)\n super.to_s\n end", "def legionnairs\n\n end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def annotations; end", "def relatorios\n end", "def groups; end", "def groups; end", "def groups; end", "def probers; end", "def variables; end", "def variables; end", "def get_grasas\n @_100=((@grasas*100)/@peso)\n @ir_100=(@_100/70)*100\n @porcion=((@grasas*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/70)*100\n [ @grasas , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end", "def values() end", "def mapping; end", "def mapping; end", "def initialize\r\n @grafo = Hash.new()\r\n end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def private; end", "def registers; end", "def components; end", "def get_glade_all(obj = self)\r\n get_glade_active_record(obj)\r\n get_glade_variables(obj)\r\n end", "def fields_map\n super.merge({\n sub_collection_title: \"#{sub_collection_xpath}/#{Ead::SubCollection.fields_map[:title]}\",\n sub_collection_id: \"#{sub_collection_xpath}/#{Ead::SubCollection.fields_map[:id]}\", \n series_title: \"#{series_xpath}/#{Ead::Series.fields_map[:title]}\",\n series_id: \"#{series_xpath}/#{Ead::Series.fields_map[:id]}\"\n })\n end", "def guct\n end", "def objects; end", "def map\n end", "def map\n\n end", "def load_Obj\n @grupos = Grupo.all\n @nivels = Nivel.select(:id, :nombre).where(\"nombre != ?\", \"CAPITULO\" )\n# @papa = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ? \", false, true) \n @ajuste = Catalogo.select(:id, :codigo, :nombre).where(\"estransaccional = ? AND activo = ?\", true, true )\n @laux = Libroauxiliar.select(:id, :descripcion).where(\"activo = ?\", true)\n end", "def home\n @all_properties = Property.all\n @all_categories = Category.all\n @all_components = Component.all\n @all_products = Product.all\n @all_images = Image.all\n @all_datafiles = DataFile.all\n @all_aliases = TableAlias.all.sort {|x,y| x.tableName <=> y.tableName }\n end", "def values_for_properties; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def values; end", "def profiles; end", "def zuruecksetzen()\n end", "def _defensio_keys\n self.class._defensio_keys\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def letzte_komponente\n \n end", "def i_groups; end", "def fill_from_gemo\r\n end", "def list_of_pvas\n super\n end", "def calculate_projections\r\n Runtime::Projections.setup\r\n end", "def index\n @germinations = Germination.all\n #Para traer todas las imagenes\n @pictures = GeneticBankPicture.group(:genetic_bank_id) \n @germinationsGrid = initialize_grid(Germination,\n include: [:seed])\n @geneticBankImagesPath = \"/assets/images/geneticBank/\"\n end", "def map_name; end", "def labels; end", "def fields; end", "def fields; end", "def fields; end", "def renglon_a_grafica\n\t\tgenera_renglon_total\n\t\tdevuelto = Hash.new\n\t\t@renglones_reporte[0].id_columnas.each do |key|\n\t\t\tdevuelto[key] = @total[key][:promedio]\n\t\tend\n\t\tdevuelto\n\tend", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def sichtbar_machen()\n # TODO\n end", "def properties\n []\n end", "def map\n end", "def map\n end", "def sichtbar_machen()\n end", "def sitemaps; end", "def galleries\n self.paintings.map{|painitng| painitng.gallery}.uniq\n end", "def sichtbar_machen\n @backgrund.sichtbar_machen\n @baum1.sichtbar_machen\n @baum2.sichtbar_machen\n @baum3.sichtbar_machen\n @haus1.sichtbar_machen\n @haus2.sichtbar_machen\n @haus3.sichtbar_machen\n @hund1.sichtbar_machen\n @hund2.sichtbar_machen\n end", "def get_map;\t@map \t\tend", "def configurations; end", "def keys; @caesars_properties.keys; end", "def collections; end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def galleries\n paintings.map do |painting|\n painting.gallery\n end\n end", "def keys\n end", "def packages; end", "def catalog; end", "def lookups; end", "def mi_carrera\n\n\tend", "def atributos\n p \"El Modelo del carro es: #{@modelo}, la Marca es: #{@marca} y el Color es: #{@color}\"\n end", "def formation; end", "def keys\n end" ]
[ "0.7505228", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6028549", "0.6015003", "0.59437126", "0.58620274", "0.5850691", "0.5816513", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.5795069", "0.56836236", "0.5636026", "0.5636026", "0.5636026", "0.5621913", "0.5597821", "0.5597821", "0.5570125", "0.555868", "0.55460566", "0.55460566", "0.5523911", "0.55230796", "0.55230796", "0.55230796", "0.55230796", "0.55230796", "0.54967684", "0.5495519", "0.5492353", "0.5487232", "0.5478441", "0.54772586", "0.5469115", "0.54655284", "0.545442", "0.5432029", "0.54274", "0.5414975", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.5414925", "0.54086906", "0.54085684", "0.5400385", "0.5392317", "0.5392317", "0.5392317", "0.5392317", "0.5378076", "0.53766584", "0.5357877", "0.5356322", "0.5351026", "0.5347098", "0.534682", "0.5346575", "0.5343318", "0.5343318", "0.5343318", "0.5339326", "0.5330988", "0.53305286", "0.5326229", "0.531741", "0.531741", "0.5309882", "0.5301722", "0.53016895", "0.5299535", "0.52914166", "0.52853864", "0.52776074", "0.5277281", "0.5274501", "0.5274501", "0.5274501", "0.52682114", "0.5265525", "0.5264875", "0.52620876", "0.5262075", "0.52477074", "0.52295744", "0.52275705" ]
0.0
-1
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) lowest = [] name_hash.each do |key, value| lowest << value end low = [] if lowest[0] == nil nil elsif lowest[0] < lowest[1] && lowest[0] < lowest[2] low << lowest[0] elsif lowest[1] < lowest[0] && lowest[1] < lowest[2] low << lowest[1] elsif lowest[2] < lowest[0] && lowest[2] < lowest[1] low << lowest [2] else nil end winner = [] name_hash.each do |key, value| if value == low[0] winner << key end end winner[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n \n min_val = Float::INFINITY\n min_key = nil\n hash.each do |k, v|\n if min_val > v\n min_val = v\n min_key = k\n end\n end\n return min_key\nend", "def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend", "def key_for_min_value(hash)\n int_hash = hash.select { |key, val| val.class == Fixnum }\n smallest = int_hash[int_hash.keys.sample]\n # debugger\n int_hash.each do |key, val|\n if val < smallest\n smallest = val \n end\n end\n int_hash.key(smallest)\nend", "def key_for_min_value(hash)\r\n smallest_key = nil\r\n tiniest_value = nil\r\n hash.each do |key, value|\r\n if tiniest_value == nil || value < tiniest_value\r\n tiniest_value = value\r\n smallest_key = key\r\n end\r\n end\r\n smallest_key\r\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = 0\n\n\n hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n min = nil\n hash.each_pair do |key, value|\n min ||= value\n min = value if value < min\n end\n hash.key(min)\nend", "def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |key, value|\n if hash_value == nil || value < hash_value\n hash_value = value\n hash_key = key\n end\n end\n hash_key\nend", "def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n min = 99999999\n min_key = nil\n hash.select do |key, value|\n if value < min\n min = value\n min_key = key\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend", "def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend", "def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil \n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value \n lowest_value = value \n lowest_key = key \n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowestnum = 1000\n name_hash.each_value do |hashvalue|\n if hashvalue < lowestnum\n lowestnum = hashvalue\n end\n end\n name_hash.index(lowestnum)\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_number = nil\n name_hash.each do |name, number|\n if lowest_number == nil || number < lowest_number\n lowest_number = number\n lowest_key = name\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n # first iteration\n ## this creates a starting point for comparison\n if lowest_value == nil || lowest_value > v\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n low = Float::INFINITY\n name_hash.each do |k,v|\n if v < low\n low = v\n end\n end\n name_hash.key(low)\nend", "def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend", "def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend", "def key_for_min_value(name_hash)\n lowest = nil\n key = nil\n if name_hash.length == 0\n return \n end\n \n name_hash.each do |name, number|\n if lowest == nil\n lowest = number\n end\n if key == nil\n key = name\n end\n if number < lowest\n lowest = number\n key = name\n end\n end\n key\nend", "def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend", "def key_for_min_value(name_hash)\n\tif name_hash == {}\n\t\tnil\n\tend\n\n\tsmallest_key = nil\n\tsmallest_value = nil\n\tname_hash.each do |key, value|\n\t\tif !smallest_value || value < smallest_value\n\t\t\tsmallest_key = key\n\t\t\tsmallest_value = value\n\t\tend\n\tend\n\tsmallest_key\nend", "def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |name, amount|\n if amount < lowest_value\n lowest_value = amount\n lowest_key = name\n end\n end\n lowest_key\n end", "def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end", "def key_for_min_value(hash)\n\n lowest_key = nil \n lowest_value = nil \n \n hash.each do |key,value|\n if lowest_value == nil || lowest_value > value\n\n lowest_key = key\n lowest_value = value \n end \n \n end \n lowest_key\nend", "def key_for_min_value(name_hash)\n small_num = Float::INFINITY\n smallest_key = \"\"\n if name_hash.length == 0\n return nil\n end\n name_hash.each do |key, value|\n if value < small_num\n small_num = value\n smallest_key = key\n end\n end\nsmallest_key\nend", "def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend", "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend", "def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend", "def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_value=Float::INFINITY\n name_hash.each{|key, value| \n if value<lowest_value\n lowest_value=value\n lowest_key=key\n end\n }\n lowest_key\nend", "def key_for_min_value(name_hash)\n empty_hash = nil\n lowest_value = 10000000000000000000000\n name_hash.collect do |name, value|\n if value < lowest_value\n lowest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend", "def key_for_min_value(name_hash)\n lowest = \"\"\n lowest = nil if name_hash.empty?\n high_num = 100000000000000000\n name_hash.each do | key, value |\n lowest = key if value < high_num\n high_num = value if value < high_num\n end\n lowest\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name, num|\n if lowest_key == nil || num < lowest_value\n lowest_key = name\n lowest_value = num\n elsif name_hash == nil\n nil\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n num = nil\n name_hash.collect do |key, value|\n if value < num\n num = value\n end\n end \n name_hash.key(num)\nend", "def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = nil\n name_hash.each do|key, val|\n if smallest_val == 0 || val < smallest_val\n smallest_val = val\n smallest_key = key\n end\n end\n smallest_key\n\nend", "def key_for_min_value(name_hash)\n smallest_hash_key = nil\n name_hash.each do |key, val|\n if smallest_hash_key == nil\n smallest_hash_key = key\n next\n elsif val < name_hash[smallest_hash_key]\n smallest_hash_key = key\n end\n end\n smallest_hash_key\nend", "def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend", "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_number = name_hash.first[1];\n key_value = \"\"\n name_hash.each do |key, value|\n if value <= lowest_number\n lowest_number = value\n key_value = key\n end\n end\n key_value\nend", "def key_for_min_value(name_hash)\n current = 0\n lowest = 0\n lowest_key = nil\n name_hash.collect do |key, value|\n current = value\n if current < lowest || lowest == 0\n lowest = current\n lowest_key = key\n end\n\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowestvalue = 1000\n name_hash.each do |name, value|\n if value < lowestvalue\n lowest_key = name\n lowestvalue = value\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n small_value = 10000000000\n small_key = nil\n name_hash.each do |k,v|\n if v < small_value\n small_value = v\n small_key = k\n end\n end\n small_key\nend", "def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |k, v|\n if low_value == nil || v < low_value\n low_value = v\n low_key = k\n end\n end\n low_key\n end", "def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil # tell me if this makes sense\n lowest_value = value\n lowest_key = key\n elsif lowest_value > value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key #you want to return the key for min\nend", "def key_for_min_value(hash)\n \n if hash.empty?\n return nil\n end\n min_value=500\n min_key=:symbol\n \n hash.each do |key, value|\n if value<min_value\n min_value=value\n min_key=key\n end\n end\n return min_key\nend", "def key_for_min_value(name_hash)\n lowestKey = nil\n lowestValue = Float::INFINITY\n name_hash.each do |k, v|\n if v < lowestValue\n lowestValue = v\n lowestKey = k\n end\n end\n lowestKey\n\nend", "def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = 0\n comp = nil\n name_hash.each do |key,val|\n comp = val\n if smallest_key == 0\n smallest_key = key\n smallest_val = val\n end \n if comp < smallest_val\n smallest_val = comp\n smallest_key = key\n end\n end\n if smallest_key == 0 \n return nil \n else\n return smallest_key\n end\nend", "def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_val=0\n name_hash.collect do |key,value|\n if value<lowest_val or lowest_val==0\n lowest_key=key\n lowest_val=value\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend", "def key_for_min_value(name_hash)\n rkey = nil\n rvalue = 10000000000000000\n name_hash.each do |key, value|\n if value < rvalue\n rkey = key\n rvalue = value\n end\n end\n rkey\nend", "def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend", "def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n hash.key(hash.values.min)\nend", "def key_for_min_value(hash)\n hash.key(hash.values.min)\nend", "def key_for_min_value(name_hash)\n smallest_value = 100\n name_hash.each do |key, value| \n if value < smallest_value\n smallest_value = value \n end \n end\n name_hash.key(smallest_value)\nend", "def key_for_min_value(name_hash)\n lowest=\"\"\n lowest=nil if name_hash.empty?\n tracker=100000000\n name_hash.each do |key,value|\n lowest=key if value<tracker\n tracker=value if value<tracker\n # if value<tracker\n end\n lowest\nend", "def key_for_min_value(name_hash)\n if name_hash.length == 0 \n nil\n else\n smallest_num = nil\n smallest_num_key = nil\n name_hash.collect do |key, value|\n if smallest_num == nil\n smallest_num = value\n smallest_num_key = key\n elsif smallest_num > value\n smallest_num = value\n smallest_num_key = key\n end\n end\n smallest_num_key\n end\n\nend", "def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |n, s|\n if low_value == nil\n low_value = s\n low_key = n\n elsif low_value > s\n low_value = s\n low_key = n\n end\n end\n low_key\nend", "def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend", "def key_for_min_value(name_hash)\n lowestId = nil\n lowestNum = 0\n name_hash.each{ |id, val|\n if lowestNum == 0 \n lowestNum = val\n end\n if val <= lowestNum\n lowestNum = val\n lowestId = id\n end\n }\n return lowestId\nend", "def key_for_min_value(name_hash)\n lowest_v = nil\n lowest_k = nil\n name_hash.each do |name, value|\n if lowest_v == nil\n lowest_v = value\n lowest_k = name\n elsif value < lowest_v\n lowest_v = value\n lowest_k = name\n end\n end\n lowest_k\n end", "def key_for_min_value(name_hash)\n smallest_key = nil\n smallest_value = nil\n name_hash.each do |j, r|\n if smallest_value == nil || r < smallest_value\n smallest_value = r\n smallest_key = j\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\nlowest = 1000000\n low_key = nil\n name_hash.each {|key, value|\n if value < lowest\n lowest = value\n low_key = key\n end\n }\n low_key\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n name_hash.each_key do |key|\n if lowest_key == nil\n lowest_key = key\n elsif name_hash[key] < name_hash[lowest_key]\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n\n if name_hash.empty?\n return nil\n end\n lowest = Float::INFINITY\n name_hash.each_pair do |k, v|\n if v < lowest\n lowest = v\n end\n end\n name_hash.each_pair do |k, v|\n if v == lowest\n return k\n end\n end\nend", "def key_for_min_value(name_hash)\n output = 0\n smallest = nil\n name_hash.map do |key, value|\n if value < output || output == 0\n output = value\n smallest = key\n end\n end\n\n smallest\nend", "def key_for_min_value(my_hash)\n #what is my value?\n lowest_value = 500\n lowest_key = nil\n\n my_hash.collect do |key, value|\n # what is my value?\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowest_num = 1000000000\n lowest_num_key = \" \"\n if name_hash == {}\n return nil\n else\n name_hash.each do |name, num|\n if num < lowest_num\n lowest_num = num\n lowest_num_key = name\n end\n end\n return lowest_num_key\n end\nend", "def key_for_min_value(name_hash)\n nums = name_hash.collect do |item, num|\n num\n end\n nums.sort!\n nums[0]\n \n min_key = nil\n name_hash.map do |item, num|\n if num == nums[0]\n min_key = item\n end\n end\n min_key\nend", "def key_for_min_value(name_hash)\n vals = name_hash.collect { |key, value| value }\n keys = name_hash.collect { |key, value| key }\n low = vals[0]\n lowkey = keys[0]\n if name_hash.empty?\n nil\n else\n name_hash.collect do |key, value|\n if value < low\n low = value\n lowkey = key\n end\n end\n lowkey\n end\nend", "def key_for_min_value(name_hash)\n value1 = 0\n lowestKey = nil\n name_hash.each do |key, value|\n if(value1 == 0)\n value1 = value\n lowestKey = key\n end\n if(value1 > value)\n value1 = value\n lowestKey = key\n elsif (value1 < value)\n lowestKey = lowestKey\n value1 = value1\n end\n end\n return lowestKey\nend", "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend", "def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend", "def key_for_min_value(name_hash)\n key = \"\"\n low_value = nil\n if name_hash.empty? == true\n return nil\n end\n name_hash.each do |name, number|\n if low_value == nil || number < low_value\n low_value = number\n key = name\n end\n end\n key\nend", "def key_for_min_value(name_hash)\n answer = nil\n smallest = nil\n name_hash.each {|key, value|\n if smallest.nil?\n smallest = value\n end\n if value <= smallest\n smallest = value\n answer = key\n end\n }\n answer\nend", "def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend", "def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = \"\"\n if name_hash.empty? == true\n nil\n else\n name_hash.each_with_index do |(key, value), i|\n if i == 0\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\n end\nend", "def key_for_min_value(name_hash)\n low=10000000000000000000\n return_key=nil\n name_hash.each do |key, value|\n if value<low\n low=value\n return_key=key\n end\n end\n return_key\nend", "def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend", "def key_for_min_value(name_hash)\n \n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name_key, name_value|\n if lowest_value == nil || name_value < lowest_value\n lowest_value = name_value\n lowest_key = name_key\n end\n end\n lowest_key\n \n end", "def key_for_min_value(name_hash)\n the_key = nil \n the_value = 1/0.0\n # Infinity...can also be expressed as FLOAT::Infinity\n name_hash.each do |id, num|\n if num <= the_value\n the_value = num\n the_key = id\n end\n end\n the_key\nend", "def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |k,v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end \nend\nlowest_key\nend", "def key_for_min_value(name_hash)\n return nil if name_hash == {}\n smallest_key = name_hash.first[0]\n smallest_val = name_hash.first[1]\n\n name_hash.each do |pair|\n if pair[1] < smallest_val\n smallest_key = pair[0]\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend", "def key_for_min_value(name_hash)\n smallest_value = Float::INFINITY\n key_for_smallest_val = nil\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_for_smallest_val = key\n end \n end \n key_for_smallest_val\nend", "def key_for_min_value(name_hash)\n minKey = nil\n minVal = 2 ** (64 - 2) - 1\n name_hash.each {|key, value|\n if value < minVal\n minVal = value\n minKey = key\n end}\n minKey\nend", "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n lowest_number = nil\n name_hash.collect do |name, value|\n if lowest_number == nil\n lowest_number = value\n elsif lowest_number > value\n lowest_number = value\n end\n end\n \n name_hash.each do |name, value|\n if lowest_number == value\n return name\n end\n end\nend", "def key_for_min_value(hash)\n min_value = hash.values.min\n keys = hash.collect do |key, num|\n \tkey if num == min_value\n end\n keys\nend", "def key_for_min_value(name_hash)\n lowest_value = nil\n key_value = nil\n name_hash.collect do |name, number|\n if lowest_value == nil || number < lowest_value\n lowest_value = number\n key_value = name\n end\n end\n key_value\nend", "def key_for_min_value(name_hash)\n smallest_value = 1/0.0\n key_of_smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value > value\n key_of_smallest_value = key\n smallest_value = value\n end\n end\n return key_of_smallest_value\nend" ]
[ "0.8821222", "0.8777674", "0.87769854", "0.8745862", "0.8689437", "0.86553806", "0.865241", "0.86165065", "0.8587693", "0.8572328", "0.85674095", "0.8550907", "0.8529734", "0.8529734", "0.85182345", "0.84936565", "0.8475531", "0.8475531", "0.8466132", "0.8449126", "0.84490585", "0.84359556", "0.84328413", "0.8430745", "0.8428166", "0.84090126", "0.8388222", "0.83684903", "0.83568215", "0.83524764", "0.8345625", "0.8343887", "0.8328773", "0.83284044", "0.83269894", "0.83253354", "0.83201903", "0.83164364", "0.8312503", "0.8312319", "0.8304851", "0.83014053", "0.83008987", "0.82917446", "0.8288315", "0.82870966", "0.8274123", "0.82674986", "0.8267187", "0.82527804", "0.8250538", "0.82443976", "0.82439804", "0.8243696", "0.82416916", "0.8240566", "0.823854", "0.82375354", "0.82283455", "0.82274485", "0.82205135", "0.82190055", "0.82136935", "0.82136935", "0.82102376", "0.82101446", "0.82060164", "0.8200657", "0.81985617", "0.81966525", "0.81958514", "0.81932545", "0.81874573", "0.8186549", "0.8185174", "0.8183619", "0.8183068", "0.8182941", "0.8179895", "0.8173536", "0.81732464", "0.8172825", "0.81721044", "0.8171692", "0.81681263", "0.8165602", "0.81609225", "0.8160289", "0.81587887", "0.815757", "0.8154019", "0.81534094", "0.8152752", "0.81524456", "0.8151455", "0.81511825", "0.8151019", "0.8146792", "0.814368", "0.8142542", "0.81412685" ]
0.0
-1
for the routes we always want to be in the projectcontect this contect is not session based, just only via the /project_name/ in the url so we can use different projects in different tabs (for copy and paste for example)
def before_all(project_id = false) # set locale I18n.default_locale = :en @projects = Project::get_all(settings.full_projects_path) @bc = [] if project_id @project = Project.new(File.join(settings.full_projects_path, project_id)) @bc << { name: @project.id, link: named_route(:projects_show, project_id: @project.id) } end @preview_url = URI::HTTP.build(:host => settings.preview["domain"], :port => settings.preview["port"], :protocol => settings.preview["protocol"]) # for frontend @current_project = session[:sssio_project] @current_project_environment = session[:sssio_project_environment] if @current_project_environment == "development" @current_project_environment_class = "orange" elsif @current_project_environment == "production" @current_project_environment_class = "green" elsif @current_project_environment != "" @current_project_environment_class = "blue" end if self.respond_to? 'before' self.before() end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n u = User.find(session[:user_id])\n pid = u.project_id\n if pid.nil?\n redirect_to :controller =>'dashboard', :action=> 'setup'\n else\n session[:project_id] = pid\n redirect_to project_index_url\n end\n \n end", "def url_for_project_named(name)\n eval project_path\n end", "def index\n @title = \"Project Management\"\n \n if current_user.has_role?( :Admin ) || current_user.has_role?( :Corporate )\n @projects = Project.all\n else\n @projects = Project.find( :all, :conditions => [ \"manager_user_id = ? OR account_manager = ?\", current_user.id, current_user.id ] )\n end\n \n #view hours\n \n #get projects\n #@pro = Project.where(:manager_user_id => current_user.id )\n #@proa = Project.where(:account_manager => current_user.id)\n @pro = Project.where(\"manager_user_id = ? OR account_manager = ?\", current_user.id, current_user.id)\n #@task = ProjectTask.where(:project_id => @pro.id)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end", "def index\n @main_page = \"Pessoal\"\n @page_title = \"Projetos\"\n @projects = Project.all\n @current_projects = Project.current_projects\n end", "def index\r\n\r\n\t\t@project = Project.find(params[:id])\r\n\t\tsession[:project_id]=params[:id]\r\n\t\t\r\n\tend", "def index\n if current_user != nil\n @projects = Project.where('user_id' => current_user.id)\n else \n redirect_to new_user_session_path\n end\n\n\n end", "def after_sign_up_path_for(resource)\n # super(resource)\n if session[:project].present?\n handle_project_signup\n session.delete(:project)\n projects_path || super\n else\n #if there is not temp list in the session proceed as normal\n '/projects'\n end\n end", "def projects\n resource 'projects'\n end", "def index \n #Guarda en @projects todos los proyectos. Hay que cambiarlo para que sólo agarre los que pertenecen al usuario logeado.\n @projects = Project.all \n end", "def index\n redirect_to Project.find(params[:project_id])\n end", "def index\n @projects = current_user.projects.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 5, :page=>params[:page])\n #Variable open_proejct just stores the name of the currently open project\n @open_project = current_project.name if current_project \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n cookies.delete :allProjects\n @all_projects=false\n @projects=self.get_my_projects\n\tend", "def project\n request :project\n end", "def projects ; end", "def index\n redirect_to index_project_path\n end", "def project\n end", "def show\n #Este es un caso especial: el archivo routes establece que User es un recurso, así que cuando llega a la ruta del\n # proyecto, por ejemplo, /project/15, es el perfil del proyecto con id 15, entonces como es un recurso, el controlador\n # automáticamente carga el usuario en la variable @project, listo para la vista. Esto lo hace con el metodo :set_project\n end", "def list\n get 'projects'\n end", "def home_controller\n if @public\n \"/public/site/#{site}/home\"\n else\n \"/public/site/#{site}/home\" # extracted projects/#{self.id}\n end\n end", "def index\n respond_with Project.all\n # cookies[:user_id] = current_user.id\n\n end", "def index\n @user = User.find_by_id(session[:userid])\n @projects = current_user_projects\n respond_to do |format|\n format.html # index.html.erb\n format.json\n end\n end", "def index\n if current_user.admin == 1\n @projects = Project.all\n else\n @projects = current_user.projects\n if @projects.count == 1\n redirecting = 1\n redirect_to project_path(@projects.first)\n end\n end\n if redirecting.nil?\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end\n end", "def project_dashboard\n @user = User.first\n @project = Organization.first.projects.find_by(id: params[:id])\n end", "def index\n if @project.belongsToProject?(current_user) or current_user.isAdmin?\n redirect_to project_sprint_user_story_path(@user_story.sprint.project, @user_story.sprint, @user_story)\n else\n redirect_to root_path\n flash[:notice] = 'Action not allowed'\n end\n end", "def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end", "def index\n if spartan_signed_in?\n if current_spartan.admin\n @projects = Project.all()\n @header = \"All Projects\"\n else\n @projects = current_spartan.projects.all()\n @header = \"Your Projects\"\n end\n else\n redirect_to '/home'\n end\n \n end", "def set_project\n @project = Project.find_by(url_slug: params[:url_slug])\n end", "def index\n @projects = current_user.projects.ordered_by_creation\n # render :layout => \"index\"\n\n # @projects = Project.all(project_params)\n # if @project.user_id = current_user.id\n # end\n end", "def index\n @project_masters = ProjectMaster.all\n session[:active_tab] =\"ProjectMaster\"\n end", "def index\n\tif @current_user.is_admin?\n\t\t@projects = Project.all\n\telse \n\t\t@projects = @current_user.projects\n\tend\n end", "def index\n prepare_projects_display\n \n end", "def index\n\t\t@projects = Array.new\n\t\t\n\t\t# Se houver um usuário logado, verifica os projetos que ele já faz parte\n\t\tif current_user\n\t\t\t\n\t\t\t@teams = Array.new\n\t\t\tTeam.all.each do |t|\n\t\t\t\tif t.user_id == current_user.id\n\t\t\t\t\t@teams.push(t)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\t\t# Alguns projetos podem nao estar visiveis, de acordo com as \n\t\t# condicoes abaixo\n\t\tProject.all.each do |p|\n\t\t\t\n\t\t\t# Se o projeto esta como publico, deve aparecer (exceto se for recem criado / iniciado)\n\t\t\tif p.status_ace && ( p.andamento == 'C' || p.andamento == 'E' )\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# Se o usuario é coordenador do projeto, o projeto deve aparecer para ele sempre\n\t\t\t\telsif current_user && current_user.id == p.user_id\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# O administrador tambem pode ver todos os projetos sempre\n\t\t\t\telsif current_user && current_user.user_role_id == 1\n\t\t\t\t@projects.push(p)\n\t\t\t\t\n\t\t\t\t# Se o usuario é pesquisador e o status do projeto é em\n\t\t\t\t\t# andamento ou concluído, mesmo que não esteja publico,\n\t\t\t\t# deve aparecer para ele\n\t\t\t\telsif current_user\n\t\t\t\t\n\t\t\t\t# Busca o papel deste usuario no time, se houver\n\t\t\t\t@curr_team = Team.find_by user_id: current_user.id, project_id: p.id\n\t\t\t\tif @curr_team && @curr_team.status_ace\n\t\t\t\t\t@projects.push(p)\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend", "def projects\n records \"project\", \"/project/list\"\n end", "def load_project\n # check if already loaded\n return @project if (@project)\n \n if (params[:project_id]) \n @project = Project.find(params[:project_id])\n elsif (params[:project_name])\n # try to use the name\n @project = Project.find(:first, :conditions => [\"name = ?\", params[:project_name]])\n elsif (request.domain =~ /^(www\\.)?boletin-campusfaes.es$/ )\n @project = Project.find(:first, :conditions => [\"name = ?\", \"Campus FAES\"])\n end\n \n session[:project_id] = @project.id if @project\n end", "def assign_project_use\n if !session[:project_id].nil?\n find_project=Project.find_by_id(session[:project_id])\n if find_project.nil?\n project=Project.assign_project_id(session[:admin_id])\n if !project.empty?\n session[:project_id]=project[0].id\n end\n end\n else\n project=Project.assign_project_id(session[:admin_id])\n if !project.empty?\n session[:project_id]=project[0].id\n end\n end\n end", "def index\n # @user = User.find(params[:user_id]) \n @projects = current_user.projects\n end", "def index\n @projects = Project.find(:all)\n \n=======\n\n skip_before_filter :login_required, :only => [\"index\",\"by_discipline\",\"by_centre\",\"by_supervisor\"]\n require_role [\"admin\", \"coordinator\", \"staff\"], :for => [\"new\", \"create\", \"edit\", \"update\", \"destroy\"]\n before_filter :can_edit, :only => [\"create\", \"edit\", \"update\", \"destroy\"]\n\n helper_method :can_edit\n\n # GET /projects\n # GET /projects.xml\n def index\n @projects = Project.all\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n \n=======\n\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/controllers/projects_controller.rb\n # GET /projects/1\n # GET /projects/1.xml\n def show\n @project = Project.find(params[:id])\n<<<<<<< HEAD:app/controllers/projects_controller.rb\n @disciplines = collect_disciplines\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @projects }\n end \n end\n \n # GET /projects/new\n # GET /projects/new.xml\n def new\n if ! logged_in?\n flash[:error] = \"You must be logged in to add a new project\"\n redirect_to login_path \n end\n @project = Project.new\n @disciplines = collect_disciplines\n #if (current_user.roles.blank? || current_user.has_role?(Roles.find_by_name(\"student\"))) \n #\t flash[:error] = \"You must be a member of staff to add a project\"\n #\t redirect_to(:back)\n \t #end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @projects }\n end \n end\n \n # GET /projects/1/edit\n def edit\n @project = Project.find(params[:id])\n @disciplines = collect_disciplines\n end\n \n \n \n \n=======\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end", "def show\n @project = Project.find(params[:id])\n #if @project.state == \"new\"\n # if current_user.id != @project.user_id\n # redirect_to root_path\n #end\n #end\n\n if @project.state == \"examinate\"\n redirect_to root_path\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n if (current_user.role == \"admin\" || current_user.role == \"manager\")\n @projects = Project.order('name').page(params[:page])\n else\n userprojects = current_user.users_projects.where(\"user_project_role = ?\", \"manager\")\n @projects = current_user.projects.where(id: userprojects.pluck(:project_id)).order('name').page(params[:page])\n end\n end", "def index\n authorize Project\n # Only index projects of the current user\n @projects = current_user.projects\n @public_projects = policy_scope(Project)\n @help_context = \"Projects\"\n end", "def url_for_me(action)\n if action == 'show'\n \"/projects/#{to_param}\"\n else\n \"/projects/#{to_param}/#{action}\"\n end\n end", "def index\n @projects = Project.all\n @project = Project.find_by_id(params[:project_id])\n if !@project.blank?\n @visit = Visit.where(user_id: current_user.id, visitable_id: @project.id, visitable_type: 'Project').first\n if !@visit.blank?\n @visit.destroy\n end\n Visit.create(user_id: current_user.id, visitable_id: @project.id, visitable_type: 'Project')\n @activity = Activity.create(user_id: current_user.id, activity_type: 'View', target_type: 'Project', target_id: @project.id)\n\n end\n end", "def index\n @project = Project.find(params[:project_id])\n redirect_to project_path(@project) and return\n # @scenes = @project.scenes\n # @backlink = project_path(@project)\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @scenes }\n # end\n end", "def index\r\n @projects = current_user.projects\r\n end", "def show\n if current_user.role == \"کارفرما\"\n redirect_to root_url\n end\n @projects_name = []\n @projects = current_user.nazer_projects.all\n @projects.each do |p|\n @projects_name << p.name\n end\n end", "def index\n @current_page = \"PROJECTS\"\n @projects = Project.all\n @projects_for_review = Project.pending_review if current_user\n @new_nav = true;\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\r\n #front end view used\r\n\r\n session[:filter_type] = nil\r\n session[:filter_query] = nil\r\n Rails.cache.delete('total_stats')\r\n\r\n #randomize what project a user sees when first going to the website\r\n #changes everyday at midnight\r\n @project = []\r\n\r\n if cookies[:landing_project].blank?\r\n rand_command = ActiveRecord::Base.connection.adapter_name.downcase.include?('mysql') ? \"RAND()\" : \"RANDOM()\" #RAND() for MySQL; RANDOM() for sqlite3\r\n @project = Project.exclude_multi_project.has_outreach.published.first(:order => rand_command)\r\n cookies[:landing_project] = { :value => @project.name, :expires => Time.now.midnight + 1.day} if @project\r\n else\r\n @project = Project.find_by_name(cookies[:landing_project])\r\n end\r\n\r\n if @project\r\n results = get_project_slider_info(@project.name)\r\n @project_slider_html = results\r\n @formatted_project_name = @project.name.gsub(' ','_')\r\n end\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:controller => 'projects', :action => 'show', :id => @formatted_project_name) }\r\n format.xml { render :xml => @project }\r\n end\r\n end", "def index\n @projects = current_user.projects.without_provided_by_dashbozu\n if @projects.empty?\n redirect_to action: :from_service, provider: logged_provider\n return\n end\n end", "def index\n \t_projects = Property.show_all_visible\n \tproj = _projects.collect{|p| p.name }.join(', ')\n \t\n \t@page_title = \"CebuCondoListings | Cebu Condominium Listings - #{proj}\" \n if logged_in?\n @properties = Property.show_all\n else\n @properties = Property.show_all_visible \n end\n end", "def index\n #@projects = []\n if current_user\n #@projects = current_user.projects.where(\"memberships.status >= ?\", 1)\n end\n\n if params[:id]\n @project = Project.find(params[:id])\n authorize! :read, @project\n else\n @project = @projects.first\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :action => 'show'}\n format.json { render json: @projects }\n end\n end", "def index\n @projects = Project.where(user_id: @current_user.id)\n end", "def index\n @projects = current_user.projects\n end", "def index\n @projects = current_user.projects\n end", "def index\n @projects = current_user.projects\n end", "def index\n @projects = current_user.projects\n end", "def index\n @projects = current_user.projects\n end", "def index\n @projects = current_user.projects\n end", "def index\n @projects = current_user.projects\n end", "def index\n @projects = current_user.projects\n end", "def index\n get_logged_in_user\n @projects = Project.all.select {|project| project.user_id == logged_in_user_id }\n end", "def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\n end", "def index\n if signed_in?\n @projects = current_user.projects\n respond_to do |format|\n format.html { render 'projects/index' }\n format.json { render template: 'projects/index.json.jbuilder' }\n end\n else\n redirect_to :projects\n end\n end", "def project\n @path = \"/services/Admin\"\n @project ||= Nephophobia::Resource::Project.new self\n end", "def set_project\n @project = Project.find(params[:id])\n\t if !@current_user.is_admin? && @project.user != @current_user\n\t\t redirect_to not_found_path\n\t end\n\n end", "def current_project\n @current_project ||= session[:project_id] unless @current_project== false\n end", "def project \n organizing_city.current_project\n end", "def project_url project_id\n server = lookup_server_from_project(project_id)\n pivotal_url = server[:url]\n { :url => \"#{pivotal_url}/projects/#{project_id}\", :token => server[:token] }\nend", "def project_path(name)\n project_map[name.to_s]\n end", "def show\n @project = Project.find(params[:id])\n cookies.permanent.signed[:open_project] = @project.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def new\n redirect_to project_path id: new_project_from_hash('transient' => true,\n 'name' => 'Untitled Project',\n 'default_workspace' => {\n 'name' => 'Untitled Workspace'\n }).id\n end", "def next_project # :nologin: :norobots:\n redirect_to_next_object(:next, Project, params[:id].to_s)\n end", "def index\n \n @workspaces = current_user.workspaces\n # debugger\n @projects = Project.where(:workspace_id => @workspace)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end", "def index\n if user_signed_in? && current_user.student\n @student_projects = current_user.student.team_projects.collect{ |team_project|\n {\n class_name: team_project.team.course.name,\n team_name: team_project.team.name,\n project_name: team_project.project.name,\n action_link: if team_project.comments_for_team(current_user.student).empty? then \"/survey/complete?id=\"+team_project.id.to_s elsif team_project.project.due.before? 1.second.ago then \"/survey/view?id=\"+team_project.id.to_s else nil end,\n action_text: if team_project.comments_for_team(current_user.student).empty? then \"Complete\" elsif team_project.project.due.before? 1.second.ago then \"View\" else \"Awaiting Results\" end,\n due: team_project.project.due.in_time_zone('Eastern Time (US & Canada)').strftime('%Y-%m-%d %I:%M:%S %p')\n }\n }\n elsif user_signed_in? && current_user.instructor\n redirect_to '/courses'\n end\n end", "def index\n @project = Project.find(params[:project_id].to_i)\n authorize_user!( @project )\n end", "def set_project\n @project = current_user.projects.friendly.find(params[:id])\n end", "def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\n respond_to do |format|\n if @project.save\n redirect_url = @urlroot + \"/projects\"\n response_url = { \"url\" => redirect_url }\n format.json { render json: response_url, status: 200 }\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 index\n @projects = current_user.projects.all\n end", "def index\n\t\t@projects = Project.where(user_id: current_user.id).order(created_at: :asc)\n\tend", "def show\n @focus_tab=params[:tab]\n # Se fija si hay que mostrar una tab especial al hacer el show,\n # sino, muestra la primera\n if @focus_tab== nil\n @focus_tab='1'\n end\n # Busca el proyecto por el id y lo muestra\n @project = Project.find(params[:id])\n # Agrega el breadcrumb con el nombre del proyecto\n add_breadcrumb @project.name, project_path(@project)\n end", "def show\n @project = Project.find(@perk.project_id)\n add_breadcrumb @project.name.to_s, '/projects/' + @project.id.to_s\n end", "def set_project\n @project_id = params[:project_id]\n if @project_id=='ALL'\n @projects = current_user.is_support? ? Project.all : Project.where(user_id: current_user.id).to_a\n else\n @project = current_user.is_support? ? Project.where(id: @project_id).first : Project.where(user_id: current_user.id, id: @project_id).first\n @projects = [@project]\n end\n end", "def new\r\n # This can and probably SHOULD be replaced with some URL rewrite magic\r\n # now that the project loader is Redmine project based.\r\n find_project()\r\n end", "def project\n @scope = 'project'\n @edit_role = 'resource_admin'\n @js_data[:project_id] = params[:override_project_id] || @scoped_project_id\n @js_data[:domain_id] = params[:override_domain_id] || @scoped_domain_id\n\n auth_params = { selected: @js_data }\n enforce_permissions('::resources:project:show', auth_params)\n @js_data[:can_edit] = current_user.is_allowed?('resources:project:edit', auth_params)\n\n render action: 'show'\n end", "def project\n params['project'].gsub('_', '-')\n end", "def new\n session[:return_to] ||= request.referer\n @project = Project.new\n @project.user_id = current_user.id\n\n # we use list of projects and contexts on the view, need to prepare them\n @projects = Project.all_active_projects(params[:context_id],current_user.id )\n @contexts = Context.where(\"user_id = ?\",current_user.id)\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def show\n\t\tlistable_actions = ActionType.where(:code=>['create', 'update', 'destroy', 'approve'])\n\n\t\t@project = Project.find(params[:id])\n\t\t@tasks = @project.root_tasks\n\t\t@events = @project.events.where(:action_type_id => listable_actions).limit 6\n\t\t@sprints = @project.sprints\n\t\t@user_relations = @project.project_user_relations\n\n\t\tmake_breadcrumbs\n\t\tsession[:last_controler] = self.controller_name\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @project }\n\t\tend\n\tend", "def index\n # Lista todos los proyectos\n @projects = Project.all\n end", "def show\n if @project.belongsToProject?(current_user) or current_user.isAdmin?\n redirect_to project_sprint_user_story_path(@user_story.sprint.project, @user_story.sprint, @user_story)\n else\n redirect_to root_path\n flash[:notice] = 'Action not allowed'\n end\n end", "def show_project\r\n @project = Project.find(params[:id])\r\n @id = @project.id\r\n respond_to do |format|\r\n format.html { render 'project_control/view' }\r\n format.json { render json: @project }\r\n end\r\n end", "def set_project\n @project = Project.where(url: params[:project_id]).first\n end", "def allow_project\n name = params[:nameproject]\n @project = Project.find_project(@user.id, @space.id, name).take || not_found\n\n # parser token\n @parse_token = Project.token\n end", "def index\n\t\tif present_user.role? 'admin'\n\t\t\t@projects = Project.all\n\t\telse\n\t\t\t@projects = present_user.projects\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @projects }\n\t\tend\n\tend", "def index\n @user = User.find(current_user.id)\n @projects = @user.projects.all\n end", "def all\n cookies[:allProjects]=true\n @all_projects=true\n @projects={\n \"current\"=> Project.find_all_by_state('current'),\n \"finished\"=> Project.find_all_by_state('finished'),\n \"aborted\"=> Project.find_all_by_state('aborted')\n }\n\t\tself.bread\n authorize! :list_all, @projects\n render 'index'\n end", "def project(project_id)\n resource \"projects/#{project_id}\"\n end", "def set_project\n # pp params[:list][:project_id]\n @project = current_user.projects.get_project(params[:project_id]).first\n if @project.nil?\n redirect_to root_path\n end\n end", "def set_project\n # pp params[:list][:project_id]\n @project = current_user.projects.get_project(params[:project_id]).first\n if @project.nil?\n redirect_to root_path\n end\n end", "def project; end", "def show\n @projects = find_projects\n end", "def index\n admin?\n @projects = Project.all\n end" ]
[ "0.7060891", "0.67263806", "0.66895217", "0.6680684", "0.6648931", "0.65772027", "0.6571671", "0.6539149", "0.6538217", "0.6511793", "0.65048754", "0.64638245", "0.64603454", "0.64509", "0.64423335", "0.64154226", "0.64062476", "0.64061487", "0.6376967", "0.6374029", "0.6328715", "0.6324994", "0.63207984", "0.63173676", "0.6276499", "0.62682205", "0.62680215", "0.6266984", "0.6264849", "0.6264077", "0.6264002", "0.6247082", "0.62400496", "0.6229949", "0.622439", "0.6217681", "0.62120163", "0.6211481", "0.6199299", "0.6195012", "0.61883616", "0.61862093", "0.6179922", "0.61716586", "0.6158972", "0.61500484", "0.6142073", "0.6132265", "0.61260843", "0.6121281", "0.6119007", "0.6114196", "0.6114196", "0.6114196", "0.6114196", "0.6114196", "0.6114196", "0.6114196", "0.6114196", "0.6101867", "0.6101161", "0.610022", "0.6091768", "0.6090041", "0.608781", "0.60829335", "0.60784936", "0.6076213", "0.6070005", "0.60653293", "0.605842", "0.6056682", "0.605562", "0.6051541", "0.60434604", "0.60422635", "0.60413593", "0.6037751", "0.6031618", "0.6029199", "0.602842", "0.60267156", "0.60262203", "0.6020061", "0.6017306", "0.60171884", "0.601634", "0.6016208", "0.6009541", "0.6001993", "0.6000293", "0.5998055", "0.59971035", "0.5996935", "0.59956956", "0.59868324", "0.59868324", "0.5985861", "0.598223", "0.5969453" ]
0.6068256
69
sets a new flash for everything
def flash text, type = 'success', title = false session[:flashes] = [] unless session[:flashes] session[:flashes] << { type: type, text: text, title: title } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_flash(action)\n set_normal_flash(action)\n set_flash_now(action)\n end", "def flash=(_arg0); end", "def flash; end", "def flash; end", "def set_flash\n flash[:messages]=@fired_events.find_all { |e| e.block_type.in? Message.descendant_types }.map do |e|\n {message:e.block.message_with_vars(@handler.options), message_type: e.block.message_type}\n end.compact\n if @fired_events.find { |e| e.block_type==\"TaskPassed\" }\n redirect_to play_game_url(game_id: @game.id)\n elsif @task.show_wrong_answer\n flash[:alert]=t(\"play.alert.no_events\")\n redirect_to play_show_url(game_id: @game.id, task_id: @task.id)\n else\n redirect_to play_show_url(game_id: @game.id, task_id: @task.id)\n end\n end", "def set_normal_flash(action)\n if f = options_for(action).flash\n flash[:notice] = f.is_a?(Proc) ? instance_eval(&f) : options_for(action).flash\n end\n end", "def setup_flash\n [:warning, :error, :notice].each {|level| flash[level] ||= []}\n end", "def keep_flash\n @keep_flash = true\n end", "def set_flash_now(action)\n if f = options_for(action).flash_now\n flash.now[:notice] = f.is_a?(Proc) ? instance_eval(&f) : options_for(action).flash_now\n end\n end", "def set_flash(options = {}) # rubocop:disable Naming/AccessorMethodName\n if options.key?(:notice)\n flash[:notice] = options[:notice]\n elsif options.key?(:alert)\n flash[:alert] = options[:alert]\n end\n end", "def reload_flash\n page.replace \"flash_messages\", :partial => 'layouts/flasher'\n end", "def flash\n execute_only(:flash)\n end", "def flash(evt = nil)\n @notice = evt[:notice] rescue ''\n @alert = evt[:alert] rescue ''\n render :text => update(\"##{dom_id}_flash\"), :layout => 'flash_effect.js.erb',\n :locals => {:flashid => \"#{dom_id}_flash\"}\n end", "def show_flash(key)\n if session[key]\n flash = session[key]\n session[key] = false\n flash\n end\n end", "def reload_flash\n page.replace \"flash_messages\", :partial => 'layouts/flash'\n end", "def flash\n ActionDispatch::Flash::FlashHash.new\n end", "def show_flash(key)\n\tif session[key]\n\t flash = session[key]\n\t session[key] = false\n\t flash\n\tend\n end", "def set_flash_success(msg)\n session[:flash] = [true, msg]\n end", "def scaffold_flash\n {}\n end", "def show_flash(key)\n\t\tif session[key]\n\t\t\tflash = session[key]\n\t\t\tsession[key] = false\n\t\t\tflash\n\t\tend\n\tend", "def flash\n {}\n end", "def flash_keeper\n flash.keep\n end", "def set_alerts\n\t\tif flash.notice\n\t\t\t@notice = flash.notice\n\t\t\tp(@notice)\n\t\telsif flash.alert\n\t\t\t@alert = flash.alert\n\t\t\tp(@alert)\n\t\tend\n\tend", "def each(&block)\n @flash.each(&block)\n end", "def rjs_flash(page)\n page.replace \"flash\", :partial => \"common/flash\", :locals => {:flash => flash}\n flash.discard\n end", "def start_flash(color, duration)\n @flash_color = color.clone\n @flash_duration = duration\n end", "def []=(key, value)\n @flash[key] = value\n @flash[\"shown\"] = true\n end", "def reset_flash_message\n [:blue_notice, :lightgrey_notice, :success, :danger, :warning, :info,\n :light, :dark].each do |x|\n flash[x] = nil\n end\n end", "def start_flash(color, duration)\n @flash_color = color.clone\n @flash_duration = duration\n end", "def flash\n rails_flash\n end", "def replace_flash(page, flash_type, options = {})\n flash_id = \"flash_#{flash_type}\"\n if page.select(\"#\"+flash_id).count > 0\n page.replace id, :partial => \"layouts/flash\"\n end\n end", "def clear_all_flash\n flash[:notice] = flash[:alert] = flash[:error] = nil\n end", "def set_flash_card\n @flash_card = FlashCard.find(params[:id])\n end", "def render *args\n gon.flash = flash.to_h\n super\n end", "def flash(flash_hash)\n level = flash_hash.keys.first\n raise \"Unknown message level for flash\" unless %(notice warning error).include?(level.to_s)\n @flash << {:level => level, :msg => flash_hash[level]}\n end", "def flash\n session[:flash] = Hashie::Mash.new if session[:flash].nil?\n session[:flash]\n end", "def clear_flash\n flash.clear\n end", "def flash\n Current.session.flash\n end", "def flash\n\t\t{:notice => \"Hello There\"}\n\tend", "def set_flash_failure(msg)\n session[:flash] = [false, msg]\n end", "def set_flash(message, status = :success)\n type = {\n :success => \"is-success\", \n :error => \"is-danger\", \n }\n flash[:message] = message\n flash[:message_type] = type[status]\n end", "def set_flashlight\n @flashlight = Flashlight.find(params[:id])\n end", "def show_flash\n html = ''\n [ :alert, :notice, :info, :warning, :error ].each do |f|\n options = { :id => \"flash-#{f}\", :class => \"flash-#{f}\" }\n options.merge!( :style => 'display:none' ) if flash[f].nil?\n html << content_tag( 'div', options ) { flash[f] || '' }\n end\n html.html_safe\n end", "def show_flash\n html = ''\n [ :alert, :notice, :info, :warning, :error ].each do |f|\n options = { :id => \"flash-#{f}\", :class => \"flash-#{f}\" }\n options.merge!( :style => 'display:none' ) if flash[f].nil?\n html << content_tag( 'div', options ) { flash[f] || '' }\n end\n html.html_safe\n end", "def flash(type, header, message)\n session[\"notice\"] ||= []\n session[\"notice\"] << {\n :type => type,\n :header => header,\n :message => message\n }\nend", "def flash\n @flash ||= Flash.new(req)\n end", "def appctrl_set_flash( result )\n\n # E.g. for controller name \"users\", action name \"edit\", result \"notice\":\n # uk.org.pond.canvass.controllers.users.action_notice_edit\n\n flash[ result ] = t( \"uk.org.pond.canvass.controllers.#{ controller_name }.action_#{ result }_#{ action_name }\" )\n end", "def now\n @flash\n end", "def store_flash(res)\n res.set_cookie(\"_rails_lite_app_flash\", {\n path: \"/\",\n value: @flash.to_json\n })\n end", "def flash(message)\n\n end", "def render_flash\n return if state.flash_at.elapsed_time > 10 # return if more than 10 frames have passed since flash.\n # Transparency gradually changes (or eases) during the 10 frames of flash.\n outputs.primitives << [grid.rect, 255, 255, 255, 255 * state.flash_at.ease(10, :flip)].solid\n end", "def check_flash\n @flash = session[:flash] if session[:flash]\n session[:flash] = nil\n end", "def set_flash_message(message, type, now=true)\n if now\n flash.now[type] = message\n else\n flash[type] = message\n end\n end", "def store_flash(res)\n cookie = @flash.to_json\n res.set_cookie('_rails_lite_app_flash', cookie)\n end", "def instant_flash\n render partial: 'shared/flash_messages'\n end", "def store_flash(res)\n res.set_cookie('_rails_lite_app_flash', {path: '/', value: @new_cookie.to_json})\n end", "def add_flash\n unless flash.empty?\n notifications = \"\".html_safe\n unless flash[:notice].blank?\n notifications << \"<div class=\\\"notification\\\">#{flash[:notice].html_safe}#{close_notice}</div>\".html_safe\n end\n unless flash[:errors].blank?\n notifications << \"<div class=\\\"error\\\">#{flash[:errors].html_safe}#{close_notice}</div>\".html_safe\n end\n unless flash[:alert].blank?\n notifications << \"<div class=\\\"alert\\\">#{flash[:alert].html_safe}#{close_notice}</div>\".html_safe\n end\n response.body = response.body.sub /<!-- Notifications -->/, notifications.html_safe\n end\n end", "def flash_notice\n if flash[:notice]\n message = flash[:notice]\n flash.clear\n flash[:success] = message\n end\n end", "def flash_me\n flash['hello'] = 'my name is inigo montoya...'\n render :text => \"Inconceivable!\"\n end", "def flash_me_naked\n flash.clear\n render :text => \"wow!\"\n end", "def <<(hash)\n @flash.set_flash(hash)\n end", "def flash(color, duration)\n\n end", "def flash_notice=(message=\"Successfully processed.\")\n @flash_notice = message\n end", "def flash(msg)\n\t$Log.info msg\nend", "def hide_flash\n update_page do |page|\n page[:flash].hide\n end\n end", "def store_flash(res)\n serialized_flash = @later.to_json\n res.cookies << WEBrick::Cookie.new(\"_rails_lite_flash\" , serialized_flash)\n end", "def alert(id, msg, *classes)\n flash[rand(9999).to_s] = {:msg => msg, :classes => classes}\n end", "def set_flash_message!(key, kind, options = {})\n if is_flashing_format?\n set_flash_message(key, kind, options)\n end\n end", "def flash_message=(message)\n flash[:message] = message\n end", "def map_flash_to_gon\n generate_standard_gon\n if flash[:notice]\n gon.flash[:type] = :notice\n gon.flash[:message] = flash[:notice]\n elsif flash[:alert]\n gon.flash[:type] = :alert\n gon.flash[:message] = flash[:alert]\n end\n end", "def flash_warning(warning)\n flash[:warning] = warning\n end", "def flash_headers\n # Add the appropriate flash messages to the header, add or remove as\n # needed, but I think you'll get the point\n response.headers['x-flash'] = flash[:error] unless flash[:error].blank?\n response.headers['x-flash'] = flash[:notice] unless flash[:notice].blank?\n response.headers['x-flash'] = flash[:alert] unless flash[:alert].blank?\n # Stops the flash appearing when you next refresh the page\n flash.discard\n end", "def set_flash_notice(message = nil, action: nil, user: nil, **opt)\n message ||= status_message(status: :success, action: action, user: user)\n flash_notice(*message, **opt)\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @persist.to_json)\n end", "def flash_worldmap\n @world_map.flash;\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app_flash', flash.to_json)\n cookie.path = '/'\n res.cookies << cookie\n end", "def flash_it(key = :success, style=nil)\n\n # default style is \"success\"\n (style = (key == :error ? :error : :success)) unless style\n\n # namespace lookup\n # User::SomethingController\n # => [\"user\", \"something\"]\n namespacing = self.class.to_s.split(\"::\").map{|x| x.underscore.gsub(\"_controller\", \"\")}\n\n #looking in flash_messages.user.something.action.key\n lookup = \"flash_messages.\"\n lookup << namespacing.join(\".\") << \".\"\n lookup << \"#{action_name}.\"\n lookup << \"#{key}\"\n\n #set the flash message\n flash[style] = t(lookup)\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @flash_hash.to_json)\n end", "def set_flash_message(key, kind, options = {})\n return unless flashing_format?\n\n message = find_message(kind, options)\n return if message.blank?\n\n if options[:now]\n flash.now[key] = message\n else\n flash[key] = message\n end\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new(\"_rails_lite_flash\", @stuff.to_json)\n cookie.path = \"/\"\n res.cookies << cookie\n end", "def store_flash(res)\n chips_ahoy = WEBrick::Cookie.new('_rails_lite_flash', @slow_poke.to_json)\n res.cookies << chips_ahoy\n end", "def render_flash\n flash[:error] ||= flash[:alert]\n flash[:info] ||= flash[:notice]\n if flash_message = flash[:error] || flash[:success] || flash[:info]\n flash_class = flash[:error] || flash[:alert] ? \"alert-error\" : (flash[:success] ? \"alert-success\" : \"alert-info\")\n flash_title = flash[:error] || flash[:alert] ? \"\" : (flash[:success] ? \"Hooray!\" : \"Note:\")\n content_tag(:div, :class=>\"alert #{flash_class}\") do\n content_tag(:a, \"x\", :class=>\"close\", \"data-dismiss\"=>\"alert\") +\n content_tag(:strong, flash_title) + \" \" +\n flash_message\n end\n end\n end", "def flash_message?; flash.blank?; end", "def flash\n raise NotImplementedError\n end", "def flash_msgs(status, messages)\n flash[:status] = status\n flash[:msgs] = [messages].flatten\n end", "def flash_ok_messages\n join_flash_messages :notice, :success, :info\n end", "def flasher\n\t\ts = ''\n\t\tflash.each do |key, msg|\n\t\t\tunless msg.blank?\n\t\t\t\ts << content_tag( :p, msg.html_safe, :class => \"flash #{key}\" )\n#\t\t\t\ts << content_tag( :p, msg.html_safe, :id => key, :class => 'flash' )\n\t\t\t\ts << \"\\n\"\n\t\t\tend\n\t\tend\n\t\ts << \"<noscript><p id='noscript' class='flash'>\\n\"\n\t\ts << \"Javascript is required for this site to be fully functional.\\n\"\n\t\ts << \"</p></noscript>\\n\"\n\t\ts.html_safe\n\tend", "def clear_flash\n flash.discard \n end", "def set_flash_alert(message = nil, action: nil, user: nil, **opt)\n message ||= status_message(status: :failure, action: action, user: user)\n flash_alert(*message, **opt)\n end", "def store_flash(res)\n update_flash\n res.cookies << WEBrick::Cookie.new(@cookie_key, @cookie.to_json)\n end", "def rails_flash\n scope.env[ActionDispatch::Flash::KEY] ||= ActionDispatch::Flash::FlashHash.from_session_value(session[\"flash\"])\n end", "def custom_bootstrap_flash\n flash_messages = []\n flash.each do |type, message|\n type = 'success' if type == 'notice'\n type = 'error' if type == 'alert'\n text = \"<script>\n toastr.#{type}('#{message}');\n </script>\"\n flash_messages << text.html_safe if message\n end\n flash_messages.join(\"\\n\").html_safe\n end", "def set_flash_message(key, kind, options = {})\n message = find_message(kind, options)\n if options[:now]\n flash.now[key] = message if message.present?\n else\n flash[key] = message if message.present?\n end\n end", "def set_flash_and_redirect(status, message, redirect_url)\n flash[status] = message\n redirect_to redirect_url\n end", "def display_flashes(message = @@flash_options[:default_message])\n if flash[:notice]\n flash_to_display, level = flash[:notice], @@flash_options[:notice_class]\n elsif flash[:warning]\n flash_to_display, level = flash[:warning], @@flash_options[:warning_class]\n elsif flash[:errors] || flash[:alert]\n error_flash = flash[:errors] || flash[:alert]\n level = @@flash_options[:errors_class]\n\n if error_flash.instance_of? ActiveModel::Errors\n flash_to_display = message.dup\n flash_to_display << activerecord_error_list(error_flash)\n else\n flash_to_display = error_flash\n end\n else\n return\n end\n flash.discard(:notice); flash.discard(:warning); flash.discard(:errors)\n content_tag('div', flash_to_display.html_safe, :class => \"#{level}\")\n end", "def flash_messages\n if params[:message]\n message params[:message]\n end\n\n flash_message_keys.each do |key|\n if params[key]\n message.send(key, params[key])\n end\n end\n\n render(:template => 'shared/flash_messages', :layout => false)\n end", "def flash_message\n messages = \"\"\n flash.each do |key, value|\n messages << \"<div class=\\\"flash #{key}\\\">#{value}</div>\"\n end\n messages\n end", "def flash_now(*args)\n options = args.extract_options!\n unless options.is_a?(Hash)\n options = {:success => options}\n end\n flash_to options.merge(:flash_hash => flash.now)\n end", "def map(&block)\n @flash.map(&block)\n end", "def update\n respond_to do |format|\n if @flashlight.update(flashlight_params)\n format.html { redirect_to @flashlight, notice: 'Flashlight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @flashlight.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.79773283", "0.7358748", "0.70422643", "0.70422643", "0.70194656", "0.70070183", "0.6982077", "0.69740444", "0.6944463", "0.6872727", "0.68266016", "0.68012387", "0.6790817", "0.676446", "0.6747825", "0.674222", "0.6718694", "0.6639093", "0.6629538", "0.6607797", "0.6604943", "0.6596022", "0.65942556", "0.6558077", "0.65531415", "0.6542836", "0.65228915", "0.6514746", "0.6508355", "0.6505183", "0.6500417", "0.6490008", "0.6476052", "0.6475147", "0.64722866", "0.6464813", "0.6463221", "0.64534795", "0.6433571", "0.6428601", "0.6417939", "0.64157325", "0.6408285", "0.6408285", "0.64064956", "0.63970065", "0.6390338", "0.63725185", "0.63631284", "0.6357817", "0.63550603", "0.6340663", "0.63198864", "0.6289614", "0.6274989", "0.627207", "0.6261519", "0.62553704", "0.6254514", "0.6246692", "0.62348074", "0.622935", "0.6225278", "0.62151325", "0.6205906", "0.6188732", "0.6183471", "0.6183241", "0.6182595", "0.6180331", "0.6179306", "0.61786467", "0.61699206", "0.6147548", "0.61349857", "0.61282873", "0.61097646", "0.61032826", "0.60860527", "0.6075299", "0.6055473", "0.6045845", "0.6045781", "0.6034458", "0.60216826", "0.598195", "0.597326", "0.5964449", "0.5961184", "0.59509826", "0.5945804", "0.5926974", "0.5922099", "0.5919674", "0.591237", "0.5909314", "0.5901245", "0.5878558", "0.5875092", "0.5869473" ]
0.6291005
53
is the current request an ajax request?
def xhr? @env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ajaxcheck(request)\n if request.xhr? == true\n return true\n else\n return false\n end\nend", "def ajax?\n return @ajax\n end", "def ajax?\n params[:ajax] || request.path.start_with?(\"/ajax/\")\n end", "def xhr?\n @env[\"HTTP_X_REQUESTED_WITH\"] == \"XMLHttpRequest\"\n end", "def xhr_request_check\n request.xhr?\n end", "def xml_http_request?\n not /XMLHttpRequest/i.match(@headers['HTTP_X_REQUESTED_WITH']).nil?\n end", "def xml_http_request?\r\n@env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i\r\nend", "def request_xhr?\n !!request.xhr?\n end", "def ajax?\n unless request.xhr?\n redirect_to root_url\n return false\n end\n true\n end", "def xhr?\n @controller.request.xhr?\n end", "def xml_http_request?\n return false if !@request || !@request['headers'] || !@request['headers']['X-Requested-With']\n test2 = /XMLHttpRequest/i.match(@request['headers']['X-Requested-With'])\n not test2.nil?\n end", "def processing_xhr_requests?\n not self.mobylette_options[:skip_xhr_requests] && request.xhr?\n end", "def processing_xhr_requests?\n not self.mobylette_options[:skip_xhr_requests] && request.xhr?\n end", "def request?\n @type == :request\n end", "def check_use_ajax\n case self.use_ajax\n when Object, TrueClass\n self.use_ajax= true\n else\n self.use_ajax= false\n end\n end", "def access_only_for_ajax\r\n unless request.xhr?\r\n render :text => \"Here is an Ajax Service, regular request without security token are denied.\"\r\n return false\r\n end\r\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def js_request?\n request.format.js?\n end", "def turbo_request?\n !request.get? && (response.try(:media_type) || response.content_type) == \"text/javascript\"\n end", "def route_request?\n request.get? && !request_xhr? && !modal?\n end", "def request?\n !!request\n end", "def request?\n self.operation == OP_REQUEST\n end", "def asynchronous?\n @rack_request.xhr?\n end", "def request_empty_page\n @posts.empty? && request.env[\"HTTP_X_REQUESTED_WITH\"] != \"XMLHttpRequest\"\n end", "def real_request?\n @real_request\n end", "def xhr?; end", "def finished_all_ajax_requests?\n page.evaluate_script('jQuery.active').zero?\n end", "def stop_processing_because_xhr?\n if request.xhr? && self.mobylette_options[:skip_xhr_requests]\n true\n else\n false\n end\n end", "def finished_all_ajax_requests?\n page.evaluate_script('jQuery.active').zero?\n end", "def finished_all_ajax_requests?\n page.evaluate_script('jQuery.active').zero?\n end", "def determined_by_request\n if request.xhr?\n return false\n else\n 'application'\n end\n end", "def determined_by_request\n if request.xhr?\n return false\n else\n 'application'\n end\n end", "def check_xhr\n redirect_to(root_url) unless request.xhr? || Rails.env.development?\n end", "def check_format\n not_found unless request.xhr?\n end", "def request_allowed?(request)\n true\n end", "def is_request? msg\n msg && msg[:req_id]\n end", "def posting_html?\n return false unless respond_to?(:request) && !request.get?\n # noinspection RubyResolve\n request.format.html? || (request.format.js? && !!request.xhr?)\n end", "def local_request?\n true\n end", "def local_request?\n true\n end", "def local_request?\n false\n end", "def local_request?\n false\n end", "def local_request?\n false\n end", "def request_get?\n request.get?\n end", "def json_request?\n request.format.json?\n end", "def json_request?\n request.format.json?\n end", "def json_request?\n request.format.json?\n end", "def json_request?\n request.format.json?\n end", "def json_request?\n request.format.json?\n end", "def html_request?(env)\n debug(env) if options[:debug]\n (env['CONTENT_TYPE'] || \"\").to_s !~ /json/i\n end", "def non_xhr_javascript_response?; end", "def valid_request?(request)\n request.post? && request.path == NOTIFY_PATH\n end", "def json_request?\n request.format.json?\n end", "def xhr!\n request.headers[\"HTTP_X_REQUESTED_WITH\"] = \"XMLHttpRequest\"\n end", "def json_request?()\n request.format.json?\n end", "def hasRequest?\n !requests.empty?\n end", "def handleRequest?(path)\n\t\t\ttrue\n\t\tend", "def session_by_ajax\n @session_by_ajax ? @session_by_ajax : false\n end", "def verified_request?\n !protect_against_forgery? ||\n request.method == :get ||\n request.xhr? ||\n !verifiable_request_format? ||\n form_authenticity_token == params[request_forgery_protection_token]\n end", "def post?\n request.request_method == 'POST'\n end", "def can_serve_request?(req)\n false\n end", "def local_request? #:doc:\n @request.remote_addr == \"127.0.0.1\"\n end", "def local_request? #:doc:\n @request.remote_addr == \"127.0.0.1\"\n end", "def action_dispatch?\n defined?(ActionDispatch::Request)\n end", "def okay_to_modify?\n return false if is_xhr?\n return false unless modifiable_content_type?\n true\n end", "def in_progress?\n\t\t\treturn request_status == REQUEST_STATUS['in_progress']\n\t\tend", "def ajax_remove?\n !!options.fetch(:ajax_remove, false)\n end", "def no_request?\n if self.submission\n return false\n else\n return true\n end\n end", "def api_request?\n request.format.json? || request.format.js? || request.format.xml? || request.format.fbtab?\n end", "def user_authorizes_the_request?(request)\n request.post? && referrer_is_self?(request)\n end", "def is_xml_request? \n request.env['CONTENT_TYPE'] =~ %r[(application|text)/xml] \n end", "def api_request?\n is_api_request = request.path_info =~ /\\// ||\n request.path_info =~ /\\/fonts/ ||\n request.path_info =~ /\\/connect/\n !is_api_request\n end", "def replace_request?\n @operation == REPLACE_REQUEST\n end", "def json_input?\n return request.content_type == 'application/json'\n end", "def match?(_request)\n true\n end", "def match?(request)\n request.content_type =~ %r{^application/json.*}\n end", "def determine_layout\n request.xhr? ? 'ajax' : 'application'\n end", "def local_request?\n LOCAL_REQUEST_ERROR\n end", "def post?\r\nHTTP_METHOD_LOOKUP[request_method] == :post\r\nend", "def api_request?\n !(@request.path =~ /^\\/assets\\//)\n end", "def is_requesting?\n @lock.synchronize { !@batch.empty? }\n end", "def api_request?\n false\n end", "def has_request_id?(request_id)\n self.counter.has_request_id?(request_id)\n end", "def has_request\n request_status_pending? && @friend.requester != current_user\n end", "def show\n @xhr = request.xhr?\n respond_to do |format|\n format.html { render :layout => !request.xhr? }\n # other formats\n end\n end", "def pending_request?\n result = page.evaluate_script('$(\"body.pending\").length')\n # puts \"PENDING_REQUEST?: #{result} #{result.class}\"\n result\n end", "def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end", "def is_requested\n request_status_pending? && @friend.requester == current_user\n end", "def requests?\n return requests.any?\n end", "def live_api_request?\n # if no access token, never use live mode\n return false if access_token.nil?\n\n # if block is specifically asking for it or inline mode is activated\n Tml.session.inline_mode? or Tml.session.block_option(:live)\n end", "def head?\r\nHTTP_METHOD_LOOKUP[request_method] == :head\r\nend", "def treat_as_standard_html_request?\n !request.format.json? and !request.format.print? and !request.format.video?\n end", "def treat_as_standard_html_request?\n !request.format.json? and !request.format.print? and !request.format.video?\n end" ]
[ "0.8252138", "0.8122436", "0.80464596", "0.8017102", "0.7959077", "0.7914178", "0.7896626", "0.7841903", "0.77518094", "0.7746662", "0.77203226", "0.75191224", "0.75191224", "0.7231327", "0.71409243", "0.71152735", "0.71011204", "0.7093701", "0.70812833", "0.70812833", "0.70812833", "0.70812833", "0.70812833", "0.70812833", "0.70812833", "0.70812833", "0.70759845", "0.7060036", "0.68709075", "0.6839598", "0.68101555", "0.68042904", "0.67902595", "0.67902344", "0.6761183", "0.6669611", "0.6643271", "0.6643271", "0.6559858", "0.65057117", "0.64140844", "0.63959163", "0.6393546", "0.63592", "0.63555646", "0.6354781", "0.63245034", "0.62621295", "0.62621295", "0.62621295", "0.6234179", "0.6210926", "0.6210926", "0.6210926", "0.6210926", "0.6210926", "0.6207758", "0.620298", "0.61941737", "0.61928236", "0.61916655", "0.6163178", "0.6115145", "0.6110461", "0.610046", "0.60903025", "0.60901254", "0.60642457", "0.6061714", "0.6061714", "0.604736", "0.6000202", "0.5975619", "0.5973159", "0.5964177", "0.5960601", "0.5957697", "0.5928298", "0.59053767", "0.5866648", "0.58614993", "0.5860145", "0.5826353", "0.58188224", "0.58181906", "0.5816684", "0.5812952", "0.5791252", "0.5773437", "0.5752536", "0.5741102", "0.5736275", "0.573359", "0.5722011", "0.56769323", "0.56729805", "0.5669954", "0.5665986", "0.5664779", "0.5664779" ]
0.8116672
2
GET /test_suites/1 GET /test_suites/1.json
def show @test_suite = TestSuite.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @test_suite } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @testsuites = Testsuite.all\n end", "def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end", "def get_test_suite(page, options = {})\n options[:basic_auth] = @auth\n options[:body] = {\n page: page\n }\n self.class.get(\"/projects/id/suites/#{@test_lodge_suite}/steps.json\", options)\n end", "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_suite }\n end\n end", "def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_suite }\n end\n end", "def index\n render status: :ok, json: @tests\n end", "def show\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_case = @test_suite.test_cases.find(params[:id])\n end", "def index\n render status: :ok, json: @test_guide_scenarios\n end", "def get_suite(suite_id, opts = {})\n request.get('get_suite', suite_id, opts)\n end", "def show\n @suite_result = SuiteResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @suite_result }\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 tests(run_id)\n get(\"get_tests/#{run_id}\")\n end", "def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end", "def get_test_suite_from_test_data(test_data)\n @connector.con[:test_suites].filter(\n test_category: test_data[:test_category],\n service: test_data[:suite][:service],\n device: test_data[:suite][:device],\n test_suite_name: test_data[:test_suite_name]\n ).first\n end", "def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end", "def get_tests_in_a_run(run_id)\n testrail_api_client.send_get(\"get_tests/#{run_id}\")\n end", "def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end", "def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end", "def set_test_suite\n @test_suite = TestSuite.find(params[:id])\n end", "def get_one\n test_data = @test.get_one\n return render json: test_data\n end", "def test_suites\n all(QTest::TestSuite, project: @project.id, test_cycle: @id)\n end", "def test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def test_report_for_build(pipeline, build_id)\n fetch(\"#{pipeline['web_url']}/tests/suite.json?build_ids[]=#{build_id}\")\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 set_testsuite\n @testsuite = Testsuite.find(params[:id])\n end", "def index\n @exercise_sets = ExerciseSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercise_sets }\n end\n end", "def test_show\n get '/category/1'\n end", "def show\n @test_summary = TestSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_summary }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to test_suites_url }\n format.json { head :no_content }\n end\n end", "def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end", "def set_suite\n begin\n @suite = Suite.find(params[:id])\n rescue => e\n puts e.message\n render json: { message: \"Id da suite não encontrado\" }, status: :not_found\n end\n end", "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @software_test = SoftwareTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @software_test }\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end", "def show\n render status: :ok, json: @test_guide_scenario\n end", "def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_plan }\n end\n end", "def get_tests(run_id)\n if !(/\\A\\d+\\z/ === run_id.to_s)\n print \"ERROR: get_tests called with non-numeric :run_id = '#{run_id}'\\n\"\n exit -1\n end\n uri = \"get_tests/#{run_id}\"\n @all_tests = @tr_con.send_get(uri)\n #print \" tests found: '#{@all_tests.length}'\\n\" if @all_tests.length > 0\n @all_tests.each_with_index do |next_test,ndx_test|\n print ' '*10\n print \" test-%02d:\" % [ndx_test+1]\n print \" id=%3d\" % [next_test['id']]\n print \" run_id=%s\" % [next_test['run_id']]\n print \" case_id=%s\" % [next_test['case_id']]\n print \" title=%-20s\" % [next_test['title']]\n print \"\\n\"\n get_results(next_test['id'])\n end\n return\nend", "def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_cases/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def listing\n tests = Test.where( user_id: test_params[:user_id] )\n all = TestSerializer.new.all_test(tests)\n return render json: all.as_json\n end", "def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend", "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 get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end", "def index\n render status: :ok, json: @test_guide_scenario_sas\n end", "def show\n render status: :ok, json: @test_guide_scenario_sa\n end", "def show\n @suite = Suite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @suite }\n end\n end", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def download\n\t\t@testruns = Testrun.where(:test_suites_id => params[:id])\n\t\t@suite = TestSuites.find(params[:id])\n\t\trespond_to do |format| \n\t\t\tformat.xlsx {render xlsx: 'download', filename: \"testsuite-#{params[:id]}.xlsx\"}\n\t\tend\n\tend", "def show\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end", "def index\n @api_v1_exercises = Api::V1::Exercise.all\n end", "def index\n\t\t@debug_vars = []\n\t if(current_user)\n\t @default_email = current_user.email if(current_user.username)\n\t end \n\t\t@headertext = \"#{params[:suitetype]} Test Suites\"\n\t\t@suites = TestSuites.where('scheduledate < ? OR scheduledate IS NULL', Time.now.to_s)\n\t\t@browsers = Browsertypes.where(:active => \"1\")\n\t @brands = Brands.all()\n\t @testrun = Testrun.new()\n\t \n\t \n\t\t@type = params[:suitetype]\n\t\tfiltering_params(params).each do |key, value|\n\t\t\t@suites = @suites.public_send(key, value) if value.present?\n\t\tend\n\t\t@suites = @suites.paginate(:page => params[:page], :per_page => 15).order('id DESC')\n\t\t\n\t\t@debug_vars.push @default_email\n\t @debug_vars.push @suites\n\t @debug_vars.push @browsers\n\t @debug_vars.push @brands\n\t @debug_vars.push @testrun\n\t @debug_vars.push @type\n\t @debug_vars.push params\n\n\t if(params[:formats] == 'json')\n\n\t end\n\tend", "def index\n @study_units = StudyUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_units }\n end\n end", "def new\n @suite_result = SuiteResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suite_result }\n end\n end", "def get_all_synthetics_tests\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests\", nil, nil, false)\n end", "def tests\n # return newly-initialized copies of the tests\n @suites.values.map {|suite| suite.new(@client, @client2)}\n end", "def test_canvas_api_studenta_courses\n refute_nil @w\n request_url = \"/courses?as_user_id=sis_login_id:studenta\"\n result_as_json = run_and_get_json_result(request_url)\n assert_operator result_as_json.length, \">=\", 1, \"got some classes back\"\n end", "def index\n @suites = Suite.all(:include => :resort)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @suites }\n end\n end", "def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end", "def tests_suites\n @tests_suites.keys.sort\n end", "def show\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tester }\n end\n end", "def get_ab_tests(opts = {})\n @transporter.read(:GET, '/2/abtests', {}, opts)\n end", "def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end", "def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = testrail_send('get', uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = testrail_send('get', uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = testrail_send('get', uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = testrail_send('get', uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end", "def get_basic_lab_tests(i, params)\n # Attribute Filters\n must_filter = []\n\n if params[:featured]\n params[:id] = '1545,1068,1698,387,784,1017,1073'\n end\n\n # Search by single or multiple ids (comma separated)\n if params[:id]\n if params[:id].include? ','\n ids = params[:id].split(\",\").map { |s| s.to_i }\n must_filter.push({ terms: { id: ids }})\n else\n must_filter.push({term: { id: params[:id] }})\n end\n end\n\n # Search by name (autocomplete)\n must_filter.push(match_phrase_prefix: { name: params[:name] }) if params[:name]\n\n # Page filters\n perpage = params[:perpage] ? params[:perpage].to_i : 10\n page = params[:page] ? ((params[:page].to_i - 1) * perpage.to_i) : 0\n\n # Sort filters\n sort_filter = basic_lab_tests_sort_filter(params[:sort_order], params[:sort_by])\n\n # Elasticsearch DSL Query\n search_query = {\n query: {\n bool: {\n must: must_filter\n }\n },\n sort: sort_filter,\n from: page,\n size: perpage\n }\n\n client = Elasticsearch::Client.new #host:'https://search-kulcare-search-a5gec72fgr3kghfjyvb3anac74.ap-southeast-1.es.amazonaws.com'\n results = client.search index: i, body: search_query\n results[\"hits\"].to_json\n end", "def index\n @online_tests = OnlineTest.all\n end", "def test_public_sets\n set_names = File.readlines('data/set_names.txt')\n set_names.each_with_index do |name, index|\n get \"/sets/public/#{index}\"\n assert_equal 200, last_response.status\n assert_includes last_response.body, name \n assert_includes last_response.body, 'Study' \n assert_includes last_response.body, 'table' \n end\n end", "def fetch_experiments(page)\n puts page\n url = @base + \"/api/v1/experiments.json?token=#{@token}&page=#{page}\"\n response = JSON.parse(RestClient.get(url))\nend", "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_suite }\n end\n end", "def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = @testrail.send_get(uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = @testrail.send_get(uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = @testrail.send_get(uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = @testrail.send_get(uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end", "def show\n @exercise_set = ExerciseSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def show\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_result }\n end\n end", "def show\n @smoke_test = SmokeTest.find(params[:id], :include => SMOKE_TESTS_OBJ_INCLUDES)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @smoke_test } #formated via as_json\n format.xml { render :xml => @smoke_test, :include => SMOKE_TESTS_OBJ_INCLUDES }\n end\n end", "def getFullStatus\n JSON.parse(@client[\"/LoadTest?loadTestId=#{@test_id}\"].get)[0].to_h\n end", "def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end", "def get_test_plan\n @takt = Taktinfo.find(params[:id])\n @testplans = @takt.testplans.where(:format =>params[:testp])\n\n respond_to do |format|\n format.json{render json:@testplans.as_json(root:false),:callback =>params[:callback]}\n end\n end", "def destroy\n @test_suite.destroy\n respond_to do |format|\n format.html { redirect_to test_suites_url, notice: 'Test suite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @assertions = Assertion.all.sample(10)\n\n respond_to do |format|\n format.html\n format.json { render json: @assertions }\n end\n end", "def index\n render json: @test_module.test_questions, status: :ok\n end", "def show\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_test }\n end\n end", "def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end", "def index\n @testtests = Testtest.all\n end", "def index\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units\", :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n @units = JSON.parse(response.body)\n return @units\n end", "def index\n @runtests = Runtest.all\n end", "def show\n @scenario = Scenario.find(params[:scenario_id])\n @result = @scenario.results.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_suites_url) }\n format.xml { head :ok }\n end\n end", "def index\n @tests = Test.all\n end", "def index\n @tests = Test.all\n end", "def index\n @tests = Test.all\n end", "def index\n @tests = Test.all\n end", "def index\n @tests = Test.all\n end", "def index\n @tests = Test.all\n end", "def index\n @tests = Test.all\n end", "def index\n @tests = Test.all\n end", "def index\n @test_results = TestResult.all\n end", "def index\n @second_scenarios = SecondScenario.all\n end", "def get_test_plan_items(test_plan_id=nil)\r\n if test_plan_id.nil?\r\n if params.key?(\"test_plan_id\") && (!params[\"test_plan_id\"].nil?) #For Web browser test\r\n test_plan_id=params[\"test_plan_id\"]\r\n elsif !params.key?(0) || !params.key?(\"test_plan_id\") || (params[\"test_plan_id\"].nil?) \r\n raise(\"Test Plan ID is required\")\r\n else\r\n test_plan_id=params[0][\"test_plan_id\"]\r\n end\r\n end\r\n begin\r\n sf_test_plan=SfTestPlan.find(test_plan_id.to_i)\r\n rescue ActiveRecord::RecordNotFound => recnotfound\r\n raise \"Test Plan Unknown\"\r\n end\r\n if (sf_test_plan.nil?)\r\n raise(\"Test Plan [\"+test_plan_id+\"] Not Known\")\r\n end\r\n logger.debug \"Getting Test Plan for :\" + test_plan_id.to_s\r\n sfchannels=sf_test_plan.sf_test_channels.collect { |sfc|\r\n { \r\n :number => sfc.sf_channel.channel_number,\r\n :name => sfc.sf_channel.channel_name,\r\n :chtype => sfc.sf_channel.channel_type,\r\n :direction => sfc.sf_channel.direction,\r\n :freq => sfc.sf_channel.display_frequency,\r\n :dtls => sfc.sf_channel.channel_dtls\r\n }\r\n }\r\n testplan= [{ :sfchannels => sfchannels}]\r\n respond_to do |format|\r\n format.xml { render :xml => sfchannels }\r\n format.amf { render :amf => testplan }\r\n end\r\n end", "def get_all_testcases()\n print \"\\n--------------------------------------------------------\\n\"\n print \"05) Getting all TestRail testcases in project '#{$my_testrail_project}'...\\n\"\n\n # Get all TestCases in each suite...\n tot_tc = 0\n @tr_testcases_per_suite = Array.new # each element is all testcases in a suite\n @tr_suites.each_with_index do |this_suite,index_suite|\n uri = \"get_cases/#{@tr_proj_info['id']}&suite_id=#{this_suite['id']}\"\n begin\n all_cases = @tr_con.send_get(uri)\n rescue Exception => ex\n print \"\\tEXCEPTION occurred on TestRail API 'send_get(#{uri})':\\n\"\n print \"\\t#{ex.message}\\n\"\n print \"\\tFailed to get TestRail testcases for suite '#{this_suite['id']}'\\n\"\n exit ERR_EXIT_TESTCASES\n end\n print \"\\tFound '#{all_cases.length}' testcases in suite '#{this_suite['id']}'\\n\"\n @tr_testcases_per_suite.push(all_cases)\n tot_tc += all_cases.length\n end\n print \"\\tTotal: '#{tot_tc}' testcases found.\\n\"\n\n # Step through all suites...\n tots=0\n @tc_titles = Hash.new # Has of Rally-ObjectID >> [Rally-FormattedID, TestRail-ID, TestRail-Title]\n @tr_testcases_per_suite.each_with_index do |this_tcset, index_tcset|\n # Step through all TestCases in this suite...\n this_tcset.each_with_index do |this_case, index_case|\n # Save only TestCases which have a populated custom field 'RallyObjectID'...\n if !this_case['custom_rallyobjectid'].nil?\n @tc_titles[this_case['custom_rallyobjectid']] = [this_case['custom_rallyformattedid'], this_case['id'], this_case['title']]\n tots += 1\n end\n end\n end\n print \"\\tFound '#{tots}' testcases linked to Rally\\n\"\nend" ]
[ "0.7127071", "0.66317534", "0.6518662", "0.6468737", "0.6447091", "0.64078796", "0.63427174", "0.6319057", "0.62383205", "0.6215924", "0.6206373", "0.6141135", "0.6119665", "0.6093669", "0.6085884", "0.6085157", "0.6083917", "0.60749465", "0.60663307", "0.60386413", "0.6001561", "0.5995486", "0.5995486", "0.5982753", "0.59613514", "0.5948998", "0.5948497", "0.5929673", "0.5928429", "0.5915964", "0.5892336", "0.5876053", "0.5856154", "0.58552885", "0.58542216", "0.5848119", "0.58290535", "0.5821759", "0.5815389", "0.58151114", "0.58125883", "0.58038807", "0.58027947", "0.5781918", "0.5764977", "0.5755523", "0.57440704", "0.57372624", "0.573672", "0.5716958", "0.5715762", "0.5710906", "0.57105017", "0.56838804", "0.5661245", "0.5656443", "0.5651922", "0.5634797", "0.56308585", "0.56291753", "0.56250113", "0.5613392", "0.56032676", "0.5587584", "0.55763525", "0.5569565", "0.55692303", "0.55683196", "0.556816", "0.5553993", "0.55494046", "0.5546811", "0.5539673", "0.5537076", "0.55333984", "0.55271995", "0.55233204", "0.55184054", "0.55094516", "0.5498624", "0.54975444", "0.5484598", "0.5466934", "0.5466406", "0.5463917", "0.54625744", "0.54621375", "0.5457134", "0.5449745", "0.5449745", "0.5449745", "0.5449745", "0.5449745", "0.5449745", "0.5449745", "0.5449745", "0.5433483", "0.5433099", "0.54330426", "0.5433033" ]
0.74278927
0
GET /test_suites/new GET /test_suites/new.json
def new @test_suite = TestSuite.new respond_to do |format| format.html # new.html.erb format.json { render json: @test_suite } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_suite }\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @suite_result = SuiteResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @suite_result }\n end\n end", "def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan }\n end\n end", "def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end", "def new\n @testcase = Testcase.new\n 3.times { @testcase.scripts.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @testcase }\n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @scenario = Scenario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scenario }\n end\n end", "def new\n @test_summary = TestSummary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_summary }\n end\n end", "def new\n @suite = Suite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suite }\n end\n end", "def new\n @software_test = SoftwareTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @software_test }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end", "def new\n @tester = Tester.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tester }\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to(@test_suite, :notice => 'Test suite was successfully created.') }\n format.xml { render :xml => @test_suite, :status => :created, :location => @test_suite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_suite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @tktest = Tktest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tktest }\n end\n end", "def new\n @test_run = current_user.test_runs.new\n @scenario = Scenario.new\n @registration_scenario = @scenario.registration_scenario || Scenario.new\n @profile = Profile.new\n @target = Target.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end", "def new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end", "def new\n @test_class = TestClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_class }\n end\n end", "def new\n @utest = @project.unit_tests.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @utest }\n end\n end", "def new\n @team_test = TeamTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team_test }\n end\n end", "def new\n @performance_test = PerformanceTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @performance_test }\n end\n end", "def new\n @testdb = Testdb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @testdb }\n end\n end", "def new\n @test_result = TestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_result }\n end\n end", "def new\n @test_submission = TestSubmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_submission }\n end\n end", "def new\n @exercise_plan = ExercisePlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end", "def new\n @study_unit = StudyUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @study_unit }\n end\n end", "def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end", "def new\n @assert = Assert.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assert }\n end\n end", "def new\n @test_page = TestPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_page }\n end\n end", "def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testcase }\n end\n end", "def new\n @weekly_expectation = WeeklyExpectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weekly_expectation }\n end\n end", "def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end", "def new\n @test_board = TestBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_board }\n end\n end", "def new\n @section_test = SectionTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section_test }\n end\n end", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @fixturestat = Fixturestat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixturestat }\n end\n end", "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end", "def new\n @testis = Teste.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @testis }\n end\n end", "def new\n @scenario = Scenario.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scenario }\n end\n end", "def new\n @medium_trial = MediumTrial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_trial }\n end\n end", "def new\n @lab_teach_resource = LabTeachResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end", "def new\n @specie = Specie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specie }\n end\n end", "def new\n @project = Project.find(params[:project_id])\n @sample_set = SampleSet.new\n @sample_set.project_id = @project.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sample_set }\n end\n end", "def new\n @exercise_categories = ExerciseCategory.all\n @exercise_category = ExerciseCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @lunchplan = Lunchplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def new\n @dummy_table = DummyTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy_table }\n end\n end", "def new\n @test10 = Test10.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test10 }\n end\n end", "def new\n @casestudy = Casestudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casestudy }\n end\n end", "def new\n @step = Step.new\n @test_case = TestCase.find(params[:test_case_id])\n respond_with @step\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end", "def new\n @test_file = TestFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_file }\n end\n end", "def new\n @fixture = Fixture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixture }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @experiment }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cohort }\n end\n end", "def create\n \t# add actions here\n # This action takes place in the test suite controller\n end", "def new\n @test_weight = TestWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_weight }\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_plan }\n end\n end", "def new\n @training_level = TrainingLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training_level }\n end\n end", "def new\n\t\t@report = Report.new\n\t\t@report.build_cell\n\t\t@p = params[:test]\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @report }\n\t\tend\n\tend", "def new\n @evaluation = current_customer.customer_evaluations.new\n\n @evaluation.name = Evaluation.sample_evaluation.name if params[:testing]\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @evaluation}\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 @exercise_category = ExerciseCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_category }\n end\n end", "def test_new\n login(\"rolf\")\n get(:new)\n assert_select(\n \"form[action='#{herbaria_path}'][method='post']\", { count: 1 },\n \"'new' action should render a form that posts to #{herbaria_path}\"\n )\n end", "def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end", "def new\n @especy = Especie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @especy }\n end\n end", "def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end", "def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end", "def new\n @fixture = Fixture.new\n\n respond_to do |format|\n format.json { render json: @fixture }\n end\n end", "def test_should_get_new\n get :new\n assert_response :success\n assert_template \"new\"\n assert_select \"h1\", \"New post\"\n assert_select \"form\" do\n assert_select(\"input[type=text][id=post_title]\")\n assert_select(\"textarea[id=post_body]\")\n assert_select(\"input[type=checkbox][id=post_published]\")\n assert_select(\"input[type=submit][id=post_submit][value=Create]\")\n end\n end", "def new\n \n @step = Step.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end", "def new\n @workout_set = WorkoutSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout_set }\n end\n end", "def new\n @kitchen = Kitchen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kitchen }\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 @drug_test = DrugTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drug_test }\n end\n end", "def new\n @expectation = Expectation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expectation }\n end\n end", "def create\n @testing_ = Testing.new(testing__params)\n\n respond_to do |format|\n if @testing_.save\n format.html { redirect_to @testing_, notice: 'Testing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testing_ }\n else\n format.html { render action: 'new' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\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 @daily_exercise = DailyExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_exercise }\n end\n end", "def new\n @student_test = StudentTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_test }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @ptest_result = PtestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ptest_result }\n end\n end", "def new\n #@matches = Match.all\n @title = \"New Ticket\"\n @ticket = Ticket.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket }\n end\n end", "def new\n @evaluationstatus = Evaluationstatus.new\n @title = 'New Evaluation Status'\n @description = 'Add a new evaluation status to the system'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluationstatus }\n end\n end", "def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @week }\n end\n end", "def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @week }\n end\n end", "def new\n @kpt = Kpt.new\n @iterations = Iteration.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kpt }\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sprint }\n end\n end" ]
[ "0.6997694", "0.6991543", "0.68222594", "0.68136525", "0.6809018", "0.677885", "0.677787", "0.67206436", "0.67137027", "0.665657", "0.6572995", "0.65578413", "0.65549487", "0.6513213", "0.6509294", "0.6509294", "0.64772874", "0.6471136", "0.6469058", "0.64507097", "0.6445442", "0.642048", "0.64062756", "0.63500434", "0.633361", "0.63302964", "0.6290808", "0.62839496", "0.62834513", "0.6280046", "0.62693083", "0.62693083", "0.62653923", "0.6264961", "0.62629306", "0.6257323", "0.6246845", "0.62402064", "0.6239889", "0.6212061", "0.61800736", "0.6165278", "0.6150427", "0.61218965", "0.611475", "0.61119926", "0.60801905", "0.6077026", "0.6075884", "0.60602677", "0.60602677", "0.6056551", "0.6054269", "0.60504675", "0.60461146", "0.6044501", "0.6041826", "0.6041826", "0.6038774", "0.60364777", "0.60348827", "0.60298014", "0.60298014", "0.6022048", "0.6015476", "0.60112673", "0.60111696", "0.60074043", "0.6005205", "0.5995552", "0.5987411", "0.5987411", "0.5987411", "0.5987411", "0.59860486", "0.5985707", "0.59814215", "0.59801847", "0.5977229", "0.5977229", "0.59702575", "0.596248", "0.5951439", "0.5945532", "0.5937369", "0.59372497", "0.5937211", "0.59294814", "0.5928114", "0.5925213", "0.59200627", "0.5911284", "0.59082764", "0.590746", "0.5905464", "0.5905308", "0.5902783", "0.5902783", "0.5900131", "0.5895089" ]
0.7865455
0
POST /test_suites POST /test_suites.json
def create @test_suite = TestSuite.new(params[:test_suite]) respond_to do |format| if @test_suite.save format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' } format.json { render json: @test_suite, status: :created, location: @test_suite } else format.html { render action: "new" } format.json { render json: @test_suite.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to(@test_suite, :notice => 'Test suite was successfully created.') }\n format.xml { render :xml => @test_suite, :status => :created, :location => @test_suite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_suite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_test_suite(test_suite)\n @test_suites << test_suite\nend", "def testsuite_params\n params.require(:testsuite).permit(:title, testcases_attributes: Testcase.attribute_names.map(&:to_sym).push(:_destroy) )\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def test_suite_params\n params.require(:test_suite).permit(:student_id, :testing_id, :started_at, :finished_at)\n end", "def index\n @testsuites = Testsuite.all\n end", "def report_test\n report_data = params.require(:api).permit(:code,:stdout,:project,:suite,:section)\n report = api_user.test_reports.create(report_data)\n if report.valid?\n render text: \"ok\"\n else\n raise \"Invalid report\"\n end\n end", "def new\n @test_suite = TestSuite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_suite }\n end\n end", "def create\n @test_case = TestCase.new(test_case_params)\n @test_suite = TestSuite.find(params[:test_suite_id])\n\n #Make sure the tc is linked to the ts\n @test_case.test_suite_id=@test_suite.id\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to test_suite_test_case_path(@test_suite,@test_case), notice: 'Test case was successfully created.' }\n format.json { render :show, status: :created, location: @test_case }\n else\n format.html { render :new }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_suites\n all(QTest::TestSuite, project: @project.id, test_cycle: @id)\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n format.html { redirect_to [:admin, @report], notice: 'Report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end", "def create_test_suite(opts = {})\n create(QTest::TestSuite,\n project: @project.id,\n test_cycle: @id,\n attributes: opts)\n end", "def test_run_params\n params.require(:test_run).permit(:testsuite_id)\n end", "def test_assign_groups_to_reviews\n\n post(:assign_groups_to_reviews,\n { :review_type => {\n # 1-Final, 2-Routing, 3-Pre-Art, 4-Placement, 5-Release\n '5_1'=>'1', '5_2'=>'0', '5_3'=>'1', '5_4'=>'0', '5_5'=>'0', #HWENG\n '6_1'=>'1', '6_2'=>'1', '6_3'=>'1', '6_4'=>'0', '6_5'=>'1', #VALOR\n '7_1'=>'1', '7_2'=>'1', '7_3'=>'0', '7_4'=>'1', '7_5'=>'1', #CE-DFT\n '8_1'=>'0', '8_2'=>'0', '8_3'=>'1', '8_4'=>'0', '8_5'=>'1', #DFM\n '9_1'=>'1', '9_2'=>'0', '9_3'=>'1', '9_4'=>'1', '9_5'=>'0', #TDE\n '10_1'=>'1', '10_2'=>'0', '10_3'=>'1', '10_4'=>'1', '10_5'=>'0', #MECHANICAL\n '11_1'=>'0', '11_2'=>'1', '11_3'=>'1', '11_4'=>'1', '11_5'=>'0', #MECH-MFG\n '12_1'=>'1', '12_2'=>'0', '12_3'=>'0', '12_4'=>'0', '12_5'=>'1', #PCB DESIGN\n '13_1'=>'1', '13_2'=>'0', '13_3'=>'1', '13_4'=>'0', '13_5'=>'0', #PLANNING\n '14_1'=>'1', '14_2'=>'0', '14_3'=>'0', '14_4'=>'0', '14_5'=>'0', #PCB IG\n '15_1'=>'1', '15_2'=>'0', '15_3'=>'0', '15_4'=>'0', '15_5'=>'0', #LIBRARY\n '16_1'=>'0', '16_2'=>'0', '16_3'=>'1', '16_4'=>'1', '16_5'=>'1', #PCB MECH\n '17_1'=>'1', '17_2'=>'1', '17_3'=>'1', '17_4'=>'1', '17_5'=>'1', #SLM BOM\n '18_1'=>'0', '18_2'=>'1', '18_3'=>'1', '18_4'=>'1', '18_5'=>'0', #SLM-Vendor\n '19_1'=>'1', '19_2'=>'0', '19_3'=>'0', '19_4'=>'0', '19_5'=>'1' #OPS MGR\n } },\n cathy_admin_session)\n\n post :review_type_role_assignment, {}, cathy_admin_session\n\n assert_response :success\n\n roles = assigns(roles)['roles']\n review_types = assigns(review_types)['review_types']\n\n expected_values = [\n {:name => 'Hardware Engineering Manager',\n :review_types => []},\n {:name => 'Operations Manager',\n :review_types => ['Final', 'Release']},\n {:name => 'PCB Design',\n :review_types => ['Final', 'Release']},\n {:name => 'Program Manager',\n :review_types => []},\n {:name => 'DFM',\n :review_types => ['Pre-Artwork', 'Release']},\n {:name => 'CE-DFT',\n :review_types => ['Final', 'Placement', 'Release', 'Routing']},\n {:name => 'Compliance - EMC', \n :review_types => []},\n {:name => 'Compliance - Safety', \n :review_types => []},\n {:name => 'Library',\n :review_types => ['Final']},\n {:name => 'ECN',\n :review_types => []},\n {:name => 'HWENG',\n :review_types => ['Final', 'Pre-Artwork']},\n {:name => 'Mechanical',\n :review_types => ['Final', 'Placement', 'Pre-Artwork']},\n {:name => 'Mechanical-MFG',\n :review_types => ['Placement', 'Pre-Artwork', 'Routing']},\n {:name => 'Planning',\n :review_types => ['Final', 'Pre-Artwork']},\n {:name => 'PCB Input Gate',\n :review_types => ['Final']},\n {:name => 'PCB Mechanical',\n :review_types => ['Placement', 'Pre-Artwork', 'Release']},\n {:name => 'SLM BOM',\n :review_types => ['Final', 'Placement', 'Pre-Artwork', 'Release', 'Routing']},\n {:name => 'SLM-Vendor',\n :review_types => ['Placement', 'Pre-Artwork', 'Routing']},\n {:name => 'TDE',\n :review_types => ['Final', 'Placement', 'Pre-Artwork']},\n {:name => 'Valor', \n :review_types => ['Final', 'Pre-Artwork', 'Release', 'Routing']}\n ]\n\n #assert_equal(expected_values, roles)\n assert_equal(expected_values.size, roles.size)\n assert_equal(5, review_types.size)\n\n roles.each_with_index { |role, i|\n expected_role = expected_values[i]\n assert_equal(expected_role[:name], role.name)\n \n returned_rts = role.review_types.collect { |rt| rt.name }\n\n returned_rts = returned_rts.sort_by { |rt| rt }\n returned_rts.each_with_index { |review_type, j|\n expected_name = expected_role[:review_types][j]\n assert_equal(expected_role[:name]+'::'+expected_name.to_s,\n role.name+'::'+review_type)\n }\n\n }\n\n expected_values = [\n {:name => 'Pre-Artwork',\n :role_names => ['DFM', 'HWENG', 'Mechanical', 'Mechanical-MFG', 'PCB Mechanical', 'Planning', 'SLM BOM', 'SLM-Vendor', 'TDE', 'Valor']},\n {:name => 'Placement', \n :role_names => ['CE-DFT', 'Mechanical', 'Mechanical-MFG', 'PCB Mechanical', 'SLM BOM', 'SLM-Vendor', 'TDE']},\n {:name => 'Routing', \n :role_names => ['CE-DFT', 'Mechanical-MFG', 'SLM BOM', 'SLM-Vendor', 'Valor']},\n {:name => 'Final',\n :role_names => ['CE-DFT', 'HWENG', 'Library', 'Mechanical', 'Operations Manager', 'PCB Design', 'PCB Input Gate', 'Planning', 'SLM BOM', 'TDE', 'Valor']},\n {:name => 'Release', \n :role_names => ['CE-DFT', 'DFM', 'Operations Manager', 'PCB Design', 'PCB Mechanical', 'SLM BOM', 'Valor']}\n ]\n review_types.each { |review_type| \n expected_rt = expected_values.shift\n\n returned_roles = []\n review_type.roles.each { |role| returned_roles.push(role.name) }\n\n returned_roles.sort.each { |role|\n expected_role = expected_rt[:role_names]\n expected_name = expected_role.shift\n assert_equal(expected_rt[:name]+'::'+expected_name, \n review_type.name+'::'+role)\n }\n }\n\n end", "def generatesingletestplan\n\trelease = params[:release]\n\tpriority = params[:priority]\n\texectype = params[:exectype]\n\ttimelimit = params[:timelimit]\n\t# получаем с сервера нужные данные\n\tmds = Hash.new()\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t\t# say Hello to server\n\t\tclient.puts \"MasterOnline\"\n\t\tclient.gets\n\t\tclient.puts \"master_set get_singletestplan #{release} #{priority} #{exectype} #{timelimit}\"\n\t\tmds = JSON.parse(client.gets)\n\t\tclient.puts \"master_set close_connection\"\n\t}\n\t# подготавливаем данные для отправки на веб страницу\n\tnewTree = mds\n\t#newTree = newTree[\"TestItem\"][0]\n\t# новое дерево\n\t# вводим фиктивную вершину\n\tvalue = Hash.new()\n\tvalue[:data] = \"Тестирование \" + release\n\t\tfalseAttr = Hash.new()\n\t\tfalseAttr[:class] = \"jstree-checked\"\n\t\tfalseAttr[:id] = \"0001\"\n\t\tfalseAttr[:MethodName] = \"\"\n\t\tfalseAttr[:UnitName] = \"\"\n\tvalue[:attr] = falseAttr\n\t# получаем дерево\n\tchildrens = Array.new()\n\tnewTree[\"TestItem\"].each do |x|\n\t\ttree = createTreeForView(x)\n\t\tchildrens.push(tree)\n\tend\n\tvalue[:children] = childrens\n\trawarray = { :data => value}\n\tmds_for_send = rawarray.to_json\n\trender :text => mds_for_send\n end", "def start_suite(suite);\n @ts = Ox::Element.new('testsuite')\n @ts[:name] = suite[:name]\n @ts[:tests] = suite[:tests]\n @ts[:errors] = suite[:errors]\n @ts[:failures] = suite[:failures]\n @ts[:time] = suite[:time]\n @ts[:timestamp] = suite[:timestamp]\n @testsuites << @ts\n end", "def create\n \t# add actions here\n # This action takes place in the test suite controller\n end", "def test_case_params\n params.require(:test_case).permit(:company_id, :test_suite_id, :title, :description, :setup_started_at, :setup_completed_at, :pending_message, :url, :created_at, :updated_at, :test_environment_ids => [])\n end", "def suite_params\n params.require(:suite).permit(:project_id, :suite_name, :description, :case_id)\n end", "def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end", "def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end", "def test_get_multiple_departments\n data = post_department('count' => 2)\n assert_equal(2, data.length)\n end", "def v2_tests_post(test_detail, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: TestsApi#v2_tests_post ...\"\n end\n \n # verify the required parameter 'test_detail' is set\n fail \"Missing the required parameter 'test_detail' when calling v2_tests_post\" if test_detail.nil?\n \n # resource path\n path = \"/v2/tests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json', 'application/xml', 'text/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(test_detail)\n \n\n auth_names = []\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TestSummary')\n if Configuration.debugging\n Configuration.logger.debug \"API called: TestsApi#v2_tests_post. Result: #{result.inspect}\"\n end\n return result\n end", "def set_test_suite\n @test_suite = TestSuite.find(params[:id])\n end", "def test_case_params\n params.require(:test_case).permit(:name, :endpoint, :method, :params, :timeout, :test_suite_id)\n end", "def sync_test_suites(test_category, test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_syncTestSuites])\n @payload = JSON.generate(test_suite_result_list)\n @params = Hash.new\n @params[Constants::PARAM_TEST_CATEGORY] = test_category\n ReportLog.info(\"Set up the RTC REST client and start syncing test suites for test category #{test_category}...\")\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n rtc_client.run_successfully ? ReportLog.info('Sync completed.') : (raise construct_api_failure_msg(rtc_client))\n ReportLog.exiting(@@class_name, __method__.to_s)\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to test_suites_url }\n format.json { head :no_content }\n end\n end", "def build_results(duration, example_count, failure_count, pending_count)\n @builder.instruct! :xml, version: '1.0', encoding: 'UTF-8'\n @builder.testsuites(\n errors: 0,\n failures: failure_count,\n skipped: pending_count,\n tests: example_count,\n time: duration,\n timestamp: Time.now.iso8601) do\n build_all_suites\n end\n end", "def tests_suites\n @tests_suites.keys.sort\n end", "def create\n @drug_test = DrugTest.new(params[:drug_test])\n @test_types = params[:test_types]\n @test_types_all = []\n @test_types.each do |id| \n @test_types_all +=[TestType.find_by_id(id)]\n end\n @drug_test.test_types=@test_types_all\n respond_to do |format|\n \n if @drug_test.save\n format.html { redirect_to @drug_test, notice: 'Teste de droga foi criado com sucesso.' }\n format.json { render json: @drug_test, status: :created, location: @drug_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drug_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @test_suite.destroy\n respond_to do |format|\n format.html { redirect_to test_suites_url, notice: 'Test suite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_testsuite\n @testsuite = Testsuite.find(params[:id])\n end", "def case_test_params\n params.require(:case_test).permit(:title, :description, :url, :timestamps,\n steps_attributes: [:id, :step_number, :kind, :selector,\n :script_code, :response, :store_datalayer,\n :datalayer, :_destroy])\n end", "def create\n @test_run = TestRun.new(test_run_params)\n @test_run.scenarios.map! do |s|\n s.test_run = @test_run\n s.config_template = @test_run.config\n s\n end\n\n if @test_run.save\n redirect_to @test_run, notice: 'Test run was successfully created.'\n else\n render action: 'new'\n end\n end", "def upload_tests(type)\n if type == :failed\n tests = failed_tests\n table_name = RSpec.configuration.quarantine_failed_tests_table\n elsif type == :flaky\n tests = flaky_tests\n table_name = RSpec.configuration.quarantine_list_table\n else\n raise Quarantine::UnknownUploadError.new(\n \"Quarantine gem did not know how to handle #{type} upload of tests to dynamodb\"\n )\n end\n\n return unless tests.length < 10 && tests.length > 0\n\n begin\n timestamp = Time.now.to_i / 1000 # Truncated millisecond from timestamp for reasons specific to Flexport\n database.batch_write_item(\n table_name,\n tests,\n {\n build_job_id: ENV['BUILDKITE_JOB_ID'] || '-1',\n created_at: timestamp,\n updated_at: timestamp\n }\n )\n rescue Quarantine::DatabaseError => e\n add_to_summary(:database_failures, \"#{e&.cause&.class}: #{e&.cause&.message}\")\n end\n end", "def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token, module_id: @module_id }.merge(attrs)\n @attributes = send_request(\"test_modules/#{attrs[:module_id]}/test_cases\", :post) do |req|\n req.body = {\n test_case: attrs.except(:project_token, :module_id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @testcase = Testcase.find(params[:testcase_id])\n @step = @testcase.steps.new(step_params)\n byebug\n if @step.save\n render :show, status: :created\n else\n render json: @step.errors, status: :unprocessable_entity\n end\n end", "def suite=(test_objects)\n @suite = Array(test_objects)\n end", "def create_new_case(project_id,suite_id,sub_section_id,test_case)\n testrail_api_client.send_post(\"add_case/#{sub_section_id || suite_id}\",test_case_data(test_case))\n end", "def index\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_cases = @test_suite.test_cases\n end", "def suite\n suite_creator = TestSuiteCreator.new(self)\n suite_creator.create\n end", "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end", "def destroy\n @testsuite.destroy\n respond_to do |format|\n format.html { redirect_to testsuites_url, notice: 'Testsuite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def generate_tests\n for tweet_json in TWEET_JSONS\n test_description = \"tweet_json: '#{tweet_json}'\"\n #puts \"scheduling test #{test_description}\"\n generate_one_test test_description, tweet_json\n end\nend", "def tests\n # return newly-initialized copies of the tests\n @suites.values.map {|suite| suite.new(@client, @client2)}\n end", "def test_should_create_group_invite_via_API_JSON\r\n \r\n end", "def publish_test_results(test_category, test_phase, test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n\n test_suite_result_list.each do |test_suite_result|\n test_suite_name = test_suite_result['TestSuiteName']\n test_count = test_suite_result['TestCount'].to_i\n error_count = test_suite_result['ErrorCount'].to_i\n failure_count = test_suite_result['FailureCount'].to_i\n\n pass_rate = 1 - (error_count.to_f + failure_count.to_f)/test_count.to_f\n\n input = Hash.new\n input[:RTCConfig] = data_for(:RTC_config)\n\n if pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:minor_threshold])\n # pass rate standard not met, create or update existing defect\n if pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:blocker_threshold])\n defect_severity = Constants::RTC_SEVERITY_BLOCKER\n elsif pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:major_threshold])\n defect_severity = Constants::RTC_SEVERITY_MAJOR\n elsif pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:normal_threshold])\n defect_severity = Constants::RTC_SEVERITY_NORMAL\n else\n defect_severity = Constants::RTC_SEVERITY_MINOR\n end\n\n # Check from the TEST DB whether there is already an open defect for this test suite\n # if yes, update it\n # if no, create a new one\n\n # set up RTC client and run /getOpenTestAutoDefect API\n ReportLog.info('Pass rate beneath standard. Update existing open defect or create a new one.')\n ReportLog.info(\"Looking for open defect for test suite #{test_suite_name} ...\")\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getOpenTestAutoDefect])\n @payload = JSON.generate(input)\n @params = Hash.new\n @params[Constants::PARAM_TEST_SUITE_NAME] = test_suite_name\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n @params = Hash.new\n @params[Constants::PARAM_TEST_CATEGORY] = test_category\n @params[Constants::PARAM_TEST_PHASE] = test_phase\n @params[Constants::PARAM_DEFECT_SEVERITY] = defect_severity\n input['TestSuiteResult'] = test_suite_result\n @payload = JSON.generate(input)\n if rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).nil?\n # no existing open defect, create a new one\n ReportLog.info('Open defect not found. Creating a new one...')\n # set up RTC client and run /createTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_createTestAutoDefect])\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Created a new defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n else\n # existing open defect found, update it\n ReportLog.info('Open defect found. Updating its content...')\n # set up RTC client and run /updateTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_updateTestAutoDefect])\n @params[Constants::PARAM_DEFECT_NUM] = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Defect Number').to_s\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Updated the open defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n else\n raise construct_api_failure_msg(rtc_client)\n end\n else\n # pass rate reached standard, close open defect automatically\n # Check from the TEST DB whether there is already an open defect for this test suite\n # if yes, close it\n # if no, do nothing, you are good\n\n # set up RTC client for /getOpenTestAutoDefect API\n ReportLog.info('Pass rate reached standard. Close open defect if there is any.')\n ReportLog.info(\"Looking for open defect for test suite #{test_suite_name} ...\")\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getOpenTestAutoDefect])\n @payload = JSON.generate(input)\n @params = Hash.new\n @params[Constants::PARAM_TEST_SUITE_NAME] = test_suite_name\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n @params = Hash.new\n if rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).nil?\n # do nothing\n else\n # existing open defect found, close it\n ReportLog.info('Open defect found. Closing it...')\n # set up RTC client and run /closeTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_closeTestAutoDefect])\n @params[Constants::PARAM_DEFECT_NUM] = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Defect Number').to_s\n @params[Constants::PARAM_COMMENT] = \"Closed defect upon test execution at #{test_suite_result['ExecutionTimestamp']} \"\n + \"from build #{test_suite_result['Build']['BuildName']} \"\n + \"with an acceptable pass rate of #{pass_rate}.\"\n @params[Constants::PARAM_BUILD_NAME] = test_suite_result['Build']['BuildName']\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Closed the open defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n end\n ReportLog.exiting(@@class_name, __method__.to_s)\n end", "def init_test_suites!\n @test_suites = {}\n\n TEST_SUITES.each do |suite, _|\n env = [ENV_NAMESPACE, suite].map(&:to_s).join('_').upcase\n @test_suites[suite] = ENV[env].nil? ? :off : ENV[env].intern\n end\n end", "def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token }.merge(attrs)\n @attributes = send_request('test_plans', :post) do |req|\n req.body = {\n test_plan: attrs.except(:project_token),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def createRun(projectId, suiteId, name, desc, caseids)\r\n\t#{}\"http://testrailgw.jupiter.bbc.co.uk/?action=add_run&project_id=#{projectId}&suite_id=#{suiteId}&name=#{name}&desc={words+to+describe+the+run}&case_ids=1,2,32\"\r\n\tif !(caseids == \"\")\r\n\t\turi = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_run&project_id=#{projectId}&suite_id=#{suiteId}&name=#{name}&desc=#{desc}&case_ids=#{caseids}&sharedSecret=thI5iSourSHAREDsecret\"\r\n\telse\r\n\t\turi = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_run&project_id=#{projectId}&suite_id=#{suiteId}&name=#{name}&desc=#{desc}&sharedSecret=thI5iSourSHAREDsecret\"\r\n\t\t#uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_run&project_id=154&suite_id=4176&name=BigTed Active X v2.5.2.7206 - 25/08/2015 16:27&desc=This is a test report for BigTed Active X v2.5.2.7206&sharedSecret=thI5iSourSHAREDsecret\"\r\n\tend\r\n\turi = uri.gsub(\" \", \"%20\")\r\n\r\n\txml_data = open(uri).read\r\n\tif(xml_data.include? '{\"id\":')\r\n\t\trun = xml_data.split('{\"id\":')[1]\r\n\t\trunId = run.split(',\"suite_id\"')[0]\r\n\t\tputs runId\r\n\telse\r\n\t\tputs xml_data\r\n\t\tfail \"Cannot create RUN in Testrail, check Webservice\"\r\n\tend\r\n\r\n\tfiles = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEArunid.txt\"\r\n\tf = File.open(files,'w')\r\n\tf.write(runId)\r\n\tf.close\r\nend", "def build_results(duration, example_count, failure_count, pending_count)\n @builder.instruct! :xml, version: '1.0', encoding: 'UTF-8'\n @builder.testsuites errors: 0, failures: failure_count, skipped: pending_count, tests: example_count, time: duration, timestamp: Time.now.iso8601 do\n build_all_suites\n end\n end", "def unitTests\n\t\trender(json: {nrFailed: 0, output: \"return some output\", totalTests: 15})\n\tend", "def index\n render status: :ok, json: @test_guide_scenarios\n end", "def run_suite(tests)\n @app.run_suite(tests)\n end", "def update_test_suites_data(test_suite_data)\n return if $debug\n\n test_suite_data.each do |test_data|\n saved_test_suite = get_test_suite_from_test_data(test_data)\n suite_id = get_suite_id_from_saved_test_suite(saved_test_suite, test_data)\n test_data[:suite][:cases].each do |test_case|\n labels = get_labels_from_suite_and_case(test_data[:suite][:labels], test_case[:labels])\n label_ids = insert_and_return_label_ids(labels)\n update_test_case_and_test_case_label(suite_id, test_case, label_ids)\n end\n end\n @connector.disconnect\n end", "def create\n @smoke_test = SmokeTest.new(params[:smoke_test])\n\n respond_to do |format|\n if @smoke_test.save\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully created.') }\n format.json { render :json => @smoke_test, :status => :created, :location => @smoke_test }\n format.xml { render :xml => @smoke_test, :status => :created, :location => @smoke_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def _run_suites suites, type\n # Someone want to explain to me why these are fucking here?\n suites = suites - [MiniTest::Spec]\n suites = suites - [Test::Unit::TestCase] if defined?(Test::Unit::TestCase)\n\n @turn_suite = Turn::TestSuite.new(@turn_config.suite_name)\n @turn_suite.size = suites.size #::MiniTest::Unit::TestCase.test_suites.size\n @turn_suite.seed = ::MiniTest::Unit.runner.options[:seed]\n\n turn_reporter.start_suite(@turn_suite)\n\n if @turn_config.matchcase\n suites = suites.select{ |suite| @turn_config.matchcase =~ suite.name }\n end\n\n result = suites.map { |suite| _run_suite(suite, type) }\n\n turn_reporter.finish_suite(@turn_suite)\n\n return result\n end", "def testing_params\n params.require(:testing).permit(:requiredtests, :name, :customer, :description, :supplier, :supplierrefferenceno, :leadtime, :testdate, :results, :retestdate, :reresults, :cost, :trackingsheet)\n end", "def create\n if has_missing_params?([:test_output, :test_run_id])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n test_run = TestRun.find(params[:test_run_id])\n begin\n test_run.create_test_script_results_from_json(params[:test_output])\n render 'shared/http_status', locals: {code: '201', message:\n HttpStatusHelper::ERROR_CODE['message']['201']}, status: 201\n rescue\n # Some other error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n end\n rescue ActiveRecord::RecordNotFound => e\n # Could not find submission\n render 'shared/http_status', locals: {code: '404', message:\n e}, status: 404\n end", "def create_ts\n tsname = params[:tsname] # Smoke test account management\n tcs = params[:tcs].chomp(',').split(',') # 'value1,value2,..,' => array\n parent_suite_id = params[:tsId]\n\n connection = ActiveRecord::Base.connection\n inserts = []\n ts_id = -1\n\n ActiveRecord::Base.transaction do\n # get silo id\n silo = Silo.find_by name: 'ATG'\n\n # get maximum order\n max_order_suite = Suite.maximum(:order) + 1\n max_order_suitecsm = CaseSuiteMap.maximum(:order) + 1\n\n # insert into suites\n suite = Suite.create(name: tsname, silo_id: silo.id, description: '', order: max_order_suite)\n suite.create_activity key: 'suite.create', owner: User.current_user\n ts_id = suite.id\n\n # insert into suite_maps\n SuiteMap.create(parent_suite_id: parent_suite_id, child_suite_id: ts_id)\n\n # insert into case_suite_maps\n tcs.each do |tc_id|\n inserts.push \"(#{suite.id}, #{tc_id}, #{max_order_suitecsm})\"\n max_order_suitecsm += 1\n end\n\n sql = \"INSERT INTO case_suite_maps (`suite_id`, `case_id`, `order`) VALUES #{inserts.join(', ')}\"\n connection.execute sql\n end\n\n render plain: [ts_id]\n end", "def test_return_all_department_information\n data = post_department('id' => 1)\n assert(data[0]['data'].key?('id'))\n assert(data[0]['data'].key?('code'))\n assert(data[0]['data'].key?('name'))\n end", "def test_params\n params.require(:test).permit(:number, :model, :sample_received, :report_received, :inspection_id, :standard_id, :project_id, :comments)\n end", "def test_params\n params.require(:test).permit(:name, :test_type_id, :schedule, :duration, :is_online, :no_of_items, :subject_class_id)\n end", "def new\n @testcase = Testcase.new\n 3.times { @testcase.scripts.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @testcase }\n end\n end", "def unitTests\n #handle unexpected error with status code 500\n begin\n system(\"rake test:units > output.txt\")\n aFile = File.new(\"output.txt\", \"r\")\n data = aFile.readlines\n aFile.close()\n totalTests = Integer(data[-1].split(\",\")[0].split(\" \")[0])\n nrFailed = Integer(data[-1].split(\",\")[-2].split(\" \")[0]) + Integer(data[-1].split(\",\")[-3].split(\" \")[0])\n if nrFailed == 0\n dic = {:totalTests => totalTests, :nrFailed => 0, :output => \"unitTests all passes\"}\n else\n aFile = File.new(\"output.txt\", \"r\")\n output = aFile.read.split(\"\\n\").join\n aFile.close()\n dic = {:totalTests => totalTests, :nrFailed => nrFailed, :output => output}\n end\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n rescue\n render :json => { :errors => \"Unknown Errors\" }, :status => 500\n end\n end", "def test_result_params\n params.require(:test_result).permit(:ext_id, :tests_count, :tests_passed, :tests_failed, :tests_skipped, :release_id,\n :split_id, :config_id, :asssignee_id)\n end", "def post_ruby\n \n code = params[:code]\n step = params[:step]\n @step = Step.find(step)\n @valid = 0\n @testCount = @step.code_tests.count\n @step.code_tests.each do |test|\n code = validateCode(code)\n @testcode = code + \"\\n print \" + test.input \n testResult = testResult(@testcode)\n logger.info\"..............................#{testResult}\"\n if testResult.to_s == test.output \n @valid += 1 \n end\n \n \n end\n @message = \"#{@valid} out of #{@testCount} testcases passed\"\n render json: {status: 'SUCCESS', testPass: @valid, testCount: @testCount, message:@message },status: :ok\n end", "def create\n @software_test = SoftwareTest.new(params[:software_test])\n\n respond_to do |format|\n if @software_test.save\n format.html { redirect_to @software_test, notice: 'Software test was successfully created.' }\n format.json { render json: @software_test, status: :created, location: @software_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @software_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_run = TestRun.new(params[:test_run])\n\n respond_to do |format|\n if @test_run.save\n format.html { redirect_to @test_run, notice: 'Test run was successfully created.' }\n format.json { render json: @test_run, status: :created, location: @test_run }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_suite(name, proj, parent=false)\n puts \"Creating new test suite named #{name}. Please provide a description for this suite\"\n desc = gets.chomp\n response = parent ? @server.call(\"tl.createTestSuite\", @values.merge(\"testsuitename\" => name, \"details\" => desc, \"testprojectid\" => proj, \"parentid\"=>parent))[0] : @server.call(\"tl.createTestSuite\", @values.merge(\"testsuitename\" => name, \"details\" => desc, \"testprojectid\" => proj))[0]\n return response[\"id\"] if response[\"message\"].match(/ok/i)\n raise \"Error: Unable to create test suite. Check your permissions and the name, then try again.\"\n end", "def test_report_for_build(pipeline, build_id)\n fetch(\"#{pipeline['web_url']}/tests/suite.json?build_ids[]=#{build_id}\")\n end", "def index\n render status: :ok, json: @tests\n end", "def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @suite_result = SuiteResult.new(params[:suite_result])\n\n respond_to do |format|\n if @suite_result.save\n format.html { redirect_to @suite_result, notice: 'Suite result was successfully created.' }\n format.json { render json: @suite_result, status: :created, location: @suite_result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @suite_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @test.done.blank?\n redirect_to root_path, warning: \"This test have not finished yet\"\n return\n end\n params[:submission] = {}\n params[:submission][:user_id] = current_user.id\n @submission = @test.submissions.create(submission_params)\n respond_to do |format|\n if @submission.save\n @test.questions.each do |question|\n question.answers.each do |answer|\n answer.answers_of_questions.create({choice: false, question_id: question.id, submission_id: @submission.id})\n end\n end\n format.html { redirect_to edit_test_submission_path(@test, @submission) }\n else\n format.html { render :new }\n end\n end\n end", "def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end", "def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end", "def add_test_results(test_phase, test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_addTestResults])\n @payload = JSON.generate(test_suite_result_list)\n @params = Hash.new\n @params[Constants::PARAM_TEST_PHASE] = test_phase\n ReportLog.info('Set up the RTC REST client and start adding test results...')\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n rtc_client.run_successfully ? ReportLog.info('Add completed.') : (raise construct_api_failure_msg(rtc_client))\n ReportLog.exiting(@@class_name, __method__.to_s)\n end", "def testcase_params\n params.require(:testcase).permit(:title, :body, :testmodule_id)\n end", "def create\n @performance_test = PerformanceTest.new(params[:performance_test])\n\n respond_to do |format|\n if @performance_test.save\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully created.' }\n format.json { render :json => @performance_test, :status => :created, :location => @performance_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end", "def test_case_params\n params.require(:test_case).permit(:input, :output)\n end", "def create\n @runtest = Runtest.new(runtest_params)\n\n respond_to do |format|\n if @runtest.save\n format.html { redirect_to @runtest, notice: 'Runtest was successfully created.' }\n format.json { render :show, status: :created, location: @runtest }\n else\n format.html { render :new }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_suites_url) }\n format.xml { head :ok }\n end\n end", "def get_test_suite(page, options = {})\n options[:basic_auth] = @auth\n options[:body] = {\n page: page\n }\n self.class.get(\"/projects/id/suites/#{@test_lodge_suite}/steps.json\", options)\n end", "def create\n @test_plan = TestPlan.new(params[:test_plan])\n @test_plan.report_definitions << ReportDefinition.find(params[:report_definition_id]) if params[:report_definition_id]\n\n respond_to do |format|\n if @test_plan.save\n format.html { redirect_to @test_plan, notice: 'Test plan was successfully created.' }\n format.json { render json: @test_plan, status: :created, location: @test_plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def print_test_suites(options={})\n\n # Heading\n print \"TEST_SUITE, \"\n print \"#{@ts_data_types.join(\", \")}\\n\"\n\n # CSV data\n @test_suites.each do |test_suite|\n print \"#{test_suite[:name]}, \"\n @ts_data_types.each do |datatype|\n unless datatype == @ts_data_types.first\n print \", \"\n end\n print \"#{test_suite[datatype.to_sym]}\"\n end\n print \"\\n\"\n end\nend", "def test_params\n params.require(:test).permit(:category_id, answer_ids: [])\n end", "def create_tests\n if @queue.empty?\n\n test_variants = @test_generator.get_test_with_variants(get_test_path, @test_path_params)\n\n if test_variants\n test_variants.each do |test|\n @queue.push(test)\n end\n end\n\n end\n end", "def create\n @suite = Suite.new(params[:suite])\n @resorts = Resort.all\n\n respond_to do |format|\n if @suite.save\n flash[:notice] = 'Suite was successfully created.'\n format.html { redirect_to(@suite) }\n format.xml { render :xml => @suite, :status => :created, :location => @suite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @suite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_case_result_params\n params.require(:test_case_result).permit(:status, :submission_id, :test_case_id)\n end", "def update\n respond_to do |format|\n if @testsuite.update(testsuite_params)\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully updated.' }\n format.json { render :show, status: :ok, location: @testsuite }\n else\n format.html { render :edit }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_sub_group = TestSubGroup.new(params[:test_sub_group])\n end", "def update\n \n if @suite.update(suite_params)\n render JSON: @suite\n else\n render JSON: @suite.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.7096308", "0.6967058", "0.6523598", "0.6320188", "0.6234519", "0.6133401", "0.61276287", "0.6062026", "0.5996524", "0.5969822", "0.59578073", "0.588298", "0.5876363", "0.58427393", "0.5825716", "0.5790882", "0.5785391", "0.57215536", "0.571685", "0.5716376", "0.5688778", "0.56793135", "0.56625235", "0.56363827", "0.56170136", "0.5591728", "0.5588639", "0.5587947", "0.5556158", "0.5553588", "0.55503917", "0.55451256", "0.55410165", "0.55381644", "0.55306756", "0.5516973", "0.5512486", "0.5491776", "0.5460322", "0.5456259", "0.5452164", "0.544945", "0.5448367", "0.5444113", "0.54406214", "0.54342103", "0.5431419", "0.54302216", "0.54198426", "0.54069334", "0.5388701", "0.538065", "0.53742856", "0.5371957", "0.53716534", "0.5356484", "0.53524494", "0.5350361", "0.53492546", "0.5348162", "0.534606", "0.5332562", "0.53284496", "0.53136164", "0.52941597", "0.5290522", "0.5288857", "0.52868426", "0.52834076", "0.52705353", "0.52667665", "0.52630824", "0.52585024", "0.52508783", "0.5240915", "0.5238755", "0.5235678", "0.52349657", "0.52345544", "0.5231136", "0.5229787", "0.5217425", "0.520817", "0.520527", "0.520084", "0.5195778", "0.51862276", "0.51821464", "0.51754934", "0.51746845", "0.5157789", "0.51521987", "0.5150785", "0.51503885", "0.5142647", "0.51408327", "0.513581", "0.5128517", "0.5126411", "0.5124685" ]
0.7056425
1
PUT /test_suites/1 PUT /test_suites/1.json
def update @test_suite = TestSuite.find(params[:id]) respond_to do |format| if @test_suite.update_attributes(params[:test_suite]) format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @test_suite.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @testsuite.update(testsuite_params)\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully updated.' }\n format.json { render :show, status: :ok, location: @testsuite }\n else\n format.html { render :edit }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_suite.update(test_suite_params)\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_suite }\n else\n format.html { render :edit }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @smoke_test = SmokeTest.find(params[:id])\n\n if not params[:smoke_test][:test_suite_ids] and not params[:smoke_test][:config_templates]\n @smoke_test.config_templates.clear\n @smoke_test.test_suites.clear\n end\n respond_to do |format|\n if @smoke_test.update_attributes(params[:smoke_test])\n\n @smoke_test.test_suites.clear if @smoke_test.test_suites.size == 0\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully updated.') }\n format.json { render :json => @smoke_test, :status => :ok }\n format.xml { render :xml => @smoke_test, :status => :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n if @test_suite.update_attributes(params[:test_suite])\n format.html { redirect_to(@test_suite, :notice => 'Test suite was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_suite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @test_suite = TestSuite.find(params[:test_suite_id])\n respond_to do |format|\n if @test_case.update(test_case_params)\n format.html { redirect_to test_suite_test_cases_path(@test_suite,@test_case), notice: 'Test case was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_case }\n else\n format.html { render :edit }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n if @suite.update(suite_params)\n render JSON: @suite\n else\n render JSON: @suite.errors, status: :unprocessable_entity\n end\n end", "def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"test_cases/#{attrs[:id]}\", :put) do |req|\n req.body = {\n test_case: attrs.except(:project_token, :id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def set_testsuite\n @testsuite = Testsuite.find(params[:id])\n end", "def set_test_suite\n @test_suite = TestSuite.find(params[:id])\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n @test_set = TestSet.find(params[:id])\n permitted_to! :update, @test_set.problem\n respond_to do |format|\n if @test_set.update_attributes(permitted_params)\n format.html { redirect_to @test_set, :notice => 'Test set was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @test_run.scenarios.map! do |s|\n s.test_run = @test_run\n s.config_template = @test_run.config\n s\n end\n if @test_run.update(test_run_params)\n redirect_to @test_run, notice: 'Test run was successfully updated.'\n else\n render action: 'edit'\n end\n end", "def set_suite\n begin\n @suite = Suite.find(params[:id])\n rescue => e\n puts e.message\n render json: { message: \"Id da suite não encontrado\" }, status: :not_found\n end\n end", "def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @suite = Suite.find(params[:id])\n respond_to do |format|\n if @suite.update_attributes(params[:suite])\n flash[:notice] = 'Suite was successfully updated.'\n format.html { redirect_to(@suite) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @suite = Suite.find(params[:id])\n\n respond_to do |format|\n if @suite.update_attributes(params[:suite])\n flash[:notice] = 'Suite was successfully updated.'\n format.html { redirect_to(@suite) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @suite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testsuite = Testsuite.new(testsuite_params)\n\n respond_to do |format|\n if @testsuite.save\n format.html { redirect_to @testsuite, notice: 'Testsuite was successfully created.' }\n format.json { render :show, status: :created, location: @testsuite }\n else\n format.html { render :new }\n format.json { render json: @testsuite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @test_guide_scenario_sa.update(test_guide_scenario_sa_params)\n render status: :ok, json: @test_guide_scenario_sa\n else\n self.send(:edit)\n end\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"test_plans/#{attrs[:id]}\", :put) do |req|\n req.body = {\n test_plan: attrs.except(:project_token, :id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def test_update\n\n subsection_01_1_2 = subsections(:subsection_01_1_2)\n subsection_01_1_1 = subsections(:subsection_01_1_1)\n subsect = Subsection.find(subsection_01_1_2.id)\n assert_equal(subsection_01_1_1.url, subsect.url)\n\n subsect.url = 'www.yahoo.com'\n post(:update, { :subsection => subsect.attributes }, cathy_admin_session)\n assert_equal('Subsection was successfully updated.', flash['notice'])\n assert_redirected_to(:controller => 'checklist',\n\t\t\t :action => 'edit',\n :id => subsection_01_1_1.checklist.id)\n\n end", "def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end", "def update\n respond_to do |format|\n if @benchmark_test.update(benchmark_test_params)\n format.html { redirect_to @benchmark_test, notice: 'Benchmark test was successfully updated.' }\n format.json { render :show, status: :ok, location: @benchmark_test }\n else\n format.html { render :edit }\n format.json { render json: @benchmark_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @test_guide_scenario.update(test_guide_scenario_params)\n render status: :ok, json: @test_guide_scenario\n else\n self.send(:edit)\n end\n end", "def update\n respond_to do |format|\n if @tests_specification.update(tests_specification_params)\n format.html { redirect_to edit_tests_specification_path(@tests_specification), notice: \"Tests specification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tests_specification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tests_specification.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to test_suites_url }\n format.json { head :no_content }\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 params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n # jankety solution to set version properly\n @test_instance.update_version(true)\n\n format.html do\n redirect_to test_case_test_instances_url(@test_case),\n notice: 'Test instance was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json do\n render json: @test_instance.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n if @scenario.update(scenario_params)\n \trender json: @scenario\n else\n \trender json: {status: 'ERROR', data: @scenario.errors}\n end\n end", "def update\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @performance_test = PerformanceTest.find(params[:id])\n\n respond_to do |format|\n if @performance_test.update_attributes(params[:performance_test])\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step = Step.find(params[:id])\n @test_case = TestCase.find(params[:test_case_id])\n @step.test_case_id = @test_case.id\n\n if @step.update_attributes(params[:step])\n flash[:notice] = 'Step was successfully updated.'\n end\n respond_with @step\n end", "def update\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n if @test_plan.update_attributes(params[:test_plan])\n format.html { redirect_to @test_plan, notice: 'Test plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @test.update(test_params)\n respond_to do |format|\n format.html { redirect_to admin_tests_path }\n format.json { render :show, status: :ok, location: admin_tests_path }\n end\n else\n respond_to do |format|\n format.html { render :edit, notice: \"Please do you test again. An unexpected error has occured!\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @utest.update_attributes(params[:unit_test])\n flash[:notice] = 'Unit test was successfully updated.'\n format.html { redirect_to [@project, @utest] }\n format.xml { head :ok }\n else\n logger.error @utest.errors.full_messages.join('; ')\n flash[:error] = 'Error updating unit test: ' + view_model_errors(@utest)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @utest.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 @software_test = SoftwareTest.find(params[:id])\n\n respond_to do |format|\n if @software_test.update_attributes(params[:software_test])\n format.html { redirect_to @software_test, notice: 'Software test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @software_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_suite\n @suite = Suite.find(params[:id])\n end", "def update\n respond_to do |format|\n if @test_run.update(test_run_params)\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_run }\n else\n format.html { render :edit }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n if @test_case.update_attributes(params[:test_case])\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def testsuite_params\n params.require(:testsuite).permit(:title, testcases_attributes: Testcase.attribute_names.map(&:to_sym).push(:_destroy) )\n end", "def update_synthetics_test(test_id, type, config, options = {})\n body = {\n 'type' => type,\n 'config' => config\n }.merge(options)\n\n request(Net::HTTP::Put, \"/api/#{API_VERSION}/synthetics/tests/#{test_id}\", nil, body, true)\n end", "def test_update_unsuccessful\n data = {\n firstname: \"\",\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 = 1002\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 test_run_params\n params.require(:test_run).permit(:testsuite_id)\n end", "def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def test_should_update_group_user_via_API_JSON\r\n # lookup user's membership\r\n get \"memberships/find.json?api_key=testapikey&user_id=4&group_id=1\"\r\n membership = JSON.parse(response.body)\r\n membership_id = membership['id']\r\n assert membership_id == 3, 'Incorrect membership id'\r\n assert membership['role_id'] == Role.find_by_rolename('user').id, 'Incorrect role id'\r\n \r\n # promote user to group admin\r\n put \"/memberships/#{membership_id}.xml\", :api_key => 'testapikey',\r\n :membership => {:user_id => 4,\r\n :group_id => 1,\r\n :role_id => Role.find_by_rolename('group_admin') }\r\n assert_response :success\r\n end", "def create\n @test_case = TestCase.new(test_case_params)\n @test_suite = TestSuite.find(params[:test_suite_id])\n\n #Make sure the tc is linked to the ts\n @test_case.test_suite_id=@test_suite.id\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to test_suite_test_case_path(@test_suite,@test_case), notice: 'Test case was successfully created.' }\n format.json { render :show, status: :created, location: @test_case }\n else\n format.html { render :new }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @test.update(test_params)\n render status: :ok, json: @test\n else\n self.send(:edit)\n end\n end", "def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n flash[:notice] = 'Testcase was successfully updated.'\n format.html { redirect_to(@testcase) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end", "def test_should_update_membership\n login_as(:john)\n put :update, :id => 1, :membership => { }\n assert_response :redirect\n end", "def update\n @test = @subject.tests.find_by_id(params[:id])\n if @test.update_attributes(params[:test])\n redirect_to user_subject_tests_path\n else\n render :action => \"edit\"\n end\n end", "def update\n\n update_args = {}\n if params[:reupload].blank?\n properties_array = Array.new\n property_names = params[:test_plan]['property_name']\n property_values = params[:test_plan]['property_value']\n\n count = 0\n property_names.each_with_index.each do |name, index|\n if(!name.strip.empty? and !property_values[index].strip.empty?)\n properties_array[count] = {\"name\" => name.strip, \"value\" => property_values[index].strip}\n count += 1\n end\n end\n\n update_args[:properties] = properties_array.to_json\n else\n update_args = params.require(:test_plan).permit(:jmx)\n end\n\n respond_to do |format|\n if @test_plan.update(update_args)\n format.html { redirect_to project_test_plans_path(@project), flash: {success: 'Test plan was successfully updated.'} }\n format.json { render :show, status: :ok, location: @test_plan }\n else\n format.html { render :edit }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testing_algorithm = TestingAlgorithm.find(params[:id])\n\n if @testing_algorithm.update(params[:testing_algorithm])\n head :no_content\n else\n render json : @testing_algorithm.errors, status : :unprocessable_entity\n end\n end", "def update\n @test_sub_group = TestSubGroup.find(params[:id])\n end", "def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.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 @test_case.update(test_case_params)\n TestMailer.admin_test_updated_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jsontest.update(jsontest_params)\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully updated.' }\n format.json { render :show, status: :ok, location: @jsontest }\n else\n format.html { render :edit }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_suite_params\n params.require(:test_suite).permit(:student_id, :testing_id, :started_at, :finished_at)\n end", "def sync_test_suites(test_category, test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_syncTestSuites])\n @payload = JSON.generate(test_suite_result_list)\n @params = Hash.new\n @params[Constants::PARAM_TEST_CATEGORY] = test_category\n ReportLog.info(\"Set up the RTC REST client and start syncing test suites for test category #{test_category}...\")\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n rtc_client.run_successfully ? ReportLog.info('Sync completed.') : (raise construct_api_failure_msg(rtc_client))\n ReportLog.exiting(@@class_name, __method__.to_s)\n end", "def update\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n @scenario = @test_run.scenario || Scenario.new\n @registration_scenario = @scenario.registration_scenario || Scenario.new\n @profile = @test_run.profile || Profile.new\n @target = @test_run.target || Target.new\n flash[:error] = @test_run.errors.full_messages\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: 422 }\n end\n end\n end", "def update_study(data = {})\n\n raise Capybara::ExpectationNotMet, \"No information was given to update study\" if data.empty?\n\n protocol_id.set(data['Protocol Id']) if data.has_key? 'Protocol Id'\n name.set(data['Name']) if data.has_key? 'Name'\n phase.select(data['Phase']) if data.has_key? 'Phase'\n configuration_type.select(data['Configuration Type']) if data.has_key? 'Configuration Type'\n\n test_study.set(data['Test Study']) if data.has_key? 'Test Study'\n\n\n data.select { |key, value| ['Primary Indication', 'Secondary Indication'].include? key }.each do |key, value|\n self.send(\"study_detail_#{key.parameterize('_').downcase}_container\".to_sym).click\n self.send(\"study_detail_#{key.parameterize('_').downcase}_input_field\".to_sym).set(value)\n self.send(\"study_detail_#{key.parameterize('_').downcase}_results\".to_sym).first.click\n end\n\n self.wait_for_save_button\n save_button.click\n end", "def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_suite }\n end\n end", "def update\n respond_to do |format|\n @test.update_question_details(test_params)\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_test_suite(test_suite)\n @test_suites << test_suite\nend", "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 respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to root_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_intest\n @context = 1\n update_submission\n end", "def update\n if @test.update(test_params)\n return render json: {message: 'Test was updated succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not updated succesfully', error: true }\n end\n end", "def update\n respond_to do |format|\n if @terra_nova_test_benchmark.update(terra_nova_test_benchmark_params)\n format.html { redirect_to @terra_nova_test_benchmark, notice: 'Terra nova test benchmark was successfully updated.' }\n format.json { render :show, status: :ok, location: @terra_nova_test_benchmark }\n else\n format.html { render :edit }\n format.json { render json: @terra_nova_test_benchmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testtest.update(testtest_params)\n format.html { redirect_to @testtest, notice: 'Testtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @testtest }\n else\n format.html { render :edit }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n test_case = TestCase.find(params[:id])\n\n if test_case.update_attributes(test_case_params)\n flash[:notice] = \"Test Case updated!\"\n end\n respond_to do |format|\n format.js { render :action => \"refresh_variables\" }\n end\n end", "def update\n @use_case = UseCase.find(params[:id])\n @use_case.data = params[:data].to_json\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:subaction]==\"step\"\n format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case, :type=>\"step\"), notice: 'Use case was successfully updated.' }\n else\n format.html { redirect_to project_use_case_path(@project, @use_case), notice: 'Use case was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n if @tktest.update_attributes(params[:tktest])\n format.html { redirect_to @tktest, notice: 'Tktest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_with_measure_tests(product_params)\n add_measure_tests(product_params)\n save!\n add_filtering_tests if c4_test\n add_checklist_test if c1_test\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def update\n respond_to do |format|\n if @runtest.update(runtest_params)\n format.html { redirect_to @runtest, notice: 'Runtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @runtest }\n else\n format.html { render :edit }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n if @test_plan.update_attributes(params[:test_plan])\n format.html { redirect_to(@test_plan, :notice => 'Test plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to(@test_suite, :notice => 'Test suite was successfully created.') }\n format.xml { render :xml => @test_suite, :status => :created, :location => @test_suite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_suite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_test = StudentTest.find(params[:id])\n\n respond_to do |format|\n if @student_test.update_attributes(params[:student_test])\n format.html { redirect_to @student_test, notice: 'Student test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sample_set = SampleSet.find(params[:id])\n @project = Project.find(@sample_set.project_id)\n @sample_set.name = params[:sample_set][:name]\n respond_to do |format|\n if @sample_set.save\n format.html { redirect_to project_path(@project), notice: 'Sample set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suite_result = SuiteResult.find(params[:id])\n\n respond_to do |format|\n if @suite_result.update_attributes(params[:suite_result])\n format.html { redirect_to @suite_result, notice: 'Suite result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @suite_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fixit_test.update(fixit_test_params)\n format.html { redirect_to @fixit_test, notice: 'Fixit test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fixit_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_tests_specification\n @tests_specification = TestsSpecification.find(params[:id])\n end", "def update\n @scenario = Scenario.find(params[:id])\n\n respond_to do |format|\n if @scenario.update_attributes(params[:scenario])\n format.html { redirect_to @scenario, notice: 'Scenario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69552743", "0.6828003", "0.67865163", "0.6758148", "0.66596055", "0.65655124", "0.63800573", "0.6289394", "0.6152779", "0.61485344", "0.60898936", "0.6041604", "0.5929602", "0.59279466", "0.5898638", "0.5891064", "0.5890445", "0.58609986", "0.5839565", "0.5831368", "0.57933176", "0.5759349", "0.57582146", "0.5751333", "0.5743869", "0.57367027", "0.5720808", "0.5713501", "0.57103723", "0.5708944", "0.57026666", "0.5699038", "0.56972575", "0.5687538", "0.56870884", "0.5666156", "0.56635356", "0.56582063", "0.5618818", "0.56076914", "0.557298", "0.5571155", "0.55659026", "0.55650705", "0.5564709", "0.55591667", "0.5556894", "0.55567425", "0.55563575", "0.5555585", "0.55499643", "0.55469024", "0.55468893", "0.5537984", "0.55379325", "0.5535003", "0.5535003", "0.55253935", "0.55188584", "0.55051154", "0.5502886", "0.5500763", "0.5499539", "0.5499539", "0.5496432", "0.5482056", "0.5480366", "0.54801846", "0.54783976", "0.5465471", "0.546071", "0.5455505", "0.5453883", "0.5452813", "0.5452502", "0.5443678", "0.5443015", "0.5442623", "0.5429441", "0.5425063", "0.54225075", "0.54134995", "0.5408263", "0.5404008", "0.540342", "0.53979087", "0.5397097", "0.5395581", "0.5395581", "0.5395581", "0.5395581", "0.5395581", "0.5395581", "0.5395581", "0.53944534", "0.53863055", "0.5380377", "0.5379557", "0.5377385", "0.53717417" ]
0.7087594
0
DELETE /test_suites/1 DELETE /test_suites/1.json
def destroy @test_suite = TestSuite.find(params[:id]) @test_suite.destroy respond_to do |format| format.html { redirect_to test_suites_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @testsuite.destroy\n respond_to do |format|\n format.html { redirect_to testsuites_url, notice: 'Testsuite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_suite.destroy\n respond_to do |format|\n format.html { redirect_to test_suites_url, notice: 'Test suite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:id])\n @test_suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_suites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_suite_test_cases_url, notice: 'Test case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @suite = Suite.find(params[:id])\n @suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(suites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @suite = Suite.find(params[:id])\n @suite.destroy\n\n respond_to do |format|\n format.html { redirect_to(suites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @smoke_test = SmokeTest.find(params[:id])\n @smoke_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(smoke_tests_url) }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_set = TestSet.find(params[:id])\n permitted_to! :destroy, @test_set\n @test_set.destroy\n\n respond_to do |format|\n format.html { redirect_to test_sets_url }\n format.json { head :ok }\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 @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_summary = TestSummary.find(params[:id])\n @test_summary.destroy\n\n respond_to do |format|\n format.html { redirect_to test_summaries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @performance_test = PerformanceTest.find(params[:id])\n @performance_test.destroy\n\n respond_to do |format|\n format.html { redirect_to performance_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to test_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tktest = Tktest.find(params[:id])\n @tktest.destroy\n\n respond_to do |format|\n format.html { redirect_to tktests_url }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @test = Mg::Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(mg_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @benchmark_test.destroy\n respond_to do |format|\n format.html { redirect_to benchmark_tests_url, notice: 'Benchmark test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testing_.destroy\n respond_to do |format|\n format.html { redirect_to testing_s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @section_test = SectionTest.find(params[:id])\n @section_test.destroy\n\n respond_to do |format|\n format.html { redirect_to section_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_test = Admin::Test.find(params[:id])\n @admin_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @runtest.destroy\n respond_to do |format|\n format.html { redirect_to runtests_url, notice: 'Runtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Prueba eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @httparty_test.destroy\n respond_to do |format|\n format.html { redirect_to httparty_tests_url, notice: 'Httparty test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testcases_url) }\n format.xml { head :ok }\n end\n end", "def delete(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_cases/#{id}\", :delete) do |req|\n req.body = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def destroy\n @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_test = TestTest.find(params[:id])\n @test_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @software_test = SoftwareTest.find(params[:id])\n @software_test.destroy\n\n respond_to do |format|\n format.html { redirect_to software_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scenario = Scenario.find(params[:id])\n @scenario.destroy\n\n respond_to do |format|\n format.html { redirect_to scenarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testtest.destroy\n respond_to do |format|\n format.html { redirect_to testtests_url, notice: 'Testtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case = TestCase.find(params[:id])\n @test_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_cases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @runscope_test.destroy\n respond_to do |format|\n format.html { redirect_to runscope_tests_url, notice: 'Runscope test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @terra_nova_test_benchmark.destroy\n respond_to do |format|\n format.html { redirect_to terra_nova_test_benchmarks_url, notice: 'Terra nova test benchmark was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @online_test.destroy\n respond_to do |format|\n format.html { redirect_to admin_online_tests_url, notice: 'Online test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fixit_test.destroy\n respond_to do |format|\n format.html { redirect_to fixit_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jquery_test.destroy\n respond_to do |format|\n format.html { redirect_to jquery_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jsontest.destroy\n respond_to do |format|\n format.html { redirect_to jsontests_url, notice: 'Jsontest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_guide_scenario_sa.destroy\n head :no_content\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @test_guide_scenario.destroy\n head :no_content\n end", "def destroy\n @exercise_set = ExerciseSet.find(params[:id])\n @exercise_set.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @weekly_expectation = WeeklyExpectation.find(params[:id])\n @weekly_expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to weekly_expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ab_test.destroy\n respond_to do |format|\n format.html { redirect_to ab_tests_url, notice: 'Ab test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alram_test.destroy\n respond_to do |format|\n format.html { redirect_to alram_tests_url, notice: 'Alram test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @suite_result = SuiteResult.find(params[:id])\n @suite_result.destroy\n\n respond_to do |format|\n format.html { redirect_to suite_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def delete_test\n @project = Project.find(params[:id])\n @testk= @project.testxes.find(params[:test_id])\n if @testk\n @project.testxes.delete(@testk)\n end\n redirect_to :action => 'analyses'\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dtest = Dtest.find(params[:id])\n @dtest.destroy\n\n respond_to do |format|\n format.html { redirect_to dtests_url, notice: t(:dest_test) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run.destroy\n redirect_to test_runs_url\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def destroy\n @testpat.destroy\n respond_to do |format|\n format.html { redirect_to testpats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @utest.destroy\n\n respond_to do |format|\n flash[:notice] = 'Unit Test deleted.'\n format.html { redirect_to project_unit_tests_url(@project) }\n format.xml { head :ok }\n end\n end", "def destroy\n @unsigned_columns_test = UnsignedColumnsTest.find(params[:id])\n @unsigned_columns_test.destroy\n\n respond_to do |format|\n format.html { redirect_to unsigned_columns_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case_result.destroy\n respond_to do |format|\n format.html { redirect_to test_case_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drug_test = DrugTest.find(params[:id])\n @drug_test.destroy\n\n respond_to do |format|\n format.html { redirect_to drug_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @copyeditor_test.destroy\n respond_to do |format|\n format.html { redirect_to copyeditor_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_delete\n \n respond_to do |format|\n format.html { redirect_to(test_cases_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_result = TestResult.find(params[:id])\n @test_result.destroy\n\n respond_to do |format|\n format.html { redirect_to test_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url(subject_class_id: @test.subject_class_id), notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_dep_collector.destroy\n respond_to do |format|\n format.html {redirect_to test_dep_collectors_url, notice: 'Test dep collector was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @test.destroy\n head :no_content\n end", "def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_speedtest.destroy\n respond_to do |format|\n format.html { redirect_to metric_speedtests_url }\n format.json { head :no_content }\n end\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 delete\n if @test.destroy\n return render json: { message: 'Test was removed succesfully.', error: false }\n else\n return render json: { message: 'Error :Something went wrong. Test was not removed.', error: true }\n end\n end", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tester = Tester.find(params[:id])\n @tester.destroy\n\n respond_to do |format|\n format.html { redirect_to testers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @certtest.destroy\n respond_to do |format|\n format.html { redirect_to certtests_url, notice: 'Certtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find_by_id(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to user_subject_tests_path }\n format.xml { head :ok }\n end\n end" ]
[ "0.7463388", "0.7450908", "0.7425022", "0.7218806", "0.70049936", "0.70049936", "0.6989501", "0.6988764", "0.69378406", "0.69378406", "0.69358045", "0.69153684", "0.68908775", "0.68725216", "0.6868106", "0.68638223", "0.6809734", "0.68038315", "0.678919", "0.67684346", "0.6724431", "0.67067766", "0.6674349", "0.6666348", "0.6659833", "0.6646735", "0.66260856", "0.6620608", "0.6615935", "0.661296", "0.65946853", "0.65850264", "0.65813583", "0.6580846", "0.6571545", "0.65701413", "0.6552287", "0.6552287", "0.6552287", "0.6552287", "0.6552287", "0.6552287", "0.6552287", "0.65506154", "0.6546513", "0.65443116", "0.65443116", "0.65363336", "0.65297896", "0.65270996", "0.6526114", "0.65165097", "0.6492177", "0.6488142", "0.6483039", "0.6481743", "0.6481642", "0.6468655", "0.6460995", "0.64597934", "0.64594716", "0.64578116", "0.6456952", "0.64527047", "0.6445585", "0.6436049", "0.64325935", "0.64250565", "0.64182323", "0.64133847", "0.6407599", "0.6407367", "0.6404048", "0.6400606", "0.63993305", "0.639896", "0.63981926", "0.63913417", "0.6389356", "0.6389199", "0.6376803", "0.6370547", "0.6361631", "0.63416535", "0.63398755", "0.6339804", "0.63360834", "0.6334212", "0.6327643", "0.63243496", "0.63226974", "0.6322619", "0.63216984", "0.6316445", "0.63149184", "0.6313525", "0.630737", "0.630737", "0.63068604", "0.63061" ]
0.77769333
0