hexsha
stringlengths
40
40
size
int64
2
1.01M
content
stringlengths
2
1.01M
avg_line_length
float64
1.5
100
max_line_length
int64
2
1k
alphanum_fraction
float64
0.25
1
1de287ab5d7623975b3a17b69e2503329f93062c
467
require 'test_helper' require 'cask/version' describe Cask::CLI::Doctor do it 'displays some nice info about the environment' do out, err = capture_io do Cask::CLI::Doctor.run end # no point in trying to match more of this environment-specific info out.must_match /\A==> OS X Release:/ end it "raises an exception when arguments are given" do lambda { Cask::CLI::Doctor.run('argument') }.must_raise ArgumentError end end
24.578947
72
0.689507
bbe15e63814fb0245012a62ed84b08cceebf6156
1,440
class Mapcidr < Formula desc "Subnet/CIDR operation utility" homepage "https://projectdiscovery.io" url "https://github.com/projectdiscovery/mapcidr/archive/v1.0.0.tar.gz" sha256 "2e3a0fc4301c6c5ebee75a9c6b7dd2e1c646dc5d67b74f97dc3e2eb187a133de" license "MIT" head "https://github.com/projectdiscovery/mapcidr.git", branch: "master" bottle do sha256 cellar: :any_skip_relocation, arm64_monterey: "bb180ee96d7fdcf7c5e4d1d58e8a7d2b8720cebb3227abc724d5327b5c5e3b3f" sha256 cellar: :any_skip_relocation, arm64_big_sur: "5175d170c9d57cf71c116b094fb7536dd16cfffb3874da6a6a356ce8891f4df2" sha256 cellar: :any_skip_relocation, monterey: "463b942ef6f582a60ac8697646243d9ab29a7fbd445eb7395b36581496de8b61" sha256 cellar: :any_skip_relocation, big_sur: "acc508e1770d68ddac19f52e0f05adebd0af3852b31cbb28defc2e560c71d549" sha256 cellar: :any_skip_relocation, catalina: "8911ce7ddd2e79376040bba13ed3591bf5248b2f5d0659647e6716235cdc28b4" sha256 cellar: :any_skip_relocation, x86_64_linux: "626b6dafd42df64af6d022800eb22ed1c770c3740cd1c61cee2ddd6de61b9e30" end depends_on "go" => :build def install system "go", "build", *std_go_args, "./cmd/mapcidr" end test do expected = "192.168.0.0/18\n192.168.64.0/18\n192.168.128.0/18\n192.168.192.0/18\n" output = shell_output("#{bin}/mapcidr -cidr 192.168.1.0/16 -sbh 16384 -silent") assert_equal expected, output end end
48
123
0.784722
ace49d3a4a8113ce2f6b3a27214e0e2502ace25d
5,442
# frozen_string_literal: true require "strscan" require "uri" require "net/http" require_relative "httpool" class Gel::TailFile # The number of redirects etc we'll follow before giving up MAXIMUM_CHAIN = 8 # When attempting a partial file download, we'll back up by this many # bytes to ensure the preceding content matches our local file CONTENT_OVERLAP = 100 # Only bother trying for a partial download if we have at least this # many bytes of local content. If we *don't* make a partial request, # 1) we're guaranteed not to need a second request due to bad overlap, # and 2) the response can be gzipped. PARTIAL_MINIMUM = 65536 attr_accessor :uri, :pinboard, :filename def initialize(uri, pinboard, httpool: Gel::Httpool.new) @uri = uri @pinboard = pinboard @httpool = httpool @filename = pinboard.filename(uri) @etag = pinboard.etag(uri) @done = false end def done? @done end def update(force_reset: false) uri = self.uri File.open(@filename, "a+b") do |f| f.seek(0, IO::SEEK_END) MAXIMUM_CHAIN.times do f.seek(0, IO::SEEK_SET) if force_reset request = Net::HTTP::Get.new(uri) requested_from = 0 if f.pos > PARTIAL_MINIMUM requested_from = f.pos - CONTENT_OVERLAP request["Range"] = "bytes=#{requested_from}-" request["Accept-Encoding"] = "identity" else f.pos = 0 end request["If-None-Match"] = @etag if @etag response = @httpool.request(uri, request) case response when Net::HTTPNotModified @done = true pinboard.updated(uri, response["ETag"], false) return # no-op when Net::HTTPRequestedRangeNotSatisfiable # This should never happen, but sometimes does: either the # file has been rebuilt, and we should do a full fetch, or # we're ahead of the server (because an intermediate is # caching too aggressively, say), and we should do nothing. if response["Content-Range"] =~ /\Abytes \*\/(\d+)\z/ current_length = $1.to_i debug "File is smaller than we expected: only #{current_length} bytes" # Back up a bit, and check whether the end matches what we # already have f.pos = current_length next else force_reset = true next end when Net::HTTPOK f.pos = 0 f.truncate(0) f.write response.body f.flush @done = true pinboard.updated(uri, response["ETag"], true) return # Done when Net::HTTPPartialContent if response["Content-Range"] =~ /\Abytes (\d+)-(\d+)\/(\d+)\z/ from, to, size = $1.to_i, $2.to_i, $3.to_i else # Not what we asked for debug "Bad response range" force_reset = true next end if from != requested_from # Server didn't give us what we asked for debug "Incorrect response range" force_reset = true next end if to - from + 1 != response.body.size # Server didn't give us what it claimed to debug "Bad response length" force_reset = true next end debug "Current file size is #{File.size(@filename)}" debug "Remote size is #{size}" f.pos = from if to < f.size # No new content, but check the overlap in case the file's # been reset overlap = f.read(to - from + 1) if response.body == overlap # Good overlap, but nothing new debug "Overlap is good, but no new content" @done = true pinboard.updated(uri, @etag, false) # keep old etag return # Done else # Bad overlap debug "Bad overlap on short response" force_reset = true next end else overlap = f.read if response.body[0, overlap.size] == overlap # Good overlap; use rest rest = response.body[overlap.size..-1] debug "#{overlap.size} byte overlap is okay" debug "Using remaining #{rest.size} bytes" f.write(rest) f.flush @done = true pinboard.updated(uri, response["ETag"], true) return # Done else # Bad overlap debug "Bad overlap on long response" force_reset = true next end end when Net::HTTPRedirection uri = URI(response["Location"]) next when Net::HTTPTooManyRequests # https://github.com/rubygems/rubygems-infrastructure/blob/adc0668c1f1539f281ffe86c6e0ad12743c5c8bd/cookbooks/rubygems-balancer/templates/default/site.conf.erb#L12 debug "Rate limited" sleep 1 + rand next else # splat response.value raise "Unexpected HTTP success code" end end raise "Giving up after #{MAXIMUM_CHAIN} requests" end end def debug(message) #$stderr.puts message if $DEBUG end end
26.417476
173
0.554759
1a5991e344df789fdc7c2b801fa44df4e1c7357e
2,302
# frozen_string_literal: true # == Schema Information # # Table name: event_flag_histories # # id :integer not null, primary key # accessibility_and_inclusion :boolean default(FALSE) # allocations :boolean default(FALSE) # consuite :boolean default(FALSE) # dealers :boolean default(FALSE) # dock :boolean default(FALSE) # emergency :boolean default(FALSE) # first_advisors :boolean default(FALSE) # hidden :boolean default(FALSE) # hotel :boolean default(FALSE) # is_active :boolean default(FALSE) # medical :boolean default(FALSE) # member_advocates :boolean default(FALSE) # merchandise :boolean default(FALSE) # merged :boolean # nerf_herders :boolean default(FALSE) # operations :boolean default(FALSE) # orig_time :datetime # parties :boolean default(FALSE) # post_con :boolean default(FALSE) # programming :boolean default(FALSE) # registration :boolean default(FALSE) # rolename :string # secure :boolean default(FALSE) # smokers_paradise :boolean default(FALSE) # sticky :boolean default(FALSE) # volunteers :boolean default(FALSE) # volunteers_den :boolean default(FALSE) # created_at :datetime # updated_at :datetime # event_id :integer # user_id :integer # # Indexes # # index_event_flag_histories_on_created_at (created_at) # index_event_flag_histories_on_event_id (event_id) # index_event_flag_histories_on_updated_at (updated_at) # require 'test_helper' class EventFlagHistoryTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end
42.62963
70
0.501738
f7ecccd406168140a89b1b0427ca9fc5f35d3abe
1,971
require 'ideone' require 'bacon' describe 'an ideone gem user' do it 'can submit Ruby code and receive stdout' do paste_id = Ideone.submit( :ruby, %{puts "text on stdout"} ) results = Ideone.run( paste_id, nil ) results.should.equal %{text on stdout\n} end it 'can submit Perl code and receive stdout' do paste_id = Ideone.submit( :perl, %{print "text on stdout\\n"} ) results = Ideone.run( paste_id, nil ) results.should.equal %{text on stdout\n} end it 'can submit Python code and receive stdout' do paste_id = Ideone.submit( :python, %{print "text on stdout"} ) results = Ideone.run( paste_id, nil ) results.should.equal %{text on stdout\n} end it 'can submit PHP code and receive stdout' do paste_id = Ideone.submit( :php, %{<?php echo "text on stdout\\n"; ?>} ) results = Ideone.run( paste_id, nil ) results.should.equal %{text on stdout\n} end it 'can submit Lua code and receive stdout' do paste_id = Ideone.submit( :lua, %{print "text on stdout"} ) results = Ideone.run( paste_id, nil ) results.should.equal %{text on stdout\n} end it 'can submit Tcl code and receive stdout' do paste_id = Ideone.submit( :tcl, %{puts "text on stdout";} ) results = Ideone.run( paste_id, nil ) results.should.equal %{text on stdout\n} end it 'can submit Bash code and receive stdout' do paste_id = Ideone.submit( :bash, %{echo "text on stdout"} ) results = Ideone.run( paste_id, nil ) results.should.equal %{text on stdout\n} end it "can submit Ruby code that doesn't print anything to stdout" do paste_id = Ideone.submit( :ruby, %{1+1} ) results = Ideone.run( paste_id, nil ) results.should.be.nil end it 'can submit Ruby code and receive stdout that has characters that would get HTML escaped' do paste_id = Ideone.submit( :ruby, %{p '1 < 2'} ) results = Ideone.run( paste_id, nil ) results.should.equal %{"1 < 2"\n} end end
33.40678
97
0.662608
2164b9d314a88f05063fb0de6cb28adf85df1a9f
223
require 'revamp' # This class implements slugification of Puppet module name: 'puppetlabs/stdlib' <-> 'puppetlabs-stdlib' class Revamp::Mapper::PuppetNameSlugger def map(slash_name) slash_name.tr('/', '-') end end
24.777778
104
0.730942
f8a21115a333332230851f05175051a4a708ee8c
254
module TopologySpecHelper RSpec.configure do |config| config.around(:example, :type => :topology) do |example| with_modified_env(:TOPOLOGICAL_INVENTORY_URL => "http://topology.example.com") do example.call end end end end
25.4
87
0.688976
4af6599c437f9ebd94b13ced2ea117427705390a
586
Pod::Spec.new do |s| s.name = 'PodFrameTest' s.version = '1.0.0' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'liuzhipeng' => '[email protected]' } s.summary = 'PodFrameTest for pods' s.homepage = 'http://www.baidu.com' s.platform = :ios, '7.0' s.source_files = 'TestSDK/**/*.{pch,h,m}' s.source = { :git => 'https://github.com/lzpWhite/PodFrameTest.git', :tag => s.version} s.resources = 'Sources/*.{bundle, png, jpg}' s.framework = 'UIKit' s.requires_arc = true end
41.857143
98
0.532423
33302233120fdf0ad0f23533cdb5b0d7dc6b5d3b
787
# # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'adhara_socket_io' s.version = '0.0.1' s.summary = 'socket.io for flutter by adhara' s.description = <<-DESC socket.io for flutter by adhara DESC s.homepage = 'https://github.com/infitio/flutter_socket_io/' s.license = { :file => '../LICENSE' } s.author = { 'Infitio' => '[email protected]' } s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' s.dependency 'Socket.IO-Client-Swift' s.dependency 'Starscream' s.swift_version = '5.0' s.ios.deployment_target = '9.0' end
31.48
83
0.579416
f7816cd6b7f43469853e0f6aceda14c2e0eebd8f
60
class Question < ActiveRecord::Base belongs_to :story end
15
35
0.783333
e9bd44766cd2e16d56a54276809698c9623da4ee
1,772
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] # GET /users # GET /users.json def index @users = User.all end # GET /users/1 # GET /users/1.json def show end # GET /users/new def new @user = User.new end # GET /users/1/edit def edit end # POST /users # POST /users.json def create @user = User.new(user_params) respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'User was successfully created.' } format.json { render :show, status: :created, location: @user } else format.html { render :new } format.json { render json: @user.errors, status: :unprocessable_entity } end end end # PATCH/PUT /users/1 # PATCH/PUT /users/1.json def update respond_to do |format| if @user.update(user_params) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end # DELETE /users/1 # DELETE /users/1.json def destroy @user.destroy respond_to do |format| format.html { redirect_to users_url, notice: 'User was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_user @user = User.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def user_params params.require(:user).permit(:name) end end
23.626667
88
0.637133
91789d2bd691f36ec66a878e8d86d6cc7ef5b381
749
def initialize(info = {}) super( update_info( info, 'Name' => 'Sample Auxiliary', # The description can be multiple lines, but does not preserve formatting. 'Description' => 'Sample Auxiliary Module', 'Author' => ['Joe Module <[email protected]>'], 'License' => MSF_LICENSE, 'Actions' => [ [ 'Default Action', 'Description' => 'This does something' ], [ 'Another Action', 'Description' => 'This does a different thing' ] ], # The action(s) that will run as background job 'PassiveActions' => [ 'Another Action' ], 'DefaultAction' => 'Default Action' ) ) end
34.045455
82
0.510013
e8195fcd923eabe71bd546536e4d80d15580260f
1,035
module Imports class UserImportService < ImportService def create_users(folder) import_from(folder, :create_user) end private PROVIDER_TYPE = { "Data Provider" => User.roles[:data_provider], }.freeze def create_user(xml_document) organisation = Organisation.find_by(old_org_id: user_field_value(xml_document, "institution")) User.create!( email: user_field_value(xml_document, "user-name"), name: user_field_value(xml_document, "full-name"), password: Devise.friendly_token, phone: user_field_value(xml_document, "telephone-no"), old_user_id: user_field_value(xml_document, "id"), organisation:, role: PROVIDER_TYPE[user_field_value(xml_document, "user-type")], ) rescue ActiveRecord::RecordNotUnique @logger.warn("User #{name} with old user id #{old_user_id} is already present, skipping.") end def user_field_value(xml_document, field) field_value(xml_document, "user", field) end end end
31.363636
100
0.689855
1c7b698b43200c2207bd848d167ba2a93c12d0a7
156
require "class_names/helper" module ClassNames module ViewHelper def class_names(*args) ::ClassNames::Helper.new(*args).to_s end end end
15.6
42
0.705128
d53cc3b04950a2cdadb6fb2b981c002e99b731c4
116
json.extract! @castle_structure, :id, :result_no, :generate_no, :e_no, :frame_type, :i_no, :created_at, :updated_at
58
115
0.75
6af355879b8f9e1cf024c2ddac86022be26d31fe
771
# frozen_string_literal: true require 'logger' module CONF LOG_FILE = STDOUT DNS_SERVER_TYPE = :knot # DNS_SERVER_TYPE = :bind # 1 = master. 0 = slave DNS_SERVER_MASTER = (ENV['DNS_MASTER_SERVER'] || 1).to_s == "1" module KNOT ZONE_FILE_DIR = ENV['KNOT_ZONE_FILE_DIR'] || '/etc/knot/zones' ZONE_FILE_SUFFIX = ENV['KNOT_ZONE_FILE_SUFFIX'] || '.zone' ZONE_FILE_LIST = ENV['KNOT_ZONE_FILE_LIST'] || '/etc/knot/knot-zones.conf' DOMAIN_TEMPLATE_NAME = ENV['DOMAIN_TEMPLATE_NAME'] || 'rest2dns' COMMAND_RELOAD = ENV['KNOT_COMMAND_RELOAD'] || 'knotc reload' COMMAND_CHECKZONE = ENV['KNOT_COMMAND_CHECKZONE'] || 'kzonecheck' end end $log = Logger.new(CONF::LOG_FILE) $log.formatter = Logger::Formatter.new $log.level = Logger::DEBUG
28.555556
78
0.701686
87685d3e4ca80481eb83d837b9c787a54be62add
203
class Player < ApplicationRecord has_many :games validates :name, presence: true , uniqueness: true, length: { in: 3..30 }, format: { with: /\A[a-zA-Z]+\z/, message: "only allows letters" } end
40.6
145
0.660099
d56bd4f9dcce8e54fae088f1ab33177404bb32d8
206
class UserAuthentication < ApplicationRecord belongs_to :user belongs_to :authenticatable, polymorphic: true validates_uniqueness_of :authenticatable_id, scope: [:user_id, :authenticatable_type] end
29.428571
87
0.825243
abffd370a0f57fc73945d03256d4c8ba9606cd7a
513
require 'chef/provisioning' # These are the options you can use: http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Client.html#run_instances-instance_method add_machine_options bootstrap_options: { key_name: 'THE-KEY-IN-EC2-Network & Security-Key Pairs-Name' flavor_id: 'm1.medium', image_id: 'ami-f1ce8bc1', # this is ubuntu 14.04.1 security_group_ids: "sg-xxxxxxxx" } machine 'bowser' do tag 'loadbalancer' end
32.0625
128
0.62963
087e5fd2821286cbf9317321f95ee1e7da30cffc
130
# frozen_string_literal: true # typed: true # compiled: true class A def foo end end require_relative './defines_behavior__2'
14.444444
40
0.761538
08a882a437e75c2665702b8efef023ce37d532fd
650
module Startups class Select2SearchService def self.search_for_startup(term) startups = Startup.all query_words = term.split query_words.each do |query| startups = startups.where( 'startups.name ILIKE ?', "%#{query}%" ) end # Limit the number of object allocations. selected_startups = startups.limit(19) select2_results = selected_startups.select(:id, :name).each_with_object([]) do |search_result, results| results << { id: search_result.id, text: search_result.name } end select2_results end end end
24.074074
109
0.604615
7ab882fc12ffc8692981d58a3c59249850cfca14
1,460
require "spec_helper" describe Lumberjack::Device::Multi do let(:output_1) { StringIO.new } let(:output_2) { StringIO.new } let(:device_1) { Lumberjack::Device::Writer.new(output_1, template: ":message") } let(:device_2) { Lumberjack::Device::Writer.new(output_2, template: ":severity - :message") } let(:device) { Lumberjack::Device::Multi.new(device_1, device_2) } let(:entry) { Lumberjack::LogEntry.new(Time.now, Logger::INFO, "test", "app", 100, {}) } it "should write an entry to each device" do device.write(entry) expect(output_1.string.chomp).to eq "test" expect(output_2.string.chomp).to eq "INFO - test" end it "should flush each device" do expect(device_1).to receive(:flush).and_call_original expect(device_2).to receive(:flush).and_call_original device.flush end it "should close each device" do expect(device_1).to receive(:close).and_call_original expect(device_2).to receive(:close).and_call_original device.close end it "should reopen each device" do expect(device_1).to receive(:reopen).with(nil).and_call_original expect(device_2).to receive(:reopen).with(nil).and_call_original device.reopen end it "should set the dateformat on each device" do device.datetime_format = "%Y-%m-%d" expect(device.datetime_format).to eq "%Y-%m-%d" expect(device_1.datetime_format).to eq "%Y-%m-%d" expect(device_2.datetime_format).to eq "%Y-%m-%d" end end
33.953488
95
0.70274
7989cf0e5f91c32cc5e404b302b7f8689ac1ddc4
1,904
#! /usr/bin/env ruby require 'spec_helper' describe Puppet::Parser::AST::ResourceOverride do ast = Puppet::Parser::AST before :each do @compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("mynode")) @scope = Puppet::Parser::Scope.new(@compiler) @params = ast::ASTArray.new({}) @compiler.stubs(:add_override) end it "should evaluate the overriden object" do klass = stub 'klass', :title => "title", :type => "type" object = mock 'object' object.expects(:safeevaluate).with(@scope).returns(klass) ast::ResourceOverride.new(:object => object, :parameters => @params ).evaluate(@scope) end it "should tell the compiler to override the resource with our own" do @compiler.expects(:add_override) klass = stub 'klass', :title => "title", :type => "one" object = mock 'object', :safeevaluate => klass ast::ResourceOverride.new(:object => object , :parameters => @params).evaluate(@scope) end it "should return the overriden resource directly when called with one item" do klass = stub 'klass', :title => "title", :type => "one" object = mock 'object', :safeevaluate => klass override = ast::ResourceOverride.new(:object => object , :parameters => @params).evaluate(@scope) override.should be_an_instance_of(Puppet::Parser::Resource) override.title.should == "title" override.type.should == "One" end it "should return an array of overriden resources when called with an array of titles" do klass1 = stub 'klass1', :title => "title1", :type => "one" klass2 = stub 'klass2', :title => "title2", :type => "one" object = mock 'object', :safeevaluate => [klass1,klass2] override = ast::ResourceOverride.new(:object => object , :parameters => @params).evaluate(@scope) override.should have(2).elements override.each {|o| o.should be_an_instance_of(Puppet::Parser::Resource) } end end
37.333333
101
0.673319
33b843f355244b9c6ea14b5a80603dd05b80d860
206
# frozen_string_literal: true module Db2Query module Type class Integer < Value def type :integer end def deserialize(value) value.to_i end end end end
12.875
29
0.597087
01dd2ca1f8b8b367489eb09112b9cf20482a7cd5
2,985
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! module Google module Ads module GoogleAds module V7 module Errors # Container for enum describing possible conversion action errors. class ConversionActionErrorEnum include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods # Enum describing possible conversion action errors. module ConversionActionError # Enum unspecified. UNSPECIFIED = 0 # The received error code is not known in this version. UNKNOWN = 1 # The specified conversion action name already exists. DUPLICATE_NAME = 2 # Another conversion action with the specified app id already exists. DUPLICATE_APP_ID = 3 # Android first open action conflicts with Google play codeless download # action tracking the same app. TWO_CONVERSION_ACTIONS_BIDDING_ON_SAME_APP_DOWNLOAD = 4 # Android first open action conflicts with Google play codeless download # action tracking the same app. BIDDING_ON_SAME_APP_DOWNLOAD_AS_GLOBAL_ACTION = 5 # The attribution model cannot be set to DATA_DRIVEN because a data-driven # model has never been generated. DATA_DRIVEN_MODEL_WAS_NEVER_GENERATED = 6 # The attribution model cannot be set to DATA_DRIVEN because the # data-driven model is expired. DATA_DRIVEN_MODEL_EXPIRED = 7 # The attribution model cannot be set to DATA_DRIVEN because the # data-driven model is stale. DATA_DRIVEN_MODEL_STALE = 8 # The attribution model cannot be set to DATA_DRIVEN because the # data-driven model is unavailable or the conversion action was newly # added. DATA_DRIVEN_MODEL_UNKNOWN = 9 # Creation of this conversion action type isn't supported by Google # Ads API. CREATION_NOT_SUPPORTED = 10 # Update of this conversion action isn't supported by Google Ads API. UPDATE_NOT_SUPPORTED = 11 end end end end end end end
36.402439
88
0.644891
0192babc49edc52afc2d48b656aab22864c4a7a2
1,196
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::DevTestLabs::Mgmt::V2016_05_15 module Models # # Properties of the disk to detach. # class DetachDiskProperties include MsRestAzure # @return [String] The resource ID of the Lab VM to which the disk is # attached. attr_accessor :leased_by_lab_vm_id # # Mapper for DetachDiskProperties class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'DetachDiskProperties', type: { name: 'Composite', class_name: 'DetachDiskProperties', model_properties: { leased_by_lab_vm_id: { client_side_validation: true, required: false, serialized_name: 'leasedByLabVmId', type: { name: 'String' } } } } } end end end end
25.446809
75
0.565217
1da02b45ab5c38b0b118746a04f06eb11d56fe4a
9,588
require 'time' require 'uri' require 'cookiejar/cookie_validation' module CookieJar # Cookie is an immutable object which defines the data model of a HTTP Cookie. # The data values within the cookie may be different from the # values described in the literal cookie declaration. # Specifically, the 'domain' and 'path' values may be set to defaults # based on the requested resource that resulted in the cookie being set. class Cookie # [String] The name of the cookie. attr_reader :name # [String] The value of the cookie, without any attempts at decoding. attr_reader :value # [String] The domain scope of the cookie. Follows the RFC 2965 # 'effective host' rules. A 'dot' prefix indicates that it applies both # to the non-dotted domain and child domains, while no prefix indicates # that only exact matches of the domain are in scope. attr_reader :domain # [String] The path scope of the cookie. The cookie applies to URI paths # that prefix match this value. attr_reader :path # [Boolean] The secure flag is set to indicate that the cookie should # only be sent securely. Nearly all HTTP User Agent implementations assume # this to mean that the cookie should only be sent over a # SSL/TLS-protected connection attr_reader :secure # [Boolean] Popular browser extension to mark a cookie as invisible # to code running within the browser, such as JavaScript attr_reader :http_only # [Fixnum] Version indicator, currently either # * 0 for netscape cookies # * 1 for RFC 2965 cookies attr_reader :version # [String] RFC 2965 field for indicating comment (or a location) # describing the cookie to a usesr agent. attr_reader :comment, :comment_url # [Boolean] RFC 2965 field for indicating session lifetime for a cookie attr_reader :discard # [Array<FixNum>, nil] RFC 2965 port scope for the cookie. If not nil, # indicates specific ports on the HTTP server which should receive this # cookie if contacted. attr_reader :ports # [Time] Time when this cookie was first evaluated and created. attr_reader :created_at # Evaluate when this cookie will expire. Uses the original cookie fields # for a max age or expires # # @return [Time, nil] Time of expiry, if this cookie has an expiry set def expires_at if @expiry.nil? || @expiry.is_a?(Time) @expiry else @created_at + @expiry end end # Indicates whether the cookie is currently considered valid # # @param [Time] time to compare against, or 'now' if omitted # @return [Boolean] def expired? (time = Time.now) expires_at != nil && time > expires_at end # Indicates whether the cookie will be considered invalid after the end # of the current user session # @return [Boolean] def session? @expiry == nil || @discard end # Create a cookie based on an absolute URI and the string value of a # 'Set-Cookie' header. # # @param request_uri [String, URI] HTTP/HTTPS absolute URI of request. # This is used to fill in domain and port if missing from the cookie, # and to perform appropriate validation. # @param set_cookie_value [String] HTTP value for the Set-Cookie header. # @return [Cookie] created from the header string and request URI # @raise [InvalidCookieError] on validation failure(s) def self.from_set_cookie request_uri, set_cookie_value args = CookieJar::CookieValidation.parse_set_cookie set_cookie_value args[:domain] = CookieJar::CookieValidation. determine_cookie_domain request_uri, args[:domain] args[:path] = CookieJar::CookieValidation. determine_cookie_path request_uri, args[:path] cookie = Cookie.new args CookieJar::CookieValidation.validate_cookie request_uri, cookie cookie end # Create a cookie based on an absolute URI and the string value of a # 'Set-Cookie2' header. # # @param request_uri [String, URI] HTTP/HTTPS absolute URI of request. # This is used to fill in domain and port if missing from the cookie, # and to perform appropriate validation. # @param set_cookie_value [String] HTTP value for the Set-Cookie2 header. # @return [Cookie] created from the header string and request URI # @raise [InvalidCookieError] on validation failure(s) def self.from_set_cookie2 request_uri, set_cookie_value args = CookieJar::CookieValidation.parse_set_cookie2 set_cookie_value args[:domain] = CookieJar::CookieValidation. determine_cookie_domain request_uri, args[:domain] args[:path] = CookieJar::CookieValidation. determine_cookie_path request_uri, args[:path] cookie = Cookie.new args CookieJar::CookieValidation.validate_cookie request_uri, cookie cookie end # Returns cookie in a format appropriate to send to a server. # # @param [FixNum] 0 version, 0 for Netscape-style cookies, 1 for # RFC2965-style. # @param [Boolean] true prefix, for RFC2965, whether to prefix with # "$Version=<version>;". Ignored for Netscape-style cookies def to_s ver=0, prefix=true case ver when 0 "#{name}=#{value}" when 1 # we do not need to encode path; the only characters required to be # quoted must be escaped in URI str = prefix ? "$Version=#{version};" : "" str << "#{name}=#{value};$Path=\"#{path}\"" if domain.start_with? '.' str << ";$Domain=#{domain}" end if ports str << ";$Port=\"#{ports.join ','}\"" end str end end # Return a hash representation of the cookie. def to_hash result = { :name => @name, :value => @value, :domain => @domain, :path => @path, :created_at => @created_at } { :expiry => @expiry, :secure => (true if @secure), :http_only => (true if @http_only), :version => (@version if version != 0), :comment => @comment, :comment_url => @comment_url, :discard => (true if @discard), :ports => @ports }.each do |name, value| result[name] = value if value end result end # Determine if a cookie should be sent given a request URI along with # other options. # # This currently ignores domain. # # @param uri [String, URI] the requested page which may need to receive # this cookie # @param script [Boolean] indicates that cookies with the 'httponly' # extension should be ignored # @return [Boolean] whether this cookie should be sent to the server def should_send? request_uri, script uri = CookieJar::CookieValidation.to_uri request_uri # cookie path must start with the uri, it must not be a secure cookie # being sent over http, and it must not be a http_only cookie sent to # a script path_match = uri.path.start_with? @path secure_match = !(@secure && uri.scheme == 'http') script_match = !(script && @http_only) expiry_match = !expired? ports_match = ports.nil? || (ports.include? uri.port) path_match && secure_match && script_match && expiry_match && ports_match end def decoded_value CookieJar::CookieValidation::decode_value value end # Return a JSON 'object' for the various data values. Allows for # persistence of the cookie information # # @param [Array] a options controlling output JSON text # (usually a State and a depth) # @return [String] JSON representation of object data def to_json *a to_hash.merge(:json_class => self.class.name).to_json(*a) end # Given a Hash representation of a JSON document, create a local cookie # from the included data. # # @param [Hash] o JSON object of array data # @return [Cookie] cookie formed from JSON data def self.json_create o params = o.inject({}) do |hash, (key, value)| hash[key.to_sym] = value hash end params[:version] ||= 0 params[:created_at] = Time.parse params[:created_at] if params[:expiry].is_a? String params[:expires_at] = Time.parse params[:expiry] else params[:max_age] = params[:expiry] end params.delete :expiry self.new params end # Compute the cookie search domains for a given request URI # This will be the effective host of the request uri, along with any # possibly matching dot-prefixed domains # # @param request_uri [String, URI] address being requested # @return [Array<String>] String domain matches def self.compute_search_domains request_uri CookieValidation.compute_search_domains request_uri end protected # Call {from_set_cookie} to create a new Cookie instance def initialize args @created_at, @name, @value, @domain, @path, @secure, @http_only, @version, @comment, @comment_url, @discard, @ports \ = args.values_at \ :created_at, :name, :value, :domain, :path, :secure, :http_only, :version, :comment, :comment_url, :discard, :ports @created_at ||= Time.now @expiry = args[:max_age] || args[:expires_at] @secure ||= false @http_only ||= false @discard ||= false if @ports.is_a? Integer @ports = [@ports] end end end end
36.318182
80
0.654673
38b489d7b4153d4c43ec00da0b649b55bc2a4e5a
210
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :username t.string :password_digest t.string :name t.integer :role_id end end end
19.090909
43
0.657143
bbd4d5dd9bcecb1f8a35a8ce28ab1b525ced64f5
243
# Author:: Nacer Laradji (<[email protected]>) # Cookbook Name:: zabbix-test # Recipe:: server_source # # Copyright 2011, Efactures # # Apache 2.0 node.normal['zabbix']['server']['install'] = true include_recipe "zabbix::server_source"
22.090909
52
0.720165
87852228489bb9f3dbebbfd0d82b8f1c5c77a8cc
136
class AddApplicationToDataset < ActiveRecord::Migration[5.2] def change add_column :datasets, :application_id, :integer end end
22.666667
60
0.772059
bbca91ad115eb9adf004602a55b376f07923ffb0
281
class NotImplentedError < StandardError def initialize(msg="Must be implemented in subclass") super end end module HerokuJobGovernator module Interfaces class Interface def self.enqueued_jobs(_queue) raise NotImplentedError end end end end
17.5625
55
0.725979
268301da1447e96b77739ed8d7cd0370b424d57f
1,624
module Shawarma # # Represents the context passed to the AWS Lambda function. This object # provides details about the execution state and environment of the Lambda # function. # class Context # This is the same ID returned to the client that called invoke(). This ID # is reused for retries on the same request. # # @return [String] AWS request ID associated with the request def request_id; end # @return [String, nil] name of CloudWatch log group container is configured to log to def log_group_name; end # @return [String, nil] name of CloudWatch log stream container is configured to log to def log_stream_name; end # @return [String] name of the function being executed def function_name; end # @return [String] version of the function being executed def function_version; end # @return [String] function Arn of the resource being invoked def invoked_function_arn; end # Provides information about the Amazon Cognito identity provider when # invoked through the AWS Mobile SDK. # # @return [CognitoIdentity, nil] def identity; end # Provides information about the client application and device when # invoked through the AWS Mobile SDK. # # @return [ClientContext, nil] def client_context; end # @return [Fixnum] time remaining for this execution in milliseconds def remaining_time; end # @return [Fixnum] memory size configured for the Lambda function in megabytes def memory_limit; end # @return [LambdaLogger] logger instance for this context def logger; end end end
31.843137
91
0.714901
2809f2b2e35fb39dd80c23e87568fecd4db6b511
174
# desc "Explaining what the task does" # task :whitelist do # # Task goes here # end # desc "Explaining what the task does" # task :blacklist do # # Task goes here # end
19.333333
38
0.678161
e97a677cb1077f6bd80ae6608ba4437dcc821ec2
22
module ParksHelper end
11
18
0.909091
ac985b7425e19a186a164b0df278726d91217f1e
9,957
# Unlight # Copyright(c)2019 CPA # This software is released under the MIT License. # http://opensource.org/licenses/mit-license.php require 'digest/md5' module Unlight # 渦クラス class Profound < Sequel::Model # プラグインの設定 plugin :schema plugin :validation_class_methods plugin :hook_class_methods # 他クラスのアソシエーション many_to_one :p_data, class: Unlight::ProfoundData, key: :data_id # 複数のクエストデータを保持 # スキーマの設定 set_schema do primary_key :id integer :data_id # 渦データのID String :profound_hash, index: true # 渦のハッシュコード datetime :close_at # 渦の消滅予定時間 integer :state # 状態 integer :map_id, dafault: 0 # 配置マップID integer :pos_idx # 配置インデックス integer :copy_type, default: PRF_COPY_TYPE_OWNER # コピータイプ Boolean :set_defeat_reward, default: true # 撃破報酬設定 integer :found_avatar_id # 発見者アバターID integer :defeat_avatar_id, dafault: 0 # 撃破者アバターID datetime :finish_at, dafault: nil # 渦の撃破時間 integer :server_type, default: 0 # tinyint(DB側で変更) 新規追加 2016/11/24 datetime :created_at datetime :updated_at end # DBにテーブルをつくる if !(Profound.table_exists?) Profound.create_table end # インサート時の前処理 before_create do self.created_at = Time.now.utc end # インサートとアップデート時の前処理 before_save do self.updated_at = Time.now.utc end # テーブルを変更する(履歴を残せ) DB.alter_table :profounds do add_column :copy_type, :integer, default: PRF_COPY_TYPE_OWNER unless Unlight::Profound.columns.include?(:copy_type) # 新規追加 2014/09/02 add_column :set_defeat_reward, :Boolean, default: PRF_COPY_TYPE_OWNER unless Unlight::Profound.columns.include?(:set_defeat_reward) # 新規追加 2015/05/26 add_column :map_id, :integer, default: PRF_MAP_ID_MAX unless Unlight::Profound.columns.include?(:map_id) # 新規追加 2016/06/03 add_column :found_avatar_id, :integer, default: 0 unless Unlight::Profound.columns.include?(:found_avatar_id) # 新規追加 2016/08/02 add_column :defeat_avatar_id, :integer, default: 0 unless Unlight::Profound.columns.include?(:defeat_avatar_id) # 新規追加 2016/08/04 add_column :finish_at, :datetime, default: nil unless Unlight::Profound.columns.include?(:finish_at) # 新規追加 2016/08/23 add_column :server_type, :integer, default: 0 unless Unlight::Profound.columns.include?(:server_type) # 新規追加 2016/11/24 end # 現在戦闘中の渦を全て取得 def Profound::get_playing_prf(server_type) now = Time.now.utc Profound.filter([[:state, [PRF_ST_UNKNOWN, PRF_ST_BATTLE]], [:server_type, server_type]]).filter { close_at > now }.all end def self::make_profound_hash Digest::MD5.hexdigest("#{Time.now}profound#{rand(1024)}")[0..10] end def self::get_new_profound_for_map(found_avatar_id, map_id, server_type, pow = 0, type = PRF_TYPE_NORMAL) r = get_realty(pow) q = search_profound({ quest_map_id: map_id, prf_type: type, rarity: r }, r) data = q[rand(q.count)] if q if data ret = Profound.new do |pr| pr.data_id = data.id pr.profound_hash = make_profound_hash pr.close_at = Time.now.utc + data.ttl.to_f * 60 * 60 pr.state = PRF_ST_UNKNOWN pr.map_id = rand(PRF_MAP_ID_MAX) pr.pos_idx = rand(PRF_POS_IDX_MAX) pr.copy_type = PRF_COPY_TYPE_OWNER pr.found_avatar_id = found_avatar_id pr.server_type = server_type pr.save_changes # 状態異常を作成 pr.set_boss_buff() end end ret end def self::get_new_profound_for_group(found_avatar_id, group_id, server_type, pow = 0, type = PRF_TYPE_NORMAL) r = get_realty(pow) q = search_profound({ group_id: group_id, prf_type: type, rarity: r }, r) data = q[rand(q.count)] if q if data ret = Profound.new do |pr| pr.data_id = data.id pr.profound_hash = make_profound_hash pr.close_at = Time.now.utc + data.ttl.to_f * 60 * 60 pr.state = PRF_ST_UNKNOWN pr.map_id = rand(PRF_MAP_ID_MAX) pr.pos_idx = rand(PRF_POS_IDX_MAX) pr.copy_type = PRF_COPY_TYPE_OWNER pr.found_avatar_id = found_avatar_id pr.server_type = server_type pr.save_changes # 状態異常を作成 pr.set_boss_buff() end end ret end def self::search_profound(cond, rarity) r = rarity s = 0 until s > 0 cond[:rarity] = r q = ProfoundData.filter(cond).all s = q.count if q r -= 1 break if r == 0 end if q.size <= 0 r = 10 until s > 0 cond[:rarity] = r q = ProfoundData.filter(cond).all s = q.count if q r -= 1 break if r == 0 end end q end def self::get_profound_for_hash(hash) ret = nil list = Profound.filter({ profound_hash: hash }).all ret = list.first if list ret end # レアリティを決定する def self::get_realty(pow = 0) r = rand(MAP_REALITY_NUM) ret = 1 if MAP_REALITY[pow] MAP_REALITY[pow].each_index do |i| if MAP_REALITY[pow][i] > r ret = i + 1 else break end end end ret end # Battle状態に変更 def battle if self.state == PRF_ST_UNKNOWN self.state = PRF_ST_BATTLE self.save_changes end end # 終了状態に変更 def finish if self.state != PRF_ST_VANISH self.state = PRF_ST_FINISH self.finish_at = Time.now.utc self.save_changes end end # 撃破しているか def is_finished?(r = true) refresh if r ret = false ret = true if is_vanished? ret = true if self.state == PRF_ST_FINISH now = Time.now.utc ret = true if self.finish_at && self.finish_at <= now ret end # 消滅しているか def is_vanished?(lt = 0) ret = (self.state == PRF_ST_VANISH || self.state == PRF_ST_VAN_DEFEAT) if !ret && self.close_at if Time.now.utc > (self.close_at + lt) # 今消滅を確認したので、Stateを変更 self.vanish_profound ret = true end end ret end # 渦の消滅 def vanish_profound if self.state != PRF_ST_VANISH && self.state != PRF_ST_VAN_DEFEAT self.state = (self.state == PRF_ST_FINISH) ? PRF_ST_VAN_DEFEAT : PRF_ST_VANISH self.save_changes # 状態異常を削除 self.set_boss_buff(0, 0, 0, true) end end # 撃破判定 def is_defeat?(r = true) refresh if r (self.state == PRF_ST_FINISH || self.state == PRF_ST_VAN_DEFEAT) end # 撃破後時間の設定 def set_losstime if self.state == PRF_ST_FINISH self.close_at = Time.now.utc + PRF_LOSSTIME_TTL self.save_changes end end # 撃破者のアバターIDをセット def set_defeat_avatar_id(avatar_id) self.defeat_avatar_id = avatar_id self.save_changes end # パラメータ表示開始damage def param_view_start_damage max_hp = self.p_data.get_boss_max_hp ret = 0 if max_hp > 0 ret = (max_hp / PRF_BOSS_NAME_VIEW_START_HP_VAL).ceil end ret end # 報酬リストを取得する def get_treasure_list ret = [] prf_data = self.p_data if prf_data ret = ProfoundTreasureData::get_level_treasure_list(prf_data.treasure_level) end ret end # 状態異常を取得 def get_boss_buff CACHE.get("prf_#{self.id}_buffs") end # 状態異常を保存 def set_boss_buff(id = 0, value = 0, turn = 0, reset = false) # rubocop:disable Metrics/ParameterLists buffs = CACHE.get("prf_#{self.id}_buffs") set_time = self.p_data.ttl.to_f * 60 * 60 if reset # 新規作成 buffs = nil set_time = 1 else buffs = {} unless buffs # 保存 limitはturn*1分 now = Time.now.utc buffs[id] = { value: value, turn: turn, limit: Time.now.utc + turn * 60 } if id != 0 end CACHE.set("prf_#{self.id}_buffs", buffs, set_time) (!reset) ? [id, buffs[id]] : nil end # 状態異常を削除 def unset_boss_buff(id = 0, value = 0) buffs = CACHE.get("prf_#{self.id}_buffs") unless buffs buffs = {} else ret = {} buffs.each do |b_id, v| if id != b_id || value != v[:value] ret[b_id] = { value: v[:value], turn: v[:turn], limit: v[:limit] } end end end CACHE.set("prf_#{self.id}_buffs", ret, self.p_data.ttl.to_f * 60 * 60) end # 状態異常を全て削除 def reset_boss_buff buffs = {} CACHE.set("prf_#{self.id}_buffs", buffs, self.p_data.ttl.to_f * 60 * 60) end # 状態異常を更新(ターン経過で終了) def update_boss_buff(id = 0, value = 0, turn = 0) buffs = CACHE.get("prf_#{self.id}_buffs") unless buffs buffs = {} else ret = {} buffs.each do |b_id, v| if id == b_id && value == v[:value] if v[:turn] - 1 > 0 turn = v[:turn] - 1 ret[b_id] = { value: v[:value], turn: turn } end else ret[b_id] = { value: v[:value], turn: v[:turn] } end end end CACHE.set("prf_#{self.id}_buffs", ret, self.p_data.ttl.to_f * 60 * 60) end # 時間判定を行わない状態異常か def check_non_limit_buff(buff_id) ret = false case buff_id when CharaCardEvent::STATE_STIGMATA, CharaCardEvent::STATE_CURSE, CharaCardEvent::STATE_TARGET ret = true else ret = false end ret end # 渦のコピータイプを変更 def change_copy_type(t) self.copy_type = t self.save_changes end # 渦の撃破報酬の有無を変更 def change_set_defeat_reward(f) self.set_defeat_reward = f self.save_changes end end end
28.530086
155
0.591343
61d3e32345e50cb1fd8bac48911712befe1777aa
39,090
# Copyright 2015 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'date' require 'google/apis/core/base_service' require 'google/apis/core/json_representation' require 'google/apis/core/hashable' require 'google/apis/errors' module Google module Apis module ServiceuserV1 class Api class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class AuthProvider class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class AuthRequirement class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Authentication class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class AuthenticationRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class AuthorizationConfig class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Backend class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class BackendRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Billing class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class BillingDestination class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Context class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class ContextRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Control class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class CustomError class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class CustomErrorRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class CustomHttpPattern class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class DisableServiceRequest class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Documentation class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class DocumentationRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class EnableServiceRequest class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Endpoint class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Enum class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class EnumValue class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Experimental class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Field class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Http class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class HttpRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class LabelDescriptor class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class ListEnabledServicesResponse class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class LogDescriptor class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Logging class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class LoggingDestination class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class MethodProp class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class MetricDescriptor class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class MetricDescriptorMetadata class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class MetricRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Mixin class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class MonitoredResourceDescriptor class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Monitoring class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class MonitoringDestination class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class OAuthRequirements class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Operation class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class OperationMetadata class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Option class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Page class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class PublishedService class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Quota class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class QuotaLimit class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class SearchServicesResponse class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Service class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class SourceContext class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class SourceInfo class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Status class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Step class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class SystemParameter class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class SystemParameterRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class SystemParameters class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Type class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Usage class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class UsageRule class Representation < Google::Apis::Core::JsonRepresentation; end include Google::Apis::Core::JsonObjectSupport end class Api # @private class Representation < Google::Apis::Core::JsonRepresentation collection :methods_prop, as: 'methods', class: Google::Apis::ServiceuserV1::MethodProp, decorator: Google::Apis::ServiceuserV1::MethodProp::Representation collection :mixins, as: 'mixins', class: Google::Apis::ServiceuserV1::Mixin, decorator: Google::Apis::ServiceuserV1::Mixin::Representation property :name, as: 'name' collection :options, as: 'options', class: Google::Apis::ServiceuserV1::Option, decorator: Google::Apis::ServiceuserV1::Option::Representation property :source_context, as: 'sourceContext', class: Google::Apis::ServiceuserV1::SourceContext, decorator: Google::Apis::ServiceuserV1::SourceContext::Representation property :syntax, as: 'syntax' property :version, as: 'version' end end class AuthProvider # @private class Representation < Google::Apis::Core::JsonRepresentation property :audiences, as: 'audiences' property :authorization_url, as: 'authorizationUrl' property :id, as: 'id' property :issuer, as: 'issuer' property :jwks_uri, as: 'jwksUri' end end class AuthRequirement # @private class Representation < Google::Apis::Core::JsonRepresentation property :audiences, as: 'audiences' property :provider_id, as: 'providerId' end end class Authentication # @private class Representation < Google::Apis::Core::JsonRepresentation collection :providers, as: 'providers', class: Google::Apis::ServiceuserV1::AuthProvider, decorator: Google::Apis::ServiceuserV1::AuthProvider::Representation collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::AuthenticationRule, decorator: Google::Apis::ServiceuserV1::AuthenticationRule::Representation end end class AuthenticationRule # @private class Representation < Google::Apis::Core::JsonRepresentation property :allow_without_credential, as: 'allowWithoutCredential' property :oauth, as: 'oauth', class: Google::Apis::ServiceuserV1::OAuthRequirements, decorator: Google::Apis::ServiceuserV1::OAuthRequirements::Representation collection :requirements, as: 'requirements', class: Google::Apis::ServiceuserV1::AuthRequirement, decorator: Google::Apis::ServiceuserV1::AuthRequirement::Representation property :selector, as: 'selector' end end class AuthorizationConfig # @private class Representation < Google::Apis::Core::JsonRepresentation property :provider, as: 'provider' end end class Backend # @private class Representation < Google::Apis::Core::JsonRepresentation collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::BackendRule, decorator: Google::Apis::ServiceuserV1::BackendRule::Representation end end class BackendRule # @private class Representation < Google::Apis::Core::JsonRepresentation property :address, as: 'address' property :deadline, as: 'deadline' property :min_deadline, as: 'minDeadline' property :selector, as: 'selector' end end class Billing # @private class Representation < Google::Apis::Core::JsonRepresentation collection :consumer_destinations, as: 'consumerDestinations', class: Google::Apis::ServiceuserV1::BillingDestination, decorator: Google::Apis::ServiceuserV1::BillingDestination::Representation end end class BillingDestination # @private class Representation < Google::Apis::Core::JsonRepresentation collection :metrics, as: 'metrics' property :monitored_resource, as: 'monitoredResource' end end class Context # @private class Representation < Google::Apis::Core::JsonRepresentation collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::ContextRule, decorator: Google::Apis::ServiceuserV1::ContextRule::Representation end end class ContextRule # @private class Representation < Google::Apis::Core::JsonRepresentation collection :allowed_request_extensions, as: 'allowedRequestExtensions' collection :allowed_response_extensions, as: 'allowedResponseExtensions' collection :provided, as: 'provided' collection :requested, as: 'requested' property :selector, as: 'selector' end end class Control # @private class Representation < Google::Apis::Core::JsonRepresentation property :environment, as: 'environment' end end class CustomError # @private class Representation < Google::Apis::Core::JsonRepresentation collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::CustomErrorRule, decorator: Google::Apis::ServiceuserV1::CustomErrorRule::Representation collection :types, as: 'types' end end class CustomErrorRule # @private class Representation < Google::Apis::Core::JsonRepresentation property :is_error_type, as: 'isErrorType' property :selector, as: 'selector' end end class CustomHttpPattern # @private class Representation < Google::Apis::Core::JsonRepresentation property :kind, as: 'kind' property :path, as: 'path' end end class DisableServiceRequest # @private class Representation < Google::Apis::Core::JsonRepresentation end end class Documentation # @private class Representation < Google::Apis::Core::JsonRepresentation property :documentation_root_url, as: 'documentationRootUrl' property :overview, as: 'overview' collection :pages, as: 'pages', class: Google::Apis::ServiceuserV1::Page, decorator: Google::Apis::ServiceuserV1::Page::Representation collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::DocumentationRule, decorator: Google::Apis::ServiceuserV1::DocumentationRule::Representation property :summary, as: 'summary' end end class DocumentationRule # @private class Representation < Google::Apis::Core::JsonRepresentation property :deprecation_description, as: 'deprecationDescription' property :description, as: 'description' property :selector, as: 'selector' end end class EnableServiceRequest # @private class Representation < Google::Apis::Core::JsonRepresentation end end class Endpoint # @private class Representation < Google::Apis::Core::JsonRepresentation collection :aliases, as: 'aliases' property :allow_cors, as: 'allowCors' collection :features, as: 'features' property :name, as: 'name' property :target, as: 'target' end end class Enum # @private class Representation < Google::Apis::Core::JsonRepresentation collection :enumvalue, as: 'enumvalue', class: Google::Apis::ServiceuserV1::EnumValue, decorator: Google::Apis::ServiceuserV1::EnumValue::Representation property :name, as: 'name' collection :options, as: 'options', class: Google::Apis::ServiceuserV1::Option, decorator: Google::Apis::ServiceuserV1::Option::Representation property :source_context, as: 'sourceContext', class: Google::Apis::ServiceuserV1::SourceContext, decorator: Google::Apis::ServiceuserV1::SourceContext::Representation property :syntax, as: 'syntax' end end class EnumValue # @private class Representation < Google::Apis::Core::JsonRepresentation property :name, as: 'name' property :number, as: 'number' collection :options, as: 'options', class: Google::Apis::ServiceuserV1::Option, decorator: Google::Apis::ServiceuserV1::Option::Representation end end class Experimental # @private class Representation < Google::Apis::Core::JsonRepresentation property :authorization, as: 'authorization', class: Google::Apis::ServiceuserV1::AuthorizationConfig, decorator: Google::Apis::ServiceuserV1::AuthorizationConfig::Representation end end class Field # @private class Representation < Google::Apis::Core::JsonRepresentation property :cardinality, as: 'cardinality' property :default_value, as: 'defaultValue' property :json_name, as: 'jsonName' property :kind, as: 'kind' property :name, as: 'name' property :number, as: 'number' property :oneof_index, as: 'oneofIndex' collection :options, as: 'options', class: Google::Apis::ServiceuserV1::Option, decorator: Google::Apis::ServiceuserV1::Option::Representation property :packed, as: 'packed' property :type_url, as: 'typeUrl' end end class Http # @private class Representation < Google::Apis::Core::JsonRepresentation property :fully_decode_reserved_expansion, as: 'fullyDecodeReservedExpansion' collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::HttpRule, decorator: Google::Apis::ServiceuserV1::HttpRule::Representation end end class HttpRule # @private class Representation < Google::Apis::Core::JsonRepresentation collection :additional_bindings, as: 'additionalBindings', class: Google::Apis::ServiceuserV1::HttpRule, decorator: Google::Apis::ServiceuserV1::HttpRule::Representation property :body, as: 'body' property :custom, as: 'custom', class: Google::Apis::ServiceuserV1::CustomHttpPattern, decorator: Google::Apis::ServiceuserV1::CustomHttpPattern::Representation property :delete, as: 'delete' property :get, as: 'get' property :patch, as: 'patch' property :post, as: 'post' property :put, as: 'put' property :response_body, as: 'responseBody' property :selector, as: 'selector' end end class LabelDescriptor # @private class Representation < Google::Apis::Core::JsonRepresentation property :description, as: 'description' property :key, as: 'key' property :value_type, as: 'valueType' end end class ListEnabledServicesResponse # @private class Representation < Google::Apis::Core::JsonRepresentation property :next_page_token, as: 'nextPageToken' collection :services, as: 'services', class: Google::Apis::ServiceuserV1::PublishedService, decorator: Google::Apis::ServiceuserV1::PublishedService::Representation end end class LogDescriptor # @private class Representation < Google::Apis::Core::JsonRepresentation property :description, as: 'description' property :display_name, as: 'displayName' collection :labels, as: 'labels', class: Google::Apis::ServiceuserV1::LabelDescriptor, decorator: Google::Apis::ServiceuserV1::LabelDescriptor::Representation property :name, as: 'name' end end class Logging # @private class Representation < Google::Apis::Core::JsonRepresentation collection :consumer_destinations, as: 'consumerDestinations', class: Google::Apis::ServiceuserV1::LoggingDestination, decorator: Google::Apis::ServiceuserV1::LoggingDestination::Representation collection :producer_destinations, as: 'producerDestinations', class: Google::Apis::ServiceuserV1::LoggingDestination, decorator: Google::Apis::ServiceuserV1::LoggingDestination::Representation end end class LoggingDestination # @private class Representation < Google::Apis::Core::JsonRepresentation collection :logs, as: 'logs' property :monitored_resource, as: 'monitoredResource' end end class MethodProp # @private class Representation < Google::Apis::Core::JsonRepresentation property :name, as: 'name' collection :options, as: 'options', class: Google::Apis::ServiceuserV1::Option, decorator: Google::Apis::ServiceuserV1::Option::Representation property :request_streaming, as: 'requestStreaming' property :request_type_url, as: 'requestTypeUrl' property :response_streaming, as: 'responseStreaming' property :response_type_url, as: 'responseTypeUrl' property :syntax, as: 'syntax' end end class MetricDescriptor # @private class Representation < Google::Apis::Core::JsonRepresentation property :description, as: 'description' property :display_name, as: 'displayName' collection :labels, as: 'labels', class: Google::Apis::ServiceuserV1::LabelDescriptor, decorator: Google::Apis::ServiceuserV1::LabelDescriptor::Representation property :metadata, as: 'metadata', class: Google::Apis::ServiceuserV1::MetricDescriptorMetadata, decorator: Google::Apis::ServiceuserV1::MetricDescriptorMetadata::Representation property :metric_kind, as: 'metricKind' property :name, as: 'name' property :type, as: 'type' property :unit, as: 'unit' property :value_type, as: 'valueType' end end class MetricDescriptorMetadata # @private class Representation < Google::Apis::Core::JsonRepresentation property :ingest_delay, as: 'ingestDelay' property :launch_stage, as: 'launchStage' property :sample_period, as: 'samplePeriod' end end class MetricRule # @private class Representation < Google::Apis::Core::JsonRepresentation hash :metric_costs, as: 'metricCosts' property :selector, as: 'selector' end end class Mixin # @private class Representation < Google::Apis::Core::JsonRepresentation property :name, as: 'name' property :root, as: 'root' end end class MonitoredResourceDescriptor # @private class Representation < Google::Apis::Core::JsonRepresentation property :description, as: 'description' property :display_name, as: 'displayName' collection :labels, as: 'labels', class: Google::Apis::ServiceuserV1::LabelDescriptor, decorator: Google::Apis::ServiceuserV1::LabelDescriptor::Representation property :name, as: 'name' property :type, as: 'type' end end class Monitoring # @private class Representation < Google::Apis::Core::JsonRepresentation collection :consumer_destinations, as: 'consumerDestinations', class: Google::Apis::ServiceuserV1::MonitoringDestination, decorator: Google::Apis::ServiceuserV1::MonitoringDestination::Representation collection :producer_destinations, as: 'producerDestinations', class: Google::Apis::ServiceuserV1::MonitoringDestination, decorator: Google::Apis::ServiceuserV1::MonitoringDestination::Representation end end class MonitoringDestination # @private class Representation < Google::Apis::Core::JsonRepresentation collection :metrics, as: 'metrics' property :monitored_resource, as: 'monitoredResource' end end class OAuthRequirements # @private class Representation < Google::Apis::Core::JsonRepresentation property :canonical_scopes, as: 'canonicalScopes' end end class Operation # @private class Representation < Google::Apis::Core::JsonRepresentation property :done, as: 'done' property :error, as: 'error', class: Google::Apis::ServiceuserV1::Status, decorator: Google::Apis::ServiceuserV1::Status::Representation hash :metadata, as: 'metadata' property :name, as: 'name' hash :response, as: 'response' end end class OperationMetadata # @private class Representation < Google::Apis::Core::JsonRepresentation property :progress_percentage, as: 'progressPercentage' collection :resource_names, as: 'resourceNames' property :start_time, as: 'startTime' collection :steps, as: 'steps', class: Google::Apis::ServiceuserV1::Step, decorator: Google::Apis::ServiceuserV1::Step::Representation end end class Option # @private class Representation < Google::Apis::Core::JsonRepresentation property :name, as: 'name' hash :value, as: 'value' end end class Page # @private class Representation < Google::Apis::Core::JsonRepresentation property :content, as: 'content' property :name, as: 'name' collection :subpages, as: 'subpages', class: Google::Apis::ServiceuserV1::Page, decorator: Google::Apis::ServiceuserV1::Page::Representation end end class PublishedService # @private class Representation < Google::Apis::Core::JsonRepresentation property :name, as: 'name' property :service, as: 'service', class: Google::Apis::ServiceuserV1::Service, decorator: Google::Apis::ServiceuserV1::Service::Representation end end class Quota # @private class Representation < Google::Apis::Core::JsonRepresentation collection :limits, as: 'limits', class: Google::Apis::ServiceuserV1::QuotaLimit, decorator: Google::Apis::ServiceuserV1::QuotaLimit::Representation collection :metric_rules, as: 'metricRules', class: Google::Apis::ServiceuserV1::MetricRule, decorator: Google::Apis::ServiceuserV1::MetricRule::Representation end end class QuotaLimit # @private class Representation < Google::Apis::Core::JsonRepresentation property :default_limit, :numeric_string => true, as: 'defaultLimit' property :description, as: 'description' property :display_name, as: 'displayName' property :duration, as: 'duration' property :free_tier, :numeric_string => true, as: 'freeTier' property :max_limit, :numeric_string => true, as: 'maxLimit' property :metric, as: 'metric' property :name, as: 'name' property :unit, as: 'unit' hash :values, as: 'values' end end class SearchServicesResponse # @private class Representation < Google::Apis::Core::JsonRepresentation property :next_page_token, as: 'nextPageToken' collection :services, as: 'services', class: Google::Apis::ServiceuserV1::PublishedService, decorator: Google::Apis::ServiceuserV1::PublishedService::Representation end end class Service # @private class Representation < Google::Apis::Core::JsonRepresentation collection :apis, as: 'apis', class: Google::Apis::ServiceuserV1::Api, decorator: Google::Apis::ServiceuserV1::Api::Representation property :authentication, as: 'authentication', class: Google::Apis::ServiceuserV1::Authentication, decorator: Google::Apis::ServiceuserV1::Authentication::Representation property :backend, as: 'backend', class: Google::Apis::ServiceuserV1::Backend, decorator: Google::Apis::ServiceuserV1::Backend::Representation property :billing, as: 'billing', class: Google::Apis::ServiceuserV1::Billing, decorator: Google::Apis::ServiceuserV1::Billing::Representation property :config_version, as: 'configVersion' property :context, as: 'context', class: Google::Apis::ServiceuserV1::Context, decorator: Google::Apis::ServiceuserV1::Context::Representation property :control, as: 'control', class: Google::Apis::ServiceuserV1::Control, decorator: Google::Apis::ServiceuserV1::Control::Representation property :custom_error, as: 'customError', class: Google::Apis::ServiceuserV1::CustomError, decorator: Google::Apis::ServiceuserV1::CustomError::Representation property :documentation, as: 'documentation', class: Google::Apis::ServiceuserV1::Documentation, decorator: Google::Apis::ServiceuserV1::Documentation::Representation collection :endpoints, as: 'endpoints', class: Google::Apis::ServiceuserV1::Endpoint, decorator: Google::Apis::ServiceuserV1::Endpoint::Representation collection :enums, as: 'enums', class: Google::Apis::ServiceuserV1::Enum, decorator: Google::Apis::ServiceuserV1::Enum::Representation property :experimental, as: 'experimental', class: Google::Apis::ServiceuserV1::Experimental, decorator: Google::Apis::ServiceuserV1::Experimental::Representation property :http, as: 'http', class: Google::Apis::ServiceuserV1::Http, decorator: Google::Apis::ServiceuserV1::Http::Representation property :id, as: 'id' property :logging, as: 'logging', class: Google::Apis::ServiceuserV1::Logging, decorator: Google::Apis::ServiceuserV1::Logging::Representation collection :logs, as: 'logs', class: Google::Apis::ServiceuserV1::LogDescriptor, decorator: Google::Apis::ServiceuserV1::LogDescriptor::Representation collection :metrics, as: 'metrics', class: Google::Apis::ServiceuserV1::MetricDescriptor, decorator: Google::Apis::ServiceuserV1::MetricDescriptor::Representation collection :monitored_resources, as: 'monitoredResources', class: Google::Apis::ServiceuserV1::MonitoredResourceDescriptor, decorator: Google::Apis::ServiceuserV1::MonitoredResourceDescriptor::Representation property :monitoring, as: 'monitoring', class: Google::Apis::ServiceuserV1::Monitoring, decorator: Google::Apis::ServiceuserV1::Monitoring::Representation property :name, as: 'name' property :producer_project_id, as: 'producerProjectId' property :quota, as: 'quota', class: Google::Apis::ServiceuserV1::Quota, decorator: Google::Apis::ServiceuserV1::Quota::Representation property :source_info, as: 'sourceInfo', class: Google::Apis::ServiceuserV1::SourceInfo, decorator: Google::Apis::ServiceuserV1::SourceInfo::Representation property :system_parameters, as: 'systemParameters', class: Google::Apis::ServiceuserV1::SystemParameters, decorator: Google::Apis::ServiceuserV1::SystemParameters::Representation collection :system_types, as: 'systemTypes', class: Google::Apis::ServiceuserV1::Type, decorator: Google::Apis::ServiceuserV1::Type::Representation property :title, as: 'title' collection :types, as: 'types', class: Google::Apis::ServiceuserV1::Type, decorator: Google::Apis::ServiceuserV1::Type::Representation property :usage, as: 'usage', class: Google::Apis::ServiceuserV1::Usage, decorator: Google::Apis::ServiceuserV1::Usage::Representation end end class SourceContext # @private class Representation < Google::Apis::Core::JsonRepresentation property :file_name, as: 'fileName' end end class SourceInfo # @private class Representation < Google::Apis::Core::JsonRepresentation collection :source_files, as: 'sourceFiles' end end class Status # @private class Representation < Google::Apis::Core::JsonRepresentation property :code, as: 'code' collection :details, as: 'details' property :message, as: 'message' end end class Step # @private class Representation < Google::Apis::Core::JsonRepresentation property :description, as: 'description' property :status, as: 'status' end end class SystemParameter # @private class Representation < Google::Apis::Core::JsonRepresentation property :http_header, as: 'httpHeader' property :name, as: 'name' property :url_query_parameter, as: 'urlQueryParameter' end end class SystemParameterRule # @private class Representation < Google::Apis::Core::JsonRepresentation collection :parameters, as: 'parameters', class: Google::Apis::ServiceuserV1::SystemParameter, decorator: Google::Apis::ServiceuserV1::SystemParameter::Representation property :selector, as: 'selector' end end class SystemParameters # @private class Representation < Google::Apis::Core::JsonRepresentation collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::SystemParameterRule, decorator: Google::Apis::ServiceuserV1::SystemParameterRule::Representation end end class Type # @private class Representation < Google::Apis::Core::JsonRepresentation collection :fields, as: 'fields', class: Google::Apis::ServiceuserV1::Field, decorator: Google::Apis::ServiceuserV1::Field::Representation property :name, as: 'name' collection :oneofs, as: 'oneofs' collection :options, as: 'options', class: Google::Apis::ServiceuserV1::Option, decorator: Google::Apis::ServiceuserV1::Option::Representation property :source_context, as: 'sourceContext', class: Google::Apis::ServiceuserV1::SourceContext, decorator: Google::Apis::ServiceuserV1::SourceContext::Representation property :syntax, as: 'syntax' end end class Usage # @private class Representation < Google::Apis::Core::JsonRepresentation property :producer_notification_channel, as: 'producerNotificationChannel' collection :requirements, as: 'requirements' collection :rules, as: 'rules', class: Google::Apis::ServiceuserV1::UsageRule, decorator: Google::Apis::ServiceuserV1::UsageRule::Representation end end class UsageRule # @private class Representation < Google::Apis::Core::JsonRepresentation property :allow_unregistered_calls, as: 'allowUnregisteredCalls' property :selector, as: 'selector' property :skip_service_control, as: 'skipServiceControl' end end end end end
37.914646
217
0.642389
117b9ef2022aee701c211a90019c2d441e0a7b5f
424
# frozen_string_literal: true class Dictionary include Mongoid::Document field :name, type: String field :publisher, type: String field :year, type: Integer # This field must be a Time field :published, type: Time # This field must be a Date field :submitted_on, type: Date field :description, type: String, localize: true field :l, type: String, as: :language has_many :words, validate: false end
22.315789
50
0.71934
01b63cc6ef6eb4d051e8ede22b169589687ea9f8
37
module Didit VERSION = "0.1.0" end
9.25
19
0.648649
4ab24653a9adc3ae232f6c0a865945fa6492e734
148
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_accounts-airpair_session'
37
86
0.810811
e94917d28ca51fb72bbad099a23c95d13374786d
915
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "mores_marvel/version" Gem::Specification.new do |spec| spec.name = "mores_marvel" spec.version = MoresMarvel::VERSION spec.authors = ["Manoj more"] spec.email = ["[email protected]"] spec.summary = %q{Ruby gem for Marvel API} spec.description = %q{Use this to play arround with Marvel resources} spec.homepage = "https://github.com/ManojmoreS/mores_marvel" spec.license = "MIT" spec.files = Dir['{app,config,lib}/**/*'] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> 1.16" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.0" end
35.192308
74
0.650273
e887eeb3d4eecec69676d0cd4d94190e21641624
1,118
=begin #OpenAPI Petstore #This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.2.3-SNAPSHOT =end require 'spec_helper' require 'json' require 'date' # Unit tests for Petstore::InlineResponseDefault # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe 'InlineResponseDefault' do before do # run before each test @instance = Petstore::InlineResponseDefault.new end after do # run after each test end describe 'test an instance of InlineResponseDefault' do it 'should create an instance of InlineResponseDefault' do expect(@instance).to be_instance_of(Petstore::InlineResponseDefault) end end describe 'test attribute "string"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end
26.619048
157
0.752236
f79d18f27f1d98534d3f5b160f2b2efc8090a9e2
22,829
# -*- encoding: utf-8 -*- require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes.rb', __FILE__) describe "String#inspect" do it "taints the result if self is tainted" do "foo".taint.inspect.tainted?.should == true "foo\n".taint.inspect.tainted?.should == true end ruby_version_is "1.9" do it "untrusts the result if self is untrusted" do "foo".untrust.inspect.untrusted?.should == true "foo\n".untrust.inspect.untrusted?.should == true end end it "does not return a subclass instance" do StringSpecs::MyString.new.inspect.should be_an_instance_of(String) end it "returns a string with special characters replaced with \\<char> notation" do [ ["\a", '"\\a"'], ["\b", '"\\b"'], ["\t", '"\\t"'], ["\n", '"\\n"'], ["\v", '"\\v"'], ["\f", '"\\f"'], ["\r", '"\\r"'], ["\e", '"\\e"'] ].should be_computed_by(:inspect) end it "returns a string with \" and \\ escaped with a backslash" do [ ["\"", '"\\""'], ["\\", '"\\\\"'] ].should be_computed_by(:inspect) end it "returns a string with \\#<char> when # is followed by $, @, {" do [ ["\#$", '"\\#$"'], ["\#@", '"\\#@"'], ["\#{", '"\\#{"'] ].should be_computed_by(:inspect) end it "returns a string with # not escaped when followed by any other character" do [ ["#", '"#"'], ["#1", '"#1"'] ].should be_computed_by(:inspect) end it "returns a string with printable non-alphanumeric characters unescaped" do [ [" ", '" "'], ["!", '"!"'], ["$", '"$"'], ["%", '"%"'], ["&", '"&"'], ["'", '"\'"'], ["(", '"("'], [")", '")"'], ["*", '"*"'], ["+", '"+"'], [",", '","'], ["-", '"-"'], [".", '"."'], ["/", '"/"'], [":", '":"'], [";", '";"'], ["<", '"<"'], ["=", '"="'], [">", '">"'], ["?", '"?"'], ["@", '"@"'], ["[", '"["'], ["]", '"]"'], ["^", '"^"'], ["_", '"_"'], ["`", '"`"'], ["{", '"{"'], ["|", '"|"'], ["}", '"}"'], ["~", '"~"'] ].should be_computed_by(:inspect) end it "returns a string with numeric characters unescaped" do [ ["0", '"0"'], ["1", '"1"'], ["2", '"2"'], ["3", '"3"'], ["4", '"4"'], ["5", '"5"'], ["6", '"6"'], ["7", '"7"'], ["8", '"8"'], ["9", '"9"'], ].should be_computed_by(:inspect) end it "returns a string with upper-case alpha characters unescaped" do [ ["A", '"A"'], ["B", '"B"'], ["C", '"C"'], ["D", '"D"'], ["E", '"E"'], ["F", '"F"'], ["G", '"G"'], ["H", '"H"'], ["I", '"I"'], ["J", '"J"'], ["K", '"K"'], ["L", '"L"'], ["M", '"M"'], ["N", '"N"'], ["O", '"O"'], ["P", '"P"'], ["Q", '"Q"'], ["R", '"R"'], ["S", '"S"'], ["T", '"T"'], ["U", '"U"'], ["V", '"V"'], ["W", '"W"'], ["X", '"X"'], ["Y", '"Y"'], ["Z", '"Z"'] ].should be_computed_by(:inspect) end it "returns a string with lower-case alpha characters unescaped" do [ ["a", '"a"'], ["b", '"b"'], ["c", '"c"'], ["d", '"d"'], ["e", '"e"'], ["f", '"f"'], ["g", '"g"'], ["h", '"h"'], ["i", '"i"'], ["j", '"j"'], ["k", '"k"'], ["l", '"l"'], ["m", '"m"'], ["n", '"n"'], ["o", '"o"'], ["p", '"p"'], ["q", '"q"'], ["r", '"r"'], ["s", '"s"'], ["t", '"t"'], ["u", '"u"'], ["v", '"v"'], ["w", '"w"'], ["x", '"x"'], ["y", '"y"'], ["z", '"z"'] ].should be_computed_by(:inspect) end ruby_version_is ""..."1.9" do it "returns a string with non-printing characters replaced with \\0nn notation" do [ ["\000", '"\\000"'], ["\001", '"\\001"'], ["\002", '"\\002"'], ["\003", '"\\003"'], ["\004", '"\\004"'], ["\005", '"\\005"'], ["\006", '"\\006"'], ["\016", '"\\016"'], ["\017", '"\\017"'], ["\020", '"\\020"'], ["\021", '"\\021"'], ["\022", '"\\022"'], ["\023", '"\\023"'], ["\024", '"\\024"'], ["\025", '"\\025"'], ["\026", '"\\026"'], ["\027", '"\\027"'], ["\030", '"\\030"'], ["\031", '"\\031"'], ["\032", '"\\032"'], ["\034", '"\\034"'], ["\035", '"\\035"'], ["\036", '"\\036"'], ["\177", '"\\177"'], ["\200", '"\\200"'], ["\201", '"\\201"'], ["\202", '"\\202"'], ["\203", '"\\203"'], ["\204", '"\\204"'], ["\205", '"\\205"'], ["\206", '"\\206"'], ["\207", '"\\207"'], ["\210", '"\\210"'], ["\211", '"\\211"'], ["\212", '"\\212"'], ["\213", '"\\213"'], ["\214", '"\\214"'], ["\215", '"\\215"'], ["\216", '"\\216"'], ["\217", '"\\217"'], ["\220", '"\\220"'], ["\221", '"\\221"'], ["\222", '"\\222"'], ["\223", '"\\223"'], ["\224", '"\\224"'], ["\225", '"\\225"'], ["\226", '"\\226"'], ["\227", '"\\227"'], ["\230", '"\\230"'], ["\231", '"\\231"'], ["\232", '"\\232"'], ["\233", '"\\233"'], ["\234", '"\\234"'], ["\235", '"\\235"'], ["\236", '"\\236"'], ["\237", '"\\237"'], ["\240", '"\\240"'], ["\241", '"\\241"'], ["\242", '"\\242"'], ["\243", '"\\243"'], ["\244", '"\\244"'], ["\245", '"\\245"'], ["\246", '"\\246"'], ["\247", '"\\247"'], ["\250", '"\\250"'], ["\251", '"\\251"'], ["\252", '"\\252"'], ["\253", '"\\253"'], ["\254", '"\\254"'], ["\255", '"\\255"'], ["\256", '"\\256"'], ["\257", '"\\257"'], ["\260", '"\\260"'], ["\261", '"\\261"'], ["\262", '"\\262"'], ["\263", '"\\263"'], ["\264", '"\\264"'], ["\265", '"\\265"'], ["\266", '"\\266"'], ["\267", '"\\267"'], ["\270", '"\\270"'], ["\271", '"\\271"'], ["\272", '"\\272"'], ["\273", '"\\273"'], ["\274", '"\\274"'], ["\275", '"\\275"'], ["\276", '"\\276"'], ["\277", '"\\277"'], ["\300", '"\\300"'], ["\301", '"\\301"'], ["\302", '"\\302"'], ["\303", '"\\303"'], ["\304", '"\\304"'], ["\305", '"\\305"'], ["\306", '"\\306"'], ["\307", '"\\307"'], ["\310", '"\\310"'], ["\311", '"\\311"'], ["\312", '"\\312"'], ["\313", '"\\313"'], ["\314", '"\\314"'], ["\315", '"\\315"'], ["\316", '"\\316"'], ["\317", '"\\317"'], ["\320", '"\\320"'], ["\321", '"\\321"'], ["\322", '"\\322"'], ["\323", '"\\323"'], ["\324", '"\\324"'], ["\325", '"\\325"'], ["\326", '"\\326"'], ["\327", '"\\327"'], ["\330", '"\\330"'], ["\331", '"\\331"'], ["\332", '"\\332"'], ["\333", '"\\333"'], ["\334", '"\\334"'], ["\335", '"\\335"'], ["\336", '"\\336"'], ["\337", '"\\337"'], ["\340", '"\\340"'], ["\341", '"\\341"'], ["\342", '"\\342"'], ["\343", '"\\343"'], ["\344", '"\\344"'], ["\345", '"\\345"'], ["\346", '"\\346"'], ["\347", '"\\347"'], ["\350", '"\\350"'], ["\351", '"\\351"'], ["\352", '"\\352"'], ["\353", '"\\353"'], ["\354", '"\\354"'], ["\355", '"\\355"'], ["\356", '"\\356"'], ["\357", '"\\357"'], ["\360", '"\\360"'], ["\361", '"\\361"'], ["\362", '"\\362"'], ["\363", '"\\363"'], ["\364", '"\\364"'], ["\365", '"\\365"'], ["\366", '"\\366"'], ["\367", '"\\367"'], ["\370", '"\\370"'], ["\371", '"\\371"'], ["\372", '"\\372"'], ["\373", '"\\373"'], ["\374", '"\\374"'], ["\375", '"\\375"'], ["\376", '"\\376"'], ["\377", '"\\377"'] ].should be_computed_by(:inspect) end describe "with $KCODE == 'NONE'" do before :each do @kcode = $KCODE end after :each do $KCODE = @kcode end it "returns a string with bytes represented in stringified octal notation" do $KCODE = "NONE" "äöü".inspect.should == "\"\\303\\244\\303\\266\\303\\274\"" end end describe "with $KCODE == 'UTF-8'" do before :each do @kcode = $KCODE end after :each do $KCODE = @kcode end it "returns a string with extended character set" do $KCODE = "UTF-8" "äöü".inspect.should == "\"äöü\"" end it "returns malformed UTF-8 characters in stringified octal notation" do $KCODE = "UTF-8" "\007äöüz\303".inspect.should == "\"\\aäöüz\\303\"" end end end ruby_version_is "1.9" do it "returns a string with non-printing characters replaced by \\x notation" do # Avoid the file encoding by computing the string with #chr. [ [0001.chr, '"\\x01"'], [0002.chr, '"\\x02"'], [0003.chr, '"\\x03"'], [0004.chr, '"\\x04"'], [0005.chr, '"\\x05"'], [0006.chr, '"\\x06"'], [0016.chr, '"\\x0E"'], [0017.chr, '"\\x0F"'], [0020.chr, '"\\x10"'], [0021.chr, '"\\x11"'], [0022.chr, '"\\x12"'], [0023.chr, '"\\x13"'], [0024.chr, '"\\x14"'], [0025.chr, '"\\x15"'], [0026.chr, '"\\x16"'], [0027.chr, '"\\x17"'], [0030.chr, '"\\x18"'], [0031.chr, '"\\x19"'], [0032.chr, '"\\x1A"'], [0034.chr, '"\\x1C"'], [0035.chr, '"\\x1D"'], [0036.chr, '"\\x1E"'], [0037.chr, '"\\x1F"'], [0177.chr, '"\\x7F"'], [0200.chr, '"\\x80"'], [0201.chr, '"\\x81"'], [0202.chr, '"\\x82"'], [0203.chr, '"\\x83"'], [0204.chr, '"\\x84"'], [0205.chr, '"\\x85"'], [0206.chr, '"\\x86"'], [0207.chr, '"\\x87"'], [0210.chr, '"\\x88"'], [0211.chr, '"\\x89"'], [0212.chr, '"\\x8A"'], [0213.chr, '"\\x8B"'], [0214.chr, '"\\x8C"'], [0215.chr, '"\\x8D"'], [0216.chr, '"\\x8E"'], [0217.chr, '"\\x8F"'], [0220.chr, '"\\x90"'], [0221.chr, '"\\x91"'], [0222.chr, '"\\x92"'], [0223.chr, '"\\x93"'], [0224.chr, '"\\x94"'], [0225.chr, '"\\x95"'], [0226.chr, '"\\x96"'], [0227.chr, '"\\x97"'], [0230.chr, '"\\x98"'], [0231.chr, '"\\x99"'], [0232.chr, '"\\x9A"'], [0233.chr, '"\\x9B"'], [0234.chr, '"\\x9C"'], [0235.chr, '"\\x9D"'], [0236.chr, '"\\x9E"'], [0237.chr, '"\\x9F"'], [0240.chr, '"\\xA0"'], [0241.chr, '"\\xA1"'], [0242.chr, '"\\xA2"'], [0243.chr, '"\\xA3"'], [0244.chr, '"\\xA4"'], [0245.chr, '"\\xA5"'], [0246.chr, '"\\xA6"'], [0247.chr, '"\\xA7"'], [0250.chr, '"\\xA8"'], [0251.chr, '"\\xA9"'], [0252.chr, '"\\xAA"'], [0253.chr, '"\\xAB"'], [0254.chr, '"\\xAC"'], [0255.chr, '"\\xAD"'], [0256.chr, '"\\xAE"'], [0257.chr, '"\\xAF"'], [0260.chr, '"\\xB0"'], [0261.chr, '"\\xB1"'], [0262.chr, '"\\xB2"'], [0263.chr, '"\\xB3"'], [0264.chr, '"\\xB4"'], [0265.chr, '"\\xB5"'], [0266.chr, '"\\xB6"'], [0267.chr, '"\\xB7"'], [0270.chr, '"\\xB8"'], [0271.chr, '"\\xB9"'], [0272.chr, '"\\xBA"'], [0273.chr, '"\\xBB"'], [0274.chr, '"\\xBC"'], [0275.chr, '"\\xBD"'], [0276.chr, '"\\xBE"'], [0277.chr, '"\\xBF"'], [0300.chr, '"\\xC0"'], [0301.chr, '"\\xC1"'], [0302.chr, '"\\xC2"'], [0303.chr, '"\\xC3"'], [0304.chr, '"\\xC4"'], [0305.chr, '"\\xC5"'], [0306.chr, '"\\xC6"'], [0307.chr, '"\\xC7"'], [0310.chr, '"\\xC8"'], [0311.chr, '"\\xC9"'], [0312.chr, '"\\xCA"'], [0313.chr, '"\\xCB"'], [0314.chr, '"\\xCC"'], [0315.chr, '"\\xCD"'], [0316.chr, '"\\xCE"'], [0317.chr, '"\\xCF"'], [0320.chr, '"\\xD0"'], [0321.chr, '"\\xD1"'], [0322.chr, '"\\xD2"'], [0323.chr, '"\\xD3"'], [0324.chr, '"\\xD4"'], [0325.chr, '"\\xD5"'], [0326.chr, '"\\xD6"'], [0327.chr, '"\\xD7"'], [0330.chr, '"\\xD8"'], [0331.chr, '"\\xD9"'], [0332.chr, '"\\xDA"'], [0333.chr, '"\\xDB"'], [0334.chr, '"\\xDC"'], [0335.chr, '"\\xDD"'], [0336.chr, '"\\xDE"'], [0337.chr, '"\\xDF"'], [0340.chr, '"\\xE0"'], [0341.chr, '"\\xE1"'], [0342.chr, '"\\xE2"'], [0343.chr, '"\\xE3"'], [0344.chr, '"\\xE4"'], [0345.chr, '"\\xE5"'], [0346.chr, '"\\xE6"'], [0347.chr, '"\\xE7"'], [0350.chr, '"\\xE8"'], [0351.chr, '"\\xE9"'], [0352.chr, '"\\xEA"'], [0353.chr, '"\\xEB"'], [0354.chr, '"\\xEC"'], [0355.chr, '"\\xED"'], [0356.chr, '"\\xEE"'], [0357.chr, '"\\xEF"'], [0360.chr, '"\\xF0"'], [0361.chr, '"\\xF1"'], [0362.chr, '"\\xF2"'], [0363.chr, '"\\xF3"'], [0364.chr, '"\\xF4"'], [0365.chr, '"\\xF5"'], [0366.chr, '"\\xF6"'], [0367.chr, '"\\xF7"'], [0370.chr, '"\\xF8"'], [0371.chr, '"\\xF9"'], [0372.chr, '"\\xFA"'], [0373.chr, '"\\xFB"'], [0374.chr, '"\\xFC"'], [0375.chr, '"\\xFD"'], [0376.chr, '"\\xFE"'], [0377.chr, '"\\xFF"'] ].should be_computed_by(:inspect) end ruby_version_is "1.9".."2.0" do it "returns a string with a NUL character replaced by \\x notation" do 0.chr.inspect.should == '"\\x00"' end end ruby_version_is "2.1" do it "returns a string with a NUL character replaced by \\000" do 0.chr.inspect.should == '"\\000"' end end describe "when default external is UTF-8" do before :each do @extenc, Encoding.default_external = Encoding.default_external, Encoding::UTF_8 end after :each do Encoding.default_external = @extenc end it "returns a string with non-printing characters replaced by \\u notation for Unicode strings" do [ [0001.chr('utf-8'), '"\u0001"'], [0002.chr('utf-8'), '"\u0002"'], [0003.chr('utf-8'), '"\u0003"'], [0004.chr('utf-8'), '"\u0004"'], [0005.chr('utf-8'), '"\u0005"'], [0006.chr('utf-8'), '"\u0006"'], [0016.chr('utf-8'), '"\u000E"'], [0017.chr('utf-8'), '"\u000F"'], [0020.chr('utf-8'), '"\u0010"'], [0021.chr('utf-8'), '"\u0011"'], [0022.chr('utf-8'), '"\u0012"'], [0023.chr('utf-8'), '"\u0013"'], [0024.chr('utf-8'), '"\u0014"'], [0025.chr('utf-8'), '"\u0015"'], [0026.chr('utf-8'), '"\u0016"'], [0027.chr('utf-8'), '"\u0017"'], [0030.chr('utf-8'), '"\u0018"'], [0031.chr('utf-8'), '"\u0019"'], [0032.chr('utf-8'), '"\u001A"'], [0034.chr('utf-8'), '"\u001C"'], [0035.chr('utf-8'), '"\u001D"'], [0036.chr('utf-8'), '"\u001E"'], [0037.chr('utf-8'), '"\u001F"'], [0177.chr('utf-8'), '"\u007F"'], [0200.chr('utf-8'), '"\u0080"'], [0201.chr('utf-8'), '"\u0081"'], [0202.chr('utf-8'), '"\u0082"'], [0203.chr('utf-8'), '"\u0083"'], [0204.chr('utf-8'), '"\u0084"'], [0206.chr('utf-8'), '"\u0086"'], [0207.chr('utf-8'), '"\u0087"'], [0210.chr('utf-8'), '"\u0088"'], [0211.chr('utf-8'), '"\u0089"'], [0212.chr('utf-8'), '"\u008A"'], [0213.chr('utf-8'), '"\u008B"'], [0214.chr('utf-8'), '"\u008C"'], [0215.chr('utf-8'), '"\u008D"'], [0216.chr('utf-8'), '"\u008E"'], [0217.chr('utf-8'), '"\u008F"'], [0220.chr('utf-8'), '"\u0090"'], [0221.chr('utf-8'), '"\u0091"'], [0222.chr('utf-8'), '"\u0092"'], [0223.chr('utf-8'), '"\u0093"'], [0224.chr('utf-8'), '"\u0094"'], [0225.chr('utf-8'), '"\u0095"'], [0226.chr('utf-8'), '"\u0096"'], [0227.chr('utf-8'), '"\u0097"'], [0230.chr('utf-8'), '"\u0098"'], [0231.chr('utf-8'), '"\u0099"'], [0232.chr('utf-8'), '"\u009A"'], [0233.chr('utf-8'), '"\u009B"'], [0234.chr('utf-8'), '"\u009C"'], [0235.chr('utf-8'), '"\u009D"'], [0236.chr('utf-8'), '"\u009E"'], [0237.chr('utf-8'), '"\u009F"'], ].should be_computed_by(:inspect) end ruby_version_is "1.9".."2.0" do it "returns a string with a NUL character replaced by \\x notation" do 0.chr('utf-8').inspect.should == '"\\u0000"' end end ruby_version_is "2.1" do it "returns a string with a NUL character replaced by \\000" do 0.chr('utf-8').inspect.should == '"\\000"' end end it "returns a string with extended characters for Unicode strings" do [ [0240.chr('utf-8'), '" "'], [0241.chr('utf-8'), '"¡"'], [0242.chr('utf-8'), '"¢"'], [0243.chr('utf-8'), '"£"'], [0244.chr('utf-8'), '"¤"'], [0245.chr('utf-8'), '"¥"'], [0246.chr('utf-8'), '"¦"'], [0247.chr('utf-8'), '"§"'], [0250.chr('utf-8'), '"¨"'], [0251.chr('utf-8'), '"©"'], [0252.chr('utf-8'), '"ª"'], [0253.chr('utf-8'), '"«"'], [0254.chr('utf-8'), '"¬"'], [0255.chr('utf-8'), '"­"'], [0256.chr('utf-8'), '"®"'], [0257.chr('utf-8'), '"¯"'], [0260.chr('utf-8'), '"°"'], [0261.chr('utf-8'), '"±"'], [0262.chr('utf-8'), '"²"'], [0263.chr('utf-8'), '"³"'], [0264.chr('utf-8'), '"´"'], [0265.chr('utf-8'), '"µ"'], [0266.chr('utf-8'), '"¶"'], [0267.chr('utf-8'), '"·"'], [0270.chr('utf-8'), '"¸"'], [0271.chr('utf-8'), '"¹"'], [0272.chr('utf-8'), '"º"'], [0273.chr('utf-8'), '"»"'], [0274.chr('utf-8'), '"¼"'], [0275.chr('utf-8'), '"½"'], [0276.chr('utf-8'), '"¾"'], [0277.chr('utf-8'), '"¿"'], [0300.chr('utf-8'), '"À"'], [0301.chr('utf-8'), '"Á"'], [0302.chr('utf-8'), '"Â"'], [0303.chr('utf-8'), '"Ã"'], [0304.chr('utf-8'), '"Ä"'], [0305.chr('utf-8'), '"Å"'], [0306.chr('utf-8'), '"Æ"'], [0307.chr('utf-8'), '"Ç"'], [0310.chr('utf-8'), '"È"'], [0311.chr('utf-8'), '"É"'], [0312.chr('utf-8'), '"Ê"'], [0313.chr('utf-8'), '"Ë"'], [0314.chr('utf-8'), '"Ì"'], [0315.chr('utf-8'), '"Í"'], [0316.chr('utf-8'), '"Î"'], [0317.chr('utf-8'), '"Ï"'], [0320.chr('utf-8'), '"Ð"'], [0321.chr('utf-8'), '"Ñ"'], [0322.chr('utf-8'), '"Ò"'], [0323.chr('utf-8'), '"Ó"'], [0324.chr('utf-8'), '"Ô"'], [0325.chr('utf-8'), '"Õ"'], [0326.chr('utf-8'), '"Ö"'], [0327.chr('utf-8'), '"×"'], [0330.chr('utf-8'), '"Ø"'], [0331.chr('utf-8'), '"Ù"'], [0332.chr('utf-8'), '"Ú"'], [0333.chr('utf-8'), '"Û"'], [0334.chr('utf-8'), '"Ü"'], [0335.chr('utf-8'), '"Ý"'], [0336.chr('utf-8'), '"Þ"'], [0337.chr('utf-8'), '"ß"'], [0340.chr('utf-8'), '"à"'], [0341.chr('utf-8'), '"á"'], [0342.chr('utf-8'), '"â"'], [0343.chr('utf-8'), '"ã"'], [0344.chr('utf-8'), '"ä"'], [0345.chr('utf-8'), '"å"'], [0346.chr('utf-8'), '"æ"'], [0347.chr('utf-8'), '"ç"'], [0350.chr('utf-8'), '"è"'], [0351.chr('utf-8'), '"é"'], [0352.chr('utf-8'), '"ê"'], [0353.chr('utf-8'), '"ë"'], [0354.chr('utf-8'), '"ì"'], [0355.chr('utf-8'), '"í"'], [0356.chr('utf-8'), '"î"'], [0357.chr('utf-8'), '"ï"'], [0360.chr('utf-8'), '"ð"'], [0361.chr('utf-8'), '"ñ"'], [0362.chr('utf-8'), '"ò"'], [0363.chr('utf-8'), '"ó"'], [0364.chr('utf-8'), '"ô"'], [0365.chr('utf-8'), '"õ"'], [0366.chr('utf-8'), '"ö"'], [0367.chr('utf-8'), '"÷"'], [0370.chr('utf-8'), '"ø"'], [0371.chr('utf-8'), '"ù"'], [0372.chr('utf-8'), '"ú"'], [0373.chr('utf-8'), '"û"'], [0374.chr('utf-8'), '"ü"'], [0375.chr('utf-8'), '"ý"'], [0376.chr('utf-8'), '"þ"'], [0377.chr('utf-8'), '"ÿ"'] ].should be_computed_by(:inspect) end end end end with_feature :encoding do describe "String#inspect" do before :each do @external = Encoding.default_external @internal = Encoding.default_internal end after :each do Encoding.default_external = @external Encoding.default_internal = @internal end describe "when Encoding.default_internal is nil" do before :each do Encoding.default_internal = nil end it "returns a String with Encoding.default_external encoding if it is ASCII compatible" do Encoding.default_external = Encoding::IBM437 "\u00b8".inspect.encoding.should equal(Encoding::IBM437) end it "returns a String in US-ASCII encoding if Encoding.default_external is not ASCII compatible" do Encoding.default_external = Encoding::UTF_16BE "\u00b8".inspect.encoding.should equal(Encoding::US_ASCII) end end describe "when Encoding.default_internal is not nil" do it "returns a String with Encoding.default_internal encoding if it is ASCII compatible" do Encoding.default_internal = Encoding::IBM866 "\u00b8".inspect.encoding.should equal(Encoding::IBM866) end it "returns a String in US-ASCII encoding if Encoding.default_internal is not ASCII compatible" do Encoding.default_internal = Encoding::UTF_16BE "\u00b8".inspect.encoding.should equal(Encoding::US_ASCII) end end end end
30.520053
104
0.359236
1c5efe9a7139e4e95565f341b866eae3c597d7a7
974
# frozen_string_literal: true module Economic # Entity::Mapper provides a generic way of building SOAP data structures for # entities. # # Based on an Entity and a set of rules that define the fields to map to, it # returns a Hash named and ordered properly, ready for passing to the # endpoint as SOAP data. class Entity::Mapper attr_reader :entity, :fields def initialize(entity, fields = []) @entity = entity @fields = fields end def to_hash data = {} fields.each do |field, method, formatter, required| value = entity.send(method) present = present?(value) if present || required value = formatter.call(value) if formatter data[field] = value end end data end private def present?(value) !( (value.respond_to?(:blank?) && value.blank?) || (value.respond_to?(:empty?) && value.empty?) ) end end end
22.136364
78
0.609856
ff7e9cee61ab44d4876fba315aaed6387c91326f
62
# frozen_string_literal: true require_relative 'carrier/dao'
15.5
30
0.822581
e9f099118c53696d38cceccc7a320bcb78dfed28
6,905
# Represents a set of phone numbers. # class CckForms::ParameterTypeClass::Phones include CckForms::ParameterTypeClass::Base MIN_PHONES_IN_FORM = Rails.application.config.cck_forms.phones.min_phones_in_form MOBILE_CODES = Rails.application.config.cck_forms.phones.mobile_codes PREFIX = Rails.application.config.cck_forms.phones.prefix NUMBER_PARTS_GLUE = Rails.application.config.cck_forms.phones.number_parts_glue # Filters input array for phone-like Hashes: prefix: ..., code: ..., number: ... # Cleans them up and returns. # # In application: [{prefix: '+7'}, {code: ' 123 ', number: '1234567', zzz: ''}] # # In MongoDB: [{prefix: '', code: '123', number: '1234567'}] def mongoize value = self.value return [] unless value.respond_to? :each value = value.values if value.is_a? Hash result = [] value.each do |phone| phone = {} if phone.blank? or !(phone.is_a? Hash) phone = blank_phone.merge phone.stringify_keys phone['prefix'] = phone['prefix'].strip phone['code'] = clean_numbers(phone['code'].to_s) phone['number'] = clean_numbers(phone['number'].to_s) if phone['code'].present? or phone['number'].present? result << { 'prefix' => phone['prefix'], 'code' => phone['code'], 'number' => phone['number'], } end end result end # Cleanup phone format def self.demongoize_value(value, _parameter_type_class=nil) if value value.map do |phone| phone = phone.stringify_keys! { 'prefix' => phone['prefix'], 'code' => phone['code'], 'number' => phone['number'], } end end end # A form with pre-set MIN_PHONES_IN_FORM empty phones. # # If MIN_PHONES_IN_FORM are taken, add one more field to add more phones. def build_form(form_builder, options) set_value_in_hash options value = options[:value].presence value = [] unless !value.blank? and value.is_a? Array result = value.map { |phone| build_single_form(form_builder, phone, options) } [1, CckForms::ParameterTypeClass::Phones::MIN_PHONES_IN_FORM - result.length].max.times { result << build_single_form(form_builder, {}, options) } id = form_builder_name_to_id form_builder sprintf '<div id="%s">%s</div>%s', id, result.join, script(id, options) end # HTML for sinle phone number def build_single_form(form_builder, phone, options = {}) phone = {} unless phone.is_a? Hash phone = blank_phone.merge phone prefix_class = options[:prefix_class].presence || 'input-tiny form-control' code_class = options[:code_class].presence || 'input-mini form-control' number_class = options[:number_class].presence || 'input-small form-control' group_class = options[:group_class].presence || 'form-inline' delimiter = options[:delimiter].presence || '&mdash;' phone_form = [] form_builder.fields_for(:value, index: '') do |phone_builder| phone_form << phone_builder.text_field(:prefix, class: prefix_class, value: phone['prefix']) phone_form << phone_builder.text_field(:code, class: code_class, value: phone['code']) phone_form << phone_builder.text_field(:number, class: number_class, value: phone['number']) end full_phone_form = [phone_form[0], delimiter, phone_form[1], delimiter, phone_form[2]].join sprintf '<p class="%s">%s</p>', group_class, full_phone_form end # 1 empty phone Hash: {prefix: '+7', code: '', number: ''} def blank_phone { 'prefix' => PREFIX, 'code' => '', 'number' => '', } end def script(id, options = {}) button_class = options[:button_class] <<HTML <script type="text/javascript"> $(function() { var $phones = $("##{id}"); var doTimes = #{CckForms::ParameterTypeClass::Phones::MIN_PHONES_IN_FORM}; var createPhone = function() { var $newPhone = $phones.children("p:last").clone(); $newPhone.children("input").each(function() { var $this = $(this); var isPrefix = $this.prop('name').match(/\\[prefix\\]$/); $this.val(isPrefix ? "#{blank_phone['prefix']}" : ''); var index = $this.prop("id").match(/value_([0-9]+)_/); if(!index) { return; } index = index[1] * 1; $this.prop("id", $this.prop("id").replace(index, index + 1)); $this.prop("name", $this.prop("name").replace(index, index + 1)); }) $phones.children("p:last").after($newPhone); } $phones.append('<a href="#" class="add_more #{button_class}">#{I18n.t 'cck_forms.phones.add_more'}</a>'); $phones.children(".add_more").click(function() { for(var i = 0; i < doTimes; ++ i) { createPhone(); } return false; }) }); </script> HTML end def to_html(options = {}) phones_list = [] (value || []).each do |phone| if phone['number'] && clean_numbers(phone['number'].to_s).present? if phone['prefix'].present? || phone['code'].present? prefix = phone['prefix'].present? ? "<span class=\"phone-prefix\">#{phone['prefix']}</span>" : '' code = phone['code'].present? ? "<span class=\"phone-code\">#{phone['code']}</span>" : '' start = sprintf(phone['code'].in?(MOBILE_CODES) ? '<span class="phone-mobile-prefix">%s(%s)</span>' : '<span class="phone-city-prefix">%s(%s)</span>', prefix, code) else start = '' end number = split_number(clean_numbers(phone['number'])).join(NUMBER_PARTS_GLUE) phones_list << sprintf('<span class="phone">%s<span class="phone-number">%s</span></span>', start, number) end end phones_list = phones_list.take(options[:limit]) if options[:limit] if options[:as_list] phones_list else phones_list.join(', ').html_safe end end def to_s(options = {}) sanitizer = defined?(Rails::Html::FullSanitizer) ? Rails::Html::FullSanitizer : HTML::FullSanitizer sanitizer.new.sanitize to_html(options) end private # 123-45-67 asdasd -> 1234567 def clean_numbers(number) number.gsub /\D/, '' end # 1234567 -> 123 45 67 with tags def split_number(number) if number.length > 4 tokens = [] # reverse & split by doubles number.reverse.scan(/.(?:.|$)/) do |token| token.reverse! if token.length == 1 tokens.last.prepend token else tokens << token end end # merge back tokens.reverse! tokens.tap do |tokens| tokens.map! { |token| yield token } if block_given? end else yield number if block_given? [number] end end end
32.880952
174
0.598262
912f9eb5b6b0be6e5fa920208860073ecb18e2fc
7,662
require 'gitlab/satellite/satellite' class Projects::MergeRequestsController < Projects::ApplicationController before_filter :module_enabled before_filter :merge_request, only: [:edit, :update, :show, :diffs, :automerge, :automerge_check, :ci_status] before_filter :closes_issues, only: [:edit, :update, :show, :diffs] before_filter :validates_merge_request, only: [:show, :diffs] before_filter :define_show_vars, only: [:show, :diffs] # Allow read any merge_request before_filter :authorize_read_merge_request! # Allow write(create) merge_request before_filter :authorize_write_merge_request!, only: [:new, :create] # Allow modify merge_request before_filter :authorize_modify_merge_request!, only: [:close, :edit, :update, :sort] def index @merge_requests = get_merge_requests_collection @merge_requests = @merge_requests.page(params[:page]).per(20) end def show @note_counts = Note.where(commit_id: @merge_request.commits.map(&:id)). group(:commit_id).count respond_to do |format| format.html format.json { render json: @merge_request } format.diff { render text: @merge_request.to_diff(current_user) } format.patch { render text: @merge_request.to_patch(current_user) } end end def diffs @commit = @merge_request.last_commit @comments_allowed = @reply_allowed = true @comments_target = { noteable_type: 'MergeRequest', noteable_id: @merge_request.id } @line_notes = @merge_request.notes.where("line_code is not null") respond_to do |format| format.html format.json { render json: { html: view_to_html_string("projects/merge_requests/show/_diffs") } } end end def new params[:merge_request] ||= ActionController::Parameters.new(source_project: @project) @merge_request = MergeRequests::BuildService.new(project, current_user, merge_request_params).execute @target_branches = if @merge_request.target_project @merge_request.target_project.repository.branch_names else [] end @target_project = merge_request.target_project @source_project = merge_request.source_project @commits = @merge_request.compare_commits @commit = @merge_request.compare_commits.last @diffs = @merge_request.compare_diffs @note_counts = Note.where(commit_id: @commits.map(&:id)). group(:commit_id).count end def edit @source_project = @merge_request.source_project @target_project = @merge_request.target_project @target_branches = @merge_request.target_project.repository.branch_names end def create @target_branches ||= [] @merge_request = MergeRequests::CreateService.new(project, current_user, merge_request_params).execute if @merge_request.valid? redirect_to project_merge_request_path(@merge_request.target_project, @merge_request), notice: 'Merge request was successfully created.' else @source_project = @merge_request.source_project @target_project = @merge_request.target_project render action: "new" end end def update @merge_request = MergeRequests::UpdateService.new(project, current_user, merge_request_params).execute(@merge_request) if @merge_request.valid? respond_to do |format| format.js format.html do redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully updated.' end end else render "edit" end end def automerge_check if @merge_request.unchecked? @merge_request.check_if_can_be_merged end render json: { merge_status: @merge_request.merge_status_name } end def automerge return access_denied! unless allowed_to_merge? if @merge_request.open? && @merge_request.can_be_merged? AutoMergeWorker.perform_async(@merge_request.id, current_user.id, params) @status = true else @status = false end end def branch_from #This is always source @source_project = @merge_request.nil? ? @project : @merge_request.source_project @commit = @repository.commit(params[:ref]) if params[:ref].present? end def branch_to @target_project = selected_target_project @commit = @target_project.repository.commit(params[:ref]) if params[:ref].present? end def update_branches @target_project = selected_target_project @target_branches = @target_project.repository.branch_names respond_to do |format| format.js end end def ci_status ci_service = @merge_request.source_project.ci_service status = ci_service.commit_status(merge_request.last_commit.sha) if ci_service.respond_to?(:commit_coverage) coverage = ci_service.commit_coverage(merge_request.last_commit.sha) end response = { status: status, coverage: coverage } render json: response end protected def selected_target_project if @project.id.to_s == params[:target_project_id] || @project.forked_project_link.nil? @project else @project.forked_project_link.forked_from_project end end def merge_request @merge_request ||= @project.merge_requests.find_by!(iid: params[:id]) end def closes_issues @closes_issues ||= @merge_request.closes_issues end def authorize_modify_merge_request! return render_404 unless can?(current_user, :modify_merge_request, @merge_request) end def authorize_admin_merge_request! return render_404 unless can?(current_user, :admin_merge_request, @merge_request) end def module_enabled return render_404 unless @project.merge_requests_enabled end def validates_merge_request # If source project was removed (Ex. mr from fork to origin) return invalid_mr unless @merge_request.source_project # Show git not found page # if there is no saved commits between source & target branch if @merge_request.commits.blank? # and if target branch doesn't exist return invalid_mr unless @merge_request.target_branch_exists? # or if source branch doesn't exist return invalid_mr unless @merge_request.source_branch_exists? end end def define_show_vars # Build a note object for comment form @note = @project.notes.new(noteable: @merge_request) @notes = @merge_request.mr_and_commit_notes.inc_author.fresh @discussions = Note.discussions_from_notes(@notes) @noteable = @merge_request # Get commits from repository # or from cache if already merged @commits = @merge_request.commits @merge_request_diff = @merge_request.merge_request_diff @allowed_to_merge = allowed_to_merge? @show_merge_controls = @merge_request.open? && @commits.any? && @allowed_to_merge @source_branch = @merge_request.source_project.repository.find_branch(@merge_request.source_branch).try(:name) if @merge_request.locked_long_ago? @merge_request.unlock_mr @merge_request.close end end def allowed_to_merge? allowed_to_push_code?(project, @merge_request.target_branch) end def invalid_mr # Render special view for MR with removed source or target branch render 'invalid' end def allowed_to_push_code?(project, branch) ::Gitlab::GitAccess.can_push_to_branch?(current_user, project, branch) end def merge_request_params params.require(:merge_request).permit( :title, :assignee_id, :source_project_id, :source_branch, :target_project_id, :target_branch, :milestone_id, :state_event, :description, :task_num, label_ids: [] ) end end
31.020243
142
0.722918
2658f7a92dc59cfcd5b247a1a119e42c6180dbbc
1,805
require 'advent_of_code/y2019/calculator' include Calculator def first max_output = 0 [0,1,2,3,4].permutation.each do |nums| out = 0 nums.each do |phase| pgr_tmp = input.clone @input_buffer = [phase, out] state = execute_intcode(pgr_tmp, version: 2, read_from: :read_buffer) out = state[:last_output] end max_output = out if out >= max_output end max_output end def second max_output = 0 [5,6,7,8,9].permutation.each do |n1, n2, n3, n4, n5| initial_state = {version: 3, read_from: :read_buffer} first = true pgr1 = input.clone st1 = initial_state.clone pgr2 = input.clone st2 = initial_state.clone pgr3 = input.clone st3 = initial_state.clone pgr4 = input.clone st4 = initial_state.clone pgr5 = input.clone st5 = initial_state.clone @input_buffer = [n1, 0] loop do st1 = execute_intcode(pgr1, **st1) @input_buffer.push st1[:last_output] @input_buffer.unshift(n2) if first st2 = execute_intcode(pgr2, **st2) @input_buffer.push st2[:last_output] @input_buffer.unshift(n3) if first st3 = execute_intcode(pgr3, **st3) @input_buffer.push st3[:last_output] @input_buffer.unshift(n4) if first st4 = execute_intcode(pgr4, **st4) @input_buffer.push st4[:last_output] @input_buffer.unshift(n5) if first st5 = execute_intcode(pgr5, **st5) @input_buffer.push st5[:last_output] first = false break if st5[:terminated] end max_output = @input_buffer.first if @input_buffer.first > max_output end max_output end def input @input ||= File.read('inputs/y2019/day_seven.txt').chomp.split(",").map(&:to_i) end
22.012195
81
0.625485
79a8b74fa39695996d812a8426172a9eae34f3dd
350
class VlcRemote < Cask version :latest sha256 :no_check url 'http://hobbyistsoftware.com/Downloads/VLCRemote/latest-mac.php?cdn' appcast 'http://hobbyistsoftware.com/Downloads/VLCRemote/vlcSetupHelperVersions.xml' homepage 'http://hobbyistsoftware.com/vlc' caskroom_only true caveats do manual_installer 'VLC Setup.app' end end
25
86
0.771429
1c86006e817f2c797654586cd50feb89f7384aa6
181
# # Cookbook Name:: cook2 # Recipe:: default # # Copyright 2017, YOUR_COMPANY_NAME # # All rights reserved - Do Not Redistribute # file '/home/ubuntu/file1' do content 'file1' end
15.083333
43
0.718232
039677364613560218cdd961a5e6dd38fa0ea2ba
6,459
=begin #Sunshine Conversations API The version of the OpenAPI document: 9.4.5 Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'date' module SunshineConversationsClient # The webhook that generated the payload. class WebhookSubSchema # The unique ID of the webhook. attr_accessor :id # Schema version of the payload delivered to this webhook (v2). attr_accessor :version # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'id' => :'id', :'version' => :'version' } end # Attribute type mapping. def self.openapi_types { :'id' => :'String', :'version' => :'String' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `SunshineConversationsClient::WebhookSubSchema` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `SunshineConversationsClient::WebhookSubSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'version') self.version = attributes[:'version'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && version == o.version end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [id, version].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model SunshineConversationsClient.const_get(type).build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end
29.902778
223
0.621613
e2c66e9d4e300a23f967c94b8c9f184512d896cb
157
class Menu < ActiveRecord::Base validates_presence_of :name has_many :menu_items accepts_nested_attributes_for :menu_items, reject_if: :all_blank end
22.428571
66
0.815287
21b8728b47f24094657317e7121f9f70cda11a2d
505
User.delete_all Tweet.delete_all baxter_black = User.create(:username=>'Baxter Black', :email => '[email protected]', :password_digest => 'pass') john_boy = User.create(:username=>'John Boy', :email => '[email protected]', :password_digest => 'word') tweet1 = Tweet.create(:content => 'First Tweet', :user_id => 1) tweet2 = Tweet.create(:content => 'Second Tweet', :user_id => 1) tweet3 = Tweet.create(:content => 'Third Tweet', :user_id => 2) tweet4 = Tweet.create(:content => 'Fourth Tweet', :user_id => 2)
45.909091
109
0.683168
08366e896d8d95c7e3b2d03d00dbb3557188cdf6
590
#!/usr/bin/env ruby # vim: et ts=2 sw=2 module ICloud end require "icloud/core_ext/array" require "icloud/core_ext/date_time" require "icloud/core_ext/object" require "icloud/helpers/date_helpers" require "icloud/helpers/guid" require "icloud/helpers/inflections" require "icloud/helpers/proxy" require "icloud/record" require "icloud/records/alarm" require "icloud/records/collection" require "icloud/records/dsinfo" require "icloud/records/reminder" require "icloud/porcelain/reminder" require "icloud/errors" require "icloud/pool" require "icloud/session" require "icloud/version"
21.071429
37
0.79322
21891c181becefa8d429587b5c601783d9f3d337
7,873
run "if uname | grep -q 'Darwin'; then pgrep spring | xargs kill -9; fi" ##################################### # SOME DEFS require 'open-uri' require 'net/http' require 'nokogiri' def gem_get_version(gem) url = "https://rubygems.org/gems/#{gem}" uri = URI.parse(url) page = Net::HTTP.get_response(uri) page_parse = Nokogiri::HTML(page.body) ref = page_parse.css('input#gemfile_text') ref[0]['value'] end FILE_APPLICATION_HTML_ERB = 'app/views/layouts/application.html.erb' # GEMFILE ######################################## inject_into_file 'Gemfile', before: 'group :development, :test do' do <<~RUBY #{gem_get_version('autoprefixer-rails')} #{gem_get_version('devise')} #{gem_get_version('devise-i18n')} #{gem_get_version('font-awesome-sass')} #{gem_get_version('simple_form')} RUBY end inject_into_file 'Gemfile', after: 'group :development, :test do' do <<-RUBY gem 'pry-byebug' gem 'pry-rails' gem 'dotenv-rails' RUBY end # Comments some lines gsub_file('Gemfile', /# gem 'redis'/, "gem 'redis'") gsub_file('Gemfile', /#gem 'jbuilder'/, "gem 'jbuilder'") # Assets ######################################## run 'rm -rf app/assets/stylesheets' run 'rm -rf vendor' run 'curl -L https://github.com/appwebd/rails-stylesheets/archive/master.zip > stylesheets.zip' run 'unzip stylesheets.zip -d app/assets && rm stylesheets.zip && mv app/assets/rails-stylesheets-master app/assets/stylesheets' # Dev environment ######################################## gsub_file('config/environments/development.rb', /config\.assets\.debug.*/, 'config.assets.debug = false') # Layout ######################################## if Rails.version < "6" scripts = <<~HTML <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload', defer: true %> <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> HTML gsub_file(FILE_APPLICATION_HTML_ERB, "<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>", scripts) end gsub_file(FILE_APPLICATION_HTML_ERB, "<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>", "<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload', defer: true %>") style = <<~HTML <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> HTML gsub_file(FILE_APPLICATION_HTML_ERB, "<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>", style) # Flashes ######################################## file 'app/views/shared/_flashes.html.erb', <<~HTML <% if notice %> <div class="alert alert-info alert-dismissible fade show m-1" role="alert"> <%= notice %> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <% end %> <% if alert %> <div class="alert alert-warning alert-dismissible fade show m-1" role="alert"> <%= alert %> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <% end %> HTML run 'curl -L https://github.com/lewagon/awesome-navbars/raw/master/templates/_navbar_wagon.html.erb > app/views/shared/_navbar.html.erb' inject_into_file FILE_APPLICATION_HTML_ERB, after: '<body>' do <<-HTML <%= render 'shared/navbar' %> <%= render 'shared/flashes' %> HTML end # README ######################################## markdown_file_content = <<-MARKDOWN Rails app generated with [appwebd/rails-templates](https://github.com/appwebd/rails-templates), created initially by the [Le Wagon coding bootcamp](https://www.lewagon.com) team. MARKDOWN file 'README.md', markdown_file_content, force: true # Generators ######################################## generators = <<~RUBY config.generators do |generate| generate.assets false generate.helper false generate.test_framework :test_unit, fixture: false end RUBY environment generators ######################################## # AFTER BUNDLE ######################################## after_bundle do # Generators: db + simple form + pages controller ######################################## rails_command 'db:drop db:create db:migrate' generate('simple_form:install', '--bootstrap') generate(:controller, 'pages', 'home', '--skip-routes', '--no-test-framework') # Routes ######################################## route "root to: 'pages#home'" # Git ignore ######################################## append_file '.gitignore', <<~TXT # Ignore .env file containing credentials. .env* .env # Ignore Mac and Linux file system files *.swp .DS_Store .idea/* .scannerwork/* node_modules/* package-lock.json yarn.lock vendor/* # Ignore uploaded files in development. /storage/* !/storage/.keep TXT # Devise install + user ######################################## generate('devise:install') generate('devise', 'User') # App controller ######################################## run 'rm app/controllers/application_controller.rb' file 'app/controllers/application_controller.rb', <<~RUBY class ApplicationController < ActionController::Base #{ "protect_from_forgery with: :exception\n" if Rails.version < "5.2"} before_action :authenticate_user! end RUBY # migrate + devise views ######################################## rails_command 'db:migrate' generate('devise:views') # Pages Controller ######################################## run 'rm app/controllers/pages_controller.rb' file 'app/controllers/pages_controller.rb', <<~RUBY class PagesController < ApplicationController skip_before_action :authenticate_user!, only: [ :home ] def home end end RUBY # Environments ######################################## environment 'config.action_mailer.default_url_options = { host: "http://localhost:3000" }', env: 'development' environment 'config.action_mailer.default_url_options = { host: "http://TODO_PUT_YOUR_DOMAIN_HERE" }', env: 'production' # Webpacker / Yarn ######################################## run 'yarn add popper.js jquery [email protected]' append_file 'app/javascript/packs/application.js', <<~JS // ---------------------------------------------------- // Note(lewagon): ABOVE IS RAILS DEFAULT CONFIGURATION // WRITE YOUR OWN JS STARTING FROM HERE 👇 // ---------------------------------------------------- // External imports import "bootstrap"; // Internal imports, e.g: // import { initSelect2 } from '../components/init_select2'; document.addEventListener('turbolinks:load', () => { // Call your functions here, e.g: // initSelect2(); }); JS inject_into_file 'config/webpack/environment.js', before: 'module.exports' do <<~JS const webpack = require('webpack'); // Preventing Babel from transpiling NodeModules packages environment.loaders.delete('nodeModules'); // Bootstrap 4 has a dependency over jQuery & Popper.js: environment.plugins.prepend('Provide', new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', Popper: ['popper.js', 'default'] }) ); JS end # Dotenv ######################################## run 'touch .env' # Rubocop ######################################## run 'curl -L https://raw.githubusercontent.com/appwebd/rails-templates/master/.rubocop.yml > .rubocop.yml' # Git ######################################## git add: '.' git commit: "-m 'Initial commit with devise template from https://github.com/appwebd/rails-templates'" end
30.87451
207
0.593167
4a418dfcb046acf4a0b416cf39e9a763e7a97b65
5,452
module ShouldaMatchmakers module Model module ActiveRecord module FactorySmModelHelper def factory_attributes attributes_for_factory = get_validation_attributes(@app_class_name) attributes_for_factory = attributes_for_factory | get_required_attributes(@app_class_name) attributes_for_factory = attributes_for_factory - get_attributes_with_defaults(@app_class_name) attributes_for_factory = attributes_for_factory.flatten.compact.uniq.sort factory_attributes_string = "" attributes_for_factory.each do |attribute| factory_attributes_string.concat(" # " + attribute.to_s + "\n") end factory_attributes_string end private def get_validation_attributes(app_class_name) validation_attributes = [] validation_attributes = validation_attributes | get_absence_attributes(app_class_name) validation_attributes = validation_attributes | get_acceptance_attributes(app_class_name) validation_attributes = validation_attributes | get_confirmation_attributes(app_class_name) validation_attributes = validation_attributes | get_exclusion_attributes(app_class_name) validation_attributes = validation_attributes | get_inclusion_attributes(app_class_name) validation_attributes = validation_attributes | get_length_attributes(app_class_name) validation_attributes = validation_attributes | get_numericality_attributes(app_class_name) validation_attributes = validation_attributes | get_presence_attributes(app_class_name) validation_attributes | get_uniqueness_attributes(app_class_name) end def get_attributes_with_defaults(app_class_name) app_class_name.constantize.columns.select{ |column| !column.default.nil? }.map(&:name).map(&:to_sym) # The following line of code doesn't work for the class 'SuperAdminUser', but only that class. # app_class_name.constantize.column_defaults.select{ |attribute, default| !default.nil? }.keys.map(&:to_sym) end def get_required_attributes(app_class_name) required_attributes = [] required_attributes.concat(app_class_name.constantize.columns.select{ |column| !column.null }.map(&:name)) required_attributes.map(&:to_sym) - [:id, :encrypted_password, :created_at, :updated_at] end def get_absence_attributes(app_class_name) absence_attributes = [] extract_validators(app_class_name, ::ActiveModel::Validations::AbsenceValidator).flatten.map do |validator| absence_attributes.concat(validator.attributes) end absence_attributes end def get_acceptance_attributes(app_class_name) acceptance_attributes = [] extract_validators(app_class_name, ::ActiveModel::Validations::AcceptanceValidator).flatten.map do |validator| acceptance_attributes.concat(validator.attributes) end acceptance_attributes end def get_confirmation_attributes(app_class_name) confirmation_attributes = [] extract_validators(app_class_name, ::ActiveModel::Validations::ConfirmationValidator).flatten.map do |validator| confirmation_attributes.concat(validator.attributes) end confirmation_attributes end def get_exclusion_attributes(app_class_name) exclusion_attributes = [] extract_validators(app_class_name, ::ActiveModel::Validations::ExclusionValidator).flatten.map do |validator| exclusion_attributes.concat(validator.attributes) end exclusion_attributes end def get_inclusion_attributes(app_class_name) inclusion_attributes = [] extract_validators(app_class_name, ::ActiveModel::Validations::InclusionValidator).flatten.map do |validator| inclusion_attributes.concat(validator.attributes) end inclusion_attributes end def get_length_attributes(app_class_name) length_attributes = [] extract_validators(app_class_name, ::ActiveModel::Validations::LengthValidator).flatten.map do |validator| length_attributes.concat(validator.attributes) end length_attributes end def get_numericality_attributes(app_class_name) numericality_attributes = [] extract_validators(app_class_name, ::ActiveModel::Validations::NumericalityValidator).flatten.map do |validator| numericality_attributes.concat(validator.attributes) end numericality_attributes end def get_presence_attributes(app_class_name) presence_attributes = [] extract_validators(app_class_name, ::ActiveRecord::Validations::PresenceValidator).flatten.map do |validator| presence_attributes.concat(validator.attributes) end presence_attributes end def get_uniqueness_attributes(app_class_name) uniqueness_attributes = [] extract_validators(app_class_name, ::ActiveRecord::Validations::UniquenessValidator).flatten.map do |validator| uniqueness_attributes.concat(validator.attributes) end uniqueness_attributes end end end end end
43.616
122
0.706713
9107ad38c9e29ea9464fb46d57959c121fb82d78
3,749
# encoding: UTF-8 # frozen_string_literal: true module ApplicationHelper def check_active(klass) if klass.is_a? String return 'active' unless (controller.controller_path.exclude?(klass.singularize)) else return 'active' if (klass.model_name.singular == controller.controller_name.singularize) end end def top_nav_link(link_text, link_path, link_icon, controllers: [], counter: 0, target: '') merged = (controllers & controller_path.split('/')) class_name = current_page?(link_path) ? 'nav-item active' : nil class_name ||= merged.empty? ? nil : 'nav-item active' content_tag(:li, :class => class_name) do link_to link_path, target: target, class: "nav-link" do content_tag(:i, :class => "fa fa-#{link_icon}") do content_tag(:span, counter,class: "counter") if counter != 0 end + content_tag(:span, link_text) end end end def locale_name I18n.locale.to_s.downcase end def body_id "#{controller_name}-#{action_name}" end def guide_panel_title @guide_panel_title || t("guides.#{i18n_controller_path}.#{action_name}.panel", default: t("guides.#{i18n_controller_path}.panel")) end def guide_title @guide_title || t("guides.#{i18n_controller_path}.#{action_name}.title", default: t("guides.#{i18n_controller_path}.panel")) end def guide_intro @guide_intro || t("guides.#{i18n_controller_path}.#{action_name}.intro", default: t("guides.#{i18n_controller_path}.intro", default: '')) end def i18n_controller_path @i18n_controller_path ||= controller_path.gsub(/\//, '.') end def description_for(name, &block) content_tag :dl, class: "dl-#{name} dl-horizontal" do capture(&block) end end def item_for(model_or_title, name='', value = nil, &block) if model_or_title.is_a? String or model_or_title.is_a? Symbol title = model_or_title capture do if block_given? content_tag(:dt, title.to_s) + content_tag(:dd, capture(&block)) else value = name content_tag(:dt, title.to_s) + content_tag(:dd, value) end end else model = model_or_title capture do if block_given? content_tag(:dt, model.class.human_attribute_name(name)) + content_tag(:dd, capture(&block)) else value ||= model.try(name) value = value.localtime if value.is_a? DateTime value = I18n.t(value) if value.is_a? TrueClass content_tag(:dt, model.class.human_attribute_name(name)) + content_tag(:dd, value) end end end end def root_url_with_port_from_request port = request.env['SERVER_PORT'] parts = [request.protocol, request.domain] unless port.blank? parts << if request.ssl? port == '443' ? '' : ":#{port}" else port == '80' ? '' : ":#{port}" end end parts.join('') end def custom_stylesheet_link_tag_for(layout) if File.file?(Rails.root.join('public/custom-stylesheets', "#{layout}.css")) tag :link, \ rel: 'stylesheet', media: 'screen', href: "/custom-stylesheets/#{layout}.css" end end # Yaroslav Konoplov: I don't use #image_path & #image_url here # since Gon::Jbuilder attaches ActionView::Helpers which behave differently # compared to what ActionController does. def currency_icon_url(currency) if currency.coin? ActionController::Base.helpers.image_url "yarn_components/cryptocurrency-icons/svg/color/#{currency.code}.png" else ActionController::Base.helpers.image_url "yarn_components/currency-flags/src/flags/#{currency.code}.png" end end end
30.729508
141
0.647906
79efca1ca0c94826a561f236a19215fc81784e90
83
json.plans @plans do |plan| json.partial! 'api/v1/plans/plan', plan: plan end
20.75
48
0.674699
acc9b111138f1f95c43057e6df7e50ed1a5de5e6
2,214
# -*- coding: binary -*- module Msf module Java module Rmi module Client module Registry module Builder # Builds an RMI call to java/rmi/registry/RegistryImpl_Stub#lookup() used to # retrieve the remote reference bound to a name. # # @param opts [Hash] # @option opts [String] :name the name to lookup # @return [Rex::Proto::Rmi::Model::Call] # @see Msf::Java::Rmi::Builder.build_call def build_registry_lookup(opts = {}) object_number = opts[:object_number] || 0 uid_number = opts[:uid_number] || 0 uid_time = opts[:uid_time] || 0 uid_count = opts[:uid_count] || 0 name = opts[:name] || '' call = build_call( object_number: object_number, uid_number: uid_number, uid_time: uid_time, uid_count: uid_count, operation: 2, # java.rmi.Remote lookup(java.lang.String) hash: registry_interface_hash, arguments: [Rex::Java::Serialization::Model::Utf.new(nil, name)] ) call end # Builds an RMI call to java/rmi/registry/RegistryImpl_Stub#list() used to # enumerate the names bound in a registry # # @param opts [Hash] # @return [Rex::Proto::Rmi::Model::Call] # @see Msf::Java::Rmi::Builder.build_call def build_registry_list(opts = {}) object_number = opts[:object_number] || 0 uid_number = opts[:uid_number] || 0 uid_time = opts[:uid_time] || 0 uid_count = opts[:uid_count] || 0 call = build_call( object_number: object_number, uid_number: uid_number, uid_time: uid_time, uid_count: uid_count, operation: 1, # java.lang.String list()[] hash: registry_interface_hash, arguments: [] ) call end end end end end end end
33.044776
88
0.501355
1802967d7d9c953d1e00bc6df987d957dc6a5ead
491
module SessionsHelper def log_in(user) session[:user_id] = user.id end def current_user # rubocop:disable Style/GuardClause # rubocop:disable Style/IfUnlessModifier if session[:user_id] @current_user ||= User.find_by(id: session[:user_id]) end # rubocop:enable Style/IfUnlessModifier # rubocop:enable Style/GuardClause end def logged_in? !current_user.nil? end def log_out session.delete(:user_id) @current_user = nil end end
19.64
59
0.694501
b913d6789bcf3b0b48059a40536a06b419f268e2
3,507
# frozen_string_literal: true module UseCase class UpdateAssessmentAddressId class AddressIdMismatched < StandardError; end class AddressIdNotFound < StandardError; end class AssessmentNotFound < StandardError; end class InvalidAddressIdFormat < StandardError; end def initialize( address_base_gateway:, assessments_address_id_gateway:, assessments_search_gateway:, assessments_gateway:, event_broadcaster: ) @address_base_gateway = address_base_gateway @assessments_address_id_gateway = assessments_address_id_gateway @assessments_search_gateway = assessments_search_gateway @assessments_gateway = assessments_gateway @event_broadcaster = event_broadcaster end def execute(assessment_id, new_address_id) validate_address_id_format(new_address_id) assessment_id = Helper::RrnHelper.normalise_rrn_format(assessment_id) assessments_ids = [assessment_id] linked_assessment_id = @assessments_gateway.get_linked_assessment_id(assessment_id) assessments_ids << linked_assessment_id unless linked_assessment_id.nil? assessments_ids.each do |current_assessment_id| check_assessment_exists(current_assessment_id) end validate_new_address_id(assessments_ids, new_address_id) @assessments_address_id_gateway.update_assessments_address_id_mapping( assessments_ids, new_address_id, ) assessments_ids.each do |id| @event_broadcaster.broadcast :assessment_address_id_updated, assessment_id: id, new_address_id: end end private def check_assessment_exists(assessment_id) assessment = @assessments_search_gateway.search_by_assessment_id( assessment_id, restrictive: false, ).first raise AssessmentNotFound unless assessment end def validate_address_id_format(new_address_id) raise InvalidAddressIdFormat, "AddressId has to begin with UPRN- or RRN-" unless new_address_id.start_with?("UPRN-", "RRN-") raise InvalidAddressIdFormat, "RRN is not in the correct format" if new_address_id.start_with?("RRN-") && !Helper::RrnHelper.valid_format?(new_address_id[4..]) raise InvalidAddressIdFormat, "UPRN is not in the correct format" if new_address_id.start_with?("UPRN-") && (new_address_id.delete("UPRN-").length > 12) end def validate_new_address_id(assessment_ids, new_address_id) if new_address_id.start_with? "UPRN-" linking_to_uprn = new_address_id[5..] unless @address_base_gateway.check_uprn_exists(linking_to_uprn) raise AddressIdNotFound end elsif new_address_id.start_with? "RRN-" linking_to_rrn = new_address_id[4..] if @assessments_search_gateway.search_by_assessment_id(linking_to_rrn) .empty? raise AddressIdNotFound end rrn_assessment_address_id = @assessments_address_id_gateway.fetch(linking_to_rrn)[:address_id] # This a new address ID and the new assessment address ID points to itself if new_address_id != rrn_assessment_address_id && !assessment_ids.include?(linking_to_rrn) raise AddressIdMismatched, "Assessment #{linking_to_rrn} is linked to address ID #{rrn_assessment_address_id}" end end end end end
34.722772
165
0.706587
f7c9eb48bafaa97c5c7f968c2ac661650185c245
130
class AddEnrollmentToStudent < ActiveRecord::Migration[5.1] def change add_column :students, :enrollment, :string end end
21.666667
59
0.761538
08b088d377f374c0807226181f475338e367e512
533
# Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json, :multipart_form] # wrap_parameters format: [] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do # self.include_root_in_json = true # end
33.3125
96
0.780488
1c6c767d08e1a57dc6a6b4e7022fc1164218ffc8
361
# frozen_string_literal: true module SystemAdmin class ValidationErrorsController < ApplicationController def index authorize(ValidationError, :index?) @grouped_counts = ValidationError.group(:form_object).order("count_all DESC").count @grouped_column_error_counts = ValidationError.list_of_distinct_errors_with_count end end end
30.083333
89
0.786704
6aa7efff830e682498aa74ab2b3cca635f60db15
841
module Adminterface module Extensions module Views module Components module SiteTitle def tag_name :div end private def title_image helpers.image_tag(site_title_image, class: "image", alt: title_text) end end end end end end # Overwrite activeadmin/lib/active_admin/views/components/site_title.rb ActiveAdmin::Views::SiteTitle.class_eval do prepend Adminterface::Extensions::Views::Components::SiteTitle attr_reader :logged_in def build(namespace, logged_in = true) @logged_in = logged_in.eql?(true) super(class: "site_title") add_class "navbar-brand" if @logged_in @namespace = namespace div class: "title" do site_title_link? ? site_title_with_link : site_title_content end end end
22.72973
80
0.665874
91bf1516f75ade67240f14b2a2f711f8b5c55217
202
require 'spec_helper' #I hate calling out directly from Ruby like this ## but the function: "command('nproc')" was returning strings I couldn't cast describe `nproc`.to_i do it { should >= 12 } end
20.2
77
0.722772
6ada4a0fe8d688bd0326382078ab00545fa1a9ab
1,221
class Prototool < Formula desc "Your Swiss Army Knife for Protocol Buffers" homepage "https://github.com/uber/prototool" url "https://github.com/uber/prototool/archive/v1.8.0.tar.gz" sha256 "e700c38e086a743322d35d83cb3b7a481a72d8136db71625a423ba6494a56e58" revision 1 bottle do cellar :any_skip_relocation sha256 "23b854b6cfca6861ec7ecaffb2f139955f6e26d4f0e017f4c95ea8be43a3530f" => :mojave sha256 "5cdf73fb1d93146474a4b6b4c6355a982c9bfb37e60cc2bf3e1e3751830c4947" => :high_sierra sha256 "ba508b667a020c183e8bb3e0225bd70e2d4a8af52b5633725e8ebad8c9e28e12" => :sierra end depends_on "go" => :build def install ENV["GOPATH"] = buildpath dir = buildpath/"src/github.com/uber/prototool" dir.install buildpath.children cd dir do system "make", "brewgen" cd "brew" do bin.install "bin/prototool" bash_completion.install "etc/bash_completion.d/prototool" zsh_completion.install "etc/zsh/site-functions/_prototool" man1.install Dir["share/man/man1/*.1"] prefix.install_metafiles end end end test do system bin/"prototool", "config", "init" assert_predicate testpath/"prototool.yaml", :exist? end end
32.131579
93
0.732187
d524493e414947e44c1aec10ca5e1b84809fbf7e
1,286
module Prefab class CancellableInterceptor < GRPC::ClientInterceptor WAIT_SEC = 3 def initialize(base_client) @base_client = base_client end def cancel @call.instance_variable_get("@wrapped").instance_variable_get("@call").cancel i = 0 while (i < WAIT_SEC) do if @call.instance_variable_get("@wrapped").cancelled? @base_client.log_internal Logger::DEBUG, "Cancelled streaming." return else @base_client.log_internal Logger::DEBUG, "Unable to cancel streaming. Trying again" @call.instance_variable_get("@wrapped").instance_variable_get("@call").cancel i += 1 sleep(1) end end @base_client.log_internal Logger::INFO, "Unable to cancel streaming." end def request_response(request:, call:, method:, metadata:, &block) shared(call, &block) end def client_streamer(requests:, call:, method:, metadata:, &block) shared(call, &block) end def server_streamer(request:, call:, method:, metadata:, &block) shared(call, &block) end def bidi_streamer(requests:, call:, method:, metadata:, &block) shared(call, &block) end def shared(call) @call = call yield end end end
26.791667
93
0.635303
1c44620196165893acb6e23f26f548c206e90396
2,312
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join("tmp", "caching-dev.txt").exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options) config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Url for mailer config.action_mailer.default_url_options = { host: "localhost", port: 3000 } config.web_console.whiny_requests = false # Raises error for missing translations # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::FileUpdateChecker end
34.507463
86
0.759948
ab572081e0e64fb6cb1ddaac1ebbca94b38a5b59
554
require File.dirname(__FILE__) + '/app' # Load initializers Dir[File.dirname(__FILE__) + '/config/initializers/*.rb'].each {|file| require file } <% if (addApi){ %> <% if (addBackgroundJobs){ %> run Rack::Cascade.new [API, Rack::URLMap.new('/' => Web, '/sidekiq' => Sidekiq::Web)] <% } else { %> run Rack::Cascade.new [API, Rack::URLMap.new('/' => Web)] <% } %> <% } else { %> <% if (addBackgroundJobs){ %> run Rack::URLMap.new('/' => Web, '/sidekiq' => Sidekiq::Web) <% } else { %> run Rack::URLMap.new('/' => Web) <% } %> <% } %>
29.157895
87
0.555957
d5ec185dd9d2f34406bfa66a94f2e9a1e6bdb073
896
describe file('/var/lib/vt/bin/mysqlctld0.sh') do its('owner') { should eq 'vitess' } its('group') { should eq 'vitess' } its('mode') { should cmp '0750' } it { should exist } its('content') { should match '#!/bin/sh' } its('content') { should match 'exec /usr/local/bin/mysqlctld' } end describe file('/var/lib/vt/bin/vtgate.sh') do its('owner') { should eq 'vitess' } its('group') { should eq 'vitess' } its('mode') { should cmp '0750' } it { should exist } its('content') { should match '#!/bin/sh' } its('content') { should match 'exec /usr/local/bin/vtgate' } end describe file('/var/lib/vt/bin/vttablet0.sh') do its('owner') { should eq 'vitess' } its('group') { should eq 'vitess' } its('mode') { should cmp '0750' } it { should exist } its('content') { should match '#!/bin/sh' } its('content') { should match 'exec /usr/local/bin/vttablet' } end
29.866667
65
0.61942
5d54034afd3b0bd2e38e332938dbf30ff9f4a0b9
42
Before do @test_site = TestSite.new end
10.5
27
0.738095
38e76b103ce2cdc71c4865ea4025e8a75d9f7a2c
877
class FlickrController < ApplicationController # NOTE: If PAGESIZE is so small that it can't span a page with images, the # continuation code may leave a gap if images in the middle of the horizontal # scroller. Yes, it does handle getting more, but not well enough to handle # this one case. PAGESIZE = 50 # GET /photos # GET /photos.json # This takes extra parameters to regulate where it gets the photos # +n+ is the index of the photo to be sure to obtain # internally the photos come back in pages of PAGESIZE. def index @photos = Flickr.get_photos(params[:flickr_id], params[:n].to_i, PAGESIZE) @total_photos = @photos.total.to_i @photos_per_request = @photos.perpage.to_i end private # Only allow the white list through. def photo_params params.require(:photo).permit(:flickr_id, :provider, :unique_id) end end
33.730769
79
0.718358
612a9d3d1cb51dfe020a40300071efe135f3d7e9
759
Pod::Spec.new do |s| s.name = "MRFoundation" s.version = "0.1" s.summary = "A network communication framework." s.description = "MRFoundation is a network communication framework for iOS and OS X." s.homepage = "https://github.com/MacRemote/RemoteFoundation" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "h1994st" => "[email protected]" } s.social_media_url = "http://twitter.com/h1994st" s.ios.deployment_target = "8.0" s.osx.deployment_target = "10.9" s.source = { :git => "https://github.com/MacRemote/RemoteFoundation.git", :tag => s.version } s.source_files = "MRFoundation/*.swift" s.requires_arc = true s.dependency "CocoaAsyncSocket", "~> 7.0" end
30.36
101
0.627141
d56e744148546488c12fe0469362ef9aa06cc0c1
542
require 'spec_helper' feature 'Has correct abilities' do let(:organization) { create(:organization) } let(:conference) { create(:full_conference, organization: organization) } # user is cfp let(:user) { create(:user) } context 'when user has no role' do before do sign_in user end scenario 'for administration views' do visit admin_conference_path(conference.short_title) expect(current_path).to eq root_path expect(flash).to eq 'You are not authorized to access this page.' end end end
24.636364
89
0.701107
916d927a725d98c1fb07bad0687aa8a41129e9e8
7,696
require 'findit/asset/image' require 'findit/asset/map-marker' require 'findit/location' module FindIt # Abstract class for a map feature. # # To implement a feature, the derived class must: # # * Either define <i>@type</i> class instance variable or override <i>self.type</i> method. # * Either define <i>@marker</i> class instance variable or override <i>self.marker</i> method. # * Override <i>self.closest</i> method. # # Example: # # class Library < FindIt::BaseFeature # @type = :LIBRARY # @marker = FindIt::MapMarker.new( # "http://maps.google.com/mapfiles/kml/pal3/icon56.png", # :shadow => "icon56s.png") # def self.closest(loc) # . # . # . # end # end # class BaseFeature # A FindIt::Location instance that provides the geographical # location (latitude, longitude) of this feature. # This value is required and will always be defined. attr_reader :location # A title for this feature, such as "Closest library". # This value is required and will always be defined. attr_reader :title # The name of this feature, such as "Grouch Marx Middle School". # This value is optional and may be nil. attr_reader :name # The street address of this feature. # This value is required and will always be defined. attr_reader :address # The city portion of the address of this feature. # This value is required and will always be defined. attr_reader :city # The state portion of the address of this feature. # This value is required and will always be defined. attr_reader :state # The postal code portion of the address of this feature. # This value is optional and may be nil. attr_reader :zip # A URL to associate with this feature, such as a home page. # This value is optional and may be nil. attr_accessor :link # An optional note with additional information about this feature. # This value is optional and may be nil. attr_accessor :note # A Float value containing the distance (in miles) from the # origin point to this feature. attr_reader :distance # # Construct a new feature. # # Parameters: # # * location -- A FindIt::Location instance with the location # of this feature. # # * params -- Parameters to initialize feature attributes. See # the description of the FindIt::BaseFeature attributes for # details on parameter values. # # Returns: A FindIt::BaseFeature instance. # # The following parameters are required: # # * :title => String # * :address => String # * :city => String # * :state => String # # One of the following parameters must be specified. # # * :distance => Numeric # * :origin => FindIt::Location # # If both are specified, the <tt>:distance</tt> takes precedence. # The <tt>:origin</tt> is used only to calculate distance; the coordinate itself is not saved. # # The following parameters are optional. # # * :name => String # * :zip => String # * :link => String # * :note => String # def initialize(location, params = {}) [:title, :address, :city, :state].each do |p| raise "required parameter \":#{p}\" not specified" unless params.has_key?(p) end @location = location @title = params[:title] @name = params[:name] if params.has_key?(:name) @address = params[:address] @city = params[:city] @state = params[:state] @zip = params[:zip] if params.has_key?(:zip) @link = params[:link] if params.has_key?(:link) @note = params[:note] if params.has_key?(:note) @distance = if params.has_key?(:distance) params[:distance] elsif params.has_key?(:origin) location.distance(params[:origin]) else raise "must specify either \":distance\" or \":origin\" parameter" end end # # Locate the feature closest to the origin. # # <b>This is an abstract method that must be overridden in the derived class.</b> # # Parameter: # # * origin -- A FindIt::Location instance that is the origin point # for the search. # # Returns: The instance of this feature that is closest to the # origin point (FindIt::BaseFeature). # def self.closest(origin) raise NotImplementedError, "abstract method \"self.closest\" must be overridden" end # # The feature type. # # Returns: A symbol that indicates the feature type, such # as <tt>:FIRE_STATION</tt> or <tt>:LIBRARY</tt>. # # The default implementation returns the value of the # <i>@type</i> class instance variable. A derived class # should either initialize that variable or override this # method. # def self.type raise NameError, "class instance parameter \"type\" not initialized for class \"#{self.name}\"" unless @type @type end # # The map marker graphic for this feature. # # Returns: The graphic that should be used to identify # this feature on a map (FindIt::Asset::MapMarker). # # The default implementation returns the value of the # <i>@marker</i> class instance variable. A derived class # should either initialize that variable or override this # method. # def self.marker raise NameError, "class instance parameter \"marker\" not initialized for class \"#{self.name}\"" unless @marker @marker end # # The map marker for this feature. # # Returns: The value from the class method <i>self.marker</i>. # # Typically all features of a given type will use the same # marker, which is what this default implementation provides. # If you wish to customize the marker within a feature class, # the implementing class can override this method. # def marker self.class.marker end # # A brief "hover" hint string to display for this feature. # # Returns: A plain text string, with HTML characters escaped. # def hint s = @title + ": " + (@name.empty? ? @address : @name) s.html_safe end # # Detail information on this feature, suitable for display in # a pop-up window. # # Returns: An HTML string. # def info result = [] result << "<b>" + @title.capitalize_words.html_safe + "</b>" result << @name.html_safe unless @name.empty? result << @address.html_safe s = @city + ", " + @state s += " " + @zip unless @zip.empty? result << s.html_safe result += @note.html_safe.split("\n") unless @note.empty? result << "%.1f mi away" % [@distance] unless @link.empty? result << "<a href=\"" + @link.html_safe + "\">more info ...</a>" end "<div class=\"findit-feature-info\">\n" + result.join("<br />\n") + "\n</div>" end # Produce a Hash that represents the feature values. def to_h { :type => self.class.type, :title => @title, :name => @name, :address => @address, :city => @city, :state => @state, :zip => @zip, :link => @link, :note => @note, :latitude => @location.lat, :longitude => @location.lng, :distance => @distance, :hint => self.hint, :info => self.info, }.merge(self.marker.to_h).freeze end end end
29.714286
118
0.599142
9146496c3e67cc40371dc05367f609edf3bb43c0
183
class CreateIdentityTypes < ActiveRecord::Migration def change create_table :identity_types do |t| t.string :description t.timestamps null: false end end end
18.3
51
0.710383
014127e22689b9287e9e823a61d90ae83f35df87
2,269
## # This module requires Metasploit: http//metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## require 'msf/core' class Metasploit3 < Msf::Auxiliary include Msf::Exploit::Remote::HttpClient include Msf::Auxiliary::Report include Msf::Auxiliary::Scanner def initialize(info={}) super(update_info(info, 'Name' => "VMWare Update Manager 4 Directory Traversal", 'Description' => %q{ This modules exploits a directory traversal vulnerability in VMWare Update Manager on port 9084. Versions affected by this vulnerability: vCenter Update Manager 4.1 prior to Update 2, vCenter Update Manager 4 Update 4. }, 'License' => MSF_LICENSE, 'Author' => [ 'Alexey Sintsov', #Initial discovery, poc 'sinn3r' #Metasploit ], 'References' => [ ['CVE', '2011-4404'], ['EDB', '18138'], ['URL', 'http://www.vmware.com/security/advisories/VMSA-2011-0014.html'], ['URL', 'http://dsecrg.com/pages/vul/show.php?id=342'] ], 'DisclosureDate' => "Nov 21 2011")) register_options( [ Opt::RPORT(9084), OptString.new('URIPATH', [true, 'URI path to the downloads', '/vci/downloads/']), OptString.new('FILE', [true, 'Define the remote file to download', 'windows\\win.ini']) ], self.class) end def run_host(ip) fname = File.basename(datastore['FILE']) traversal = ".\\..\\..\\..\\..\\..\\..\\..\\" uri = normalize_uri(datastore['URIPATH']) + traversal + datastore['FILE'] print_status("#{rhost}:#{rport} - Requesting: #{uri}") res = send_request_raw({ 'method' => 'GET', 'uri' => uri }, 25) # If there's no response, don't bother if res.nil? or res.body.empty? print_error("No content retrieved from: #{ip}") return end if res.code == 404 print_error("#{rhost}:#{rport} - File not found") return else print_good("File retrieved from: #{ip}") p = store_loot("vmware.traversal.file", "application/octet-stream", rhost, res.to_s, fname) print_status("File stored in: #{p}") end end end
31.082192
97
0.587043
5d3990d014368145dd3ed43d8cb0e5dced647f17
165
class AddFieldsToUsers < ActiveRecord::Migration[6.1] def change add_column :users, :username, :string add_index :users, :username, unique: true end end
23.571429
53
0.727273
2868cbe5fcae43b13db53c6a79bb42ab97c43556
141
class Favorite < ActiveRecord::Base attr_accessible :stamp_id belongs_to :user belongs_to :stamp validates_presence_of :stamp_id end
20.142857
35
0.801418
268e9c0f965928a6580defa02eb775fd80172841
862
override :erlang, version: "18.3.4.9" override :lua, version: "5.1.5" override :rubygems, version: "3.0.2" override :bundler, version: '~> 1.17' override :'omnibus-ctl', version: "master" override :chef, version: "v14.11.21" override :ohai, version: "v14.8.11" override :ruby, version: "2.5.5" # This SHA is the last commit before the 6.0 release override :'berkshelf-no-depselector', version: '6016ca10b2f46508b1b107264228668776f505d9' # Note 2018/02/01 (sr): This is related to issue #1417: # 1.11.2.1 was the last version that supports --with-lua51=PATH, which allows us to # build it with lua on ppc64[le] and s390x. Those platforms are not supported # in mainline luajit. There's forks for ppc64, and s390x, but going forward with # those was so far blocked by ppc64 not being supported even with the PPC64 # fork. override :openresty, version: "1.13.6.2"
45.368421
89
0.735499
8791d82ea05c0b77019e6416b78b69cb0fd9137c
273
# frozen_string_literal: true class SassTemplate SASS_ENGINE_OPTIONS = { cache: false, style: :compressed }.freeze def initialize(template) @template = template end def render ::Sass::Engine.new(@template, SASS_ENGINE_OPTIONS).render end end
16.058824
61
0.70696
79ffc873c621f09ed865f121df5bb3e0591399b7
5,342
# typed: true # frozen_string_literal: true require "rubocops/extend/formula" require "extend/string" module RuboCop module Cop module FormulaAudit # This cop audits `patch`es in formulae. # TODO: Many of these could be auto-corrected. class Patches < FormulaCop extend T::Sig extend AutoCorrector def audit_formula(node, _class_node, _parent_class_node, body) @full_source_content = source_buffer(node).source external_patches = find_all_blocks(body, :patch) external_patches.each do |patch_block| url_node = find_every_method_call_by_name(patch_block, :url).first url_string = parameters(url_node).first patch_problems(url_string) end inline_patches = find_every_method_call_by_name(body, :patch) inline_patches.each { |patch| inline_patch_problems(patch) } if inline_patches.empty? && patch_end? offending_patch_end_node(node) add_offense(@offense_source_range, message: "patch is missing 'DATA'") end patches_node = find_method_def(body, :patches) return if patches_node.nil? legacy_patches = find_strings(patches_node) problem "Use the patch DSL instead of defining a 'patches' method" legacy_patches.each { |p| patch_problems(p) } end private def patch_problems(patch_url_node) patch_url = string_content(patch_url_node) if regex_match_group(patch_url_node, %r{https://github.com/[^/]*/[^/]*/pull}) problem "Use a commit hash URL rather than an unstable pull request URL: #{patch_url}" end if regex_match_group(patch_url_node, %r{.*gitlab.*/merge_request.*}) problem "Use a commit hash URL rather than an unstable merge request URL: #{patch_url}" end if regex_match_group(patch_url_node, %r{https://github.com/[^/]*/[^/]*/commit/[a-fA-F0-9]*\.diff}) problem "GitHub patches should end with .patch, not .diff: #{patch_url}" end # Only .diff passes `--full-index` to `git diff` and there is no documented way # to get .patch to behave the same for GitLab. if regex_match_group(patch_url_node, %r{.*gitlab.*/commit/[a-fA-F0-9]*\.patch}) problem "GitLab patches should end with .diff, not .patch: #{patch_url}" end gh_patch_param_pattern = %r{https?://github\.com/.+/.+/(?:commit|pull)/[a-fA-F0-9]*.(?:patch|diff)} if regex_match_group(patch_url_node, gh_patch_param_pattern) && !patch_url.match?(/\?full_index=\w+$/) problem "GitHub patches should use the full_index parameter: #{patch_url}?full_index=1" end gh_patch_patterns = Regexp.union([%r{/raw\.github\.com/}, %r{/raw\.githubusercontent\.com/}, %r{gist\.github\.com/raw}, %r{gist\.github\.com/.+/raw}, %r{gist\.githubusercontent\.com/.+/raw}]) if regex_match_group(patch_url_node, gh_patch_patterns) && !patch_url.match?(%r{/[a-fA-F0-9]{6,40}/}) problem "GitHub/Gist patches should specify a revision: #{patch_url}" end gh_patch_diff_pattern = %r{https?://patch-diff\.githubusercontent\.com/raw/(.+)/(.+)/pull/(.+)\.(?:diff|patch)} if regex_match_group(patch_url_node, gh_patch_diff_pattern) problem "Use a commit hash URL rather than patch-diff: #{patch_url}" end if regex_match_group(patch_url_node, %r{macports/trunk}) problem "MacPorts patches should specify a revision instead of trunk: #{patch_url}" end if regex_match_group(patch_url_node, %r{^http://trac\.macports\.org}) problem "Patches from MacPorts Trac should be https://, not http: #{patch_url}" do |corrector| correct = patch_url_node.source.gsub(%r{^http://}, "https://") corrector.replace(patch_url_node.source_range, correct) end end return unless regex_match_group(patch_url_node, %r{^http://bugs\.debian\.org}) problem "Patches from Debian should be https://, not http: #{patch_url}" do |corrector| correct = patch_url_node.source.gsub(%r{^http://}, "https://") corrector.replace(patch_url_node.source_range, correct) end end def inline_patch_problems(patch) return if !patch_data?(patch) || patch_end? offending_node(patch) problem "patch is missing '__END__'" end def_node_search :patch_data?, <<~AST (send nil? :patch (:sym :DATA)) AST sig { returns(T::Boolean) } def patch_end? /^__END__$/.match?(@full_source_content) end def offending_patch_end_node(node) @offensive_node = node @source_buf = source_buffer(node) @line_no = node.loc.last_line + 1 @column = 0 @length = 7 # "__END__".size @offense_source_range = source_range(@source_buf, @line_no, @column, @length) end end end end end
40.469697
112
0.601835
bf8ad22d6b3da880d603059832a8fea5b1be559f
1,114
class Game < ActiveRecord::Base belongs_to :game_type has_many :game_players, dependent: :destroy has_many :players, through: :game_players has_many :spoils, dependent: :destroy has_many :plates, through: :spoils belongs_to :owner, class_name: "Player", foreign_key: "player_id" has_many :bonuses, dependent: :destroy, class_name: 'Bonus' has_many :timelines, dependent: :destroy belongs_to :tour before_create :create_token scope :active, -> { where(is_completed: false)} scope :completed, -> { where(is_completed: true).order(:completed_at)} def to_s "#{game_type} #{title}" end def part_of_tour? return tour ? true : false end def collaborative? return true if game_type_id == GameType.find_by(name: 'Collaborate') end def combatitive? return true unless game_type_id == GameType.find_by(name: 'Collaborate') end def create_token self.token = SecureRandom.hex(4) end def active_players game_players.active end def complete! self.is_completed = true save end def total_points spoils.sum(:points) end end
20.254545
76
0.708259
6aae98534e68f18b1b1776bc6a572a0e905622b8
14,350
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "helper" require "gapic/grpc/service_stub" require "google/cloud/resourcemanager/v3/tag_values_pb" require "google/cloud/resourcemanager/v3/tag_values_services_pb" require "google/cloud/resource_manager/v3/tag_values" class ::Google::Cloud::ResourceManager::V3::TagValues::OperationsTest < Minitest::Test class ClientStub attr_accessor :call_rpc_count, :requests def initialize response, operation, &block @response = response @operation = operation @block = block @call_rpc_count = 0 @requests = [] end def call_rpc *args, **kwargs @call_rpc_count += 1 @requests << @block&.call(*args, **kwargs) yield @response, @operation if block_given? @response end end def test_list_operations # Create GRPC objects. grpc_response = ::Google::Longrunning::ListOperationsResponse.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. name = "hello world" filter = "hello world" page_size = 42 page_token = "hello world" list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :list_operations, name assert_kind_of ::Google::Longrunning::ListOperationsRequest, request assert_equal "hello world", request["name"] assert_equal "hello world", request["filter"] assert_equal 42, request["page_size"] assert_equal "hello world", request["page_token"] refute_nil options end Gapic::ServiceStub.stub :new, list_operations_client_stub do # Create client client = ::Google::Cloud::ResourceManager::V3::TagValues::Operations.new do |config| config.credentials = grpc_channel end # Use hash object client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token }) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use named arguments client.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use protobuf object client.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use hash object with options client.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Use protobuf object with options client.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| assert_kind_of Gapic::PagedEnumerable, response assert_equal grpc_response, response.response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, list_operations_client_stub.call_rpc_count end end def test_get_operation # Create GRPC objects. grpc_response = ::Google::Longrunning::Operation.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. name = "hello world" get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :get_operation, name assert_kind_of ::Google::Longrunning::GetOperationRequest, request assert_equal "hello world", request["name"] refute_nil options end Gapic::ServiceStub.stub :new, get_operation_client_stub do # Create client client = ::Google::Cloud::ResourceManager::V3::TagValues::Operations.new do |config| config.credentials = grpc_channel end # Use hash object client.get_operation({ name: name }) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use named arguments client.get_operation name: name do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use protobuf object client.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use hash object with options client.get_operation({ name: name }, grpc_options) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use protobuf object with options client.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, get_operation_client_stub.call_rpc_count end end def test_delete_operation # Create GRPC objects. grpc_response = ::Google::Protobuf::Empty.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. name = "hello world" delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :delete_operation, name assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request assert_equal "hello world", request["name"] refute_nil options end Gapic::ServiceStub.stub :new, delete_operation_client_stub do # Create client client = ::Google::Cloud::ResourceManager::V3::TagValues::Operations.new do |config| config.credentials = grpc_channel end # Use hash object client.delete_operation({ name: name }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments client.delete_operation name: name do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object client.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options client.delete_operation({ name: name }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options client.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, delete_operation_client_stub.call_rpc_count end end def test_cancel_operation # Create GRPC objects. grpc_response = ::Google::Protobuf::Empty.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. name = "hello world" cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :cancel_operation, name assert_kind_of ::Google::Longrunning::CancelOperationRequest, request assert_equal "hello world", request["name"] refute_nil options end Gapic::ServiceStub.stub :new, cancel_operation_client_stub do # Create client client = ::Google::Cloud::ResourceManager::V3::TagValues::Operations.new do |config| config.credentials = grpc_channel end # Use hash object client.cancel_operation({ name: name }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments client.cancel_operation name: name do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object client.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options client.cancel_operation({ name: name }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options client.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, cancel_operation_client_stub.call_rpc_count end end def test_wait_operation # Create GRPC objects. grpc_response = ::Google::Longrunning::Operation.new grpc_operation = GRPC::ActiveCall::Operation.new nil grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure grpc_options = {} # Create request parameters for a unary method. name = "hello world" timeout = {} wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :wait_operation, name assert_kind_of ::Google::Longrunning::WaitOperationRequest, request assert_equal "hello world", request["name"] assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] refute_nil options end Gapic::ServiceStub.stub :new, wait_operation_client_stub do # Create client client = ::Google::Cloud::ResourceManager::V3::TagValues::Operations.new do |config| config.credentials = grpc_channel end # Use hash object client.wait_operation({ name: name, timeout: timeout }) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use named arguments client.wait_operation name: name, timeout: timeout do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use protobuf object client.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use hash object with options client.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Use protobuf object with options client.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| assert_kind_of Gapic::Operation, response assert_equal grpc_response, response.grpc_op assert_equal grpc_operation, operation end # Verify method calls assert_equal 5, wait_operation_client_stub.call_rpc_count end end def test_configure grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure client = block_config = config = nil Gapic::ServiceStub.stub :new, nil do client = ::Google::Cloud::ResourceManager::V3::TagValues::Operations.new do |config| config.credentials = grpc_channel end end config = client.configure do |c| block_config = c end assert_same block_config, config assert_kind_of ::Google::Cloud::ResourceManager::V3::TagValues::Operations::Configuration, config end end
37.664042
191
0.715819
b93f8270101ca7d54a7d8e70b0a66cda2bb914fd
196
class CreatePizzas < ActiveRecord::Migration def change create_table :dishes do |t| t.string :name t.timestamps end add_index :dishes, :name, :unique => true end end
16.333333
45
0.653061
7ad4a51e4c979c84197ac7a7a75e846f7607f487
1,221
module Stupidedi module Versions module FunctionalGroups module ThirtyForty module SegmentDefs s = Schema e = ElementDefs r = ElementReqs W20 = s::SegmentDef.build(:W20, "Packing", "To specify packing details of the items shipped", e::E356 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)), e::E357 .simple_use(r::Relational, s::RepeatCount.bounded(1)), e::E355 .simple_use(r::Relational, s::RepeatCount.bounded(1)), e::E81 .simple_use(r::Relational, s::RepeatCount.bounded(1)), e::E187 .simple_use(r::Relational, s::RepeatCount.bounded(1)), e::E188 .simple_use(r::Relational, s::RepeatCount.bounded(1)), e::E395 .simple_use(r::Optional, s::RepeatCount.bounded(1)), e::E183 .simple_use(r::Relational, s::RepeatCount.bounded(1)), e::E355 .simple_use(r::Relational, s::RepeatCount.bounded(1)), e::E397 .simple_use(r::Optional, s::RepeatCount.bounded(1)), SyntaxNotes::P.build(2, 3), SyntaxNotes::P.build(4, 5, 6), SyntaxNotes::P.build(8, 9)) end end end end end
37
74
0.583129
5d0251aeb28e30e42c5b3cbc4d3a1c2eac73b35d
504
cask :v1 => 'selfcontrol' do version '2.0.2' sha256 'cd1fb7bd5524d81e784ad67f8639cfb836261f07d7e6db75458a398b17f9a1f9' url "http://downloads.selfcontrolapp.com/SelfControl-#{version}.zip" appcast 'http://selfcontrolapp.com/SelfControlAppcast.xml', :sha256 => '05d48c097c072ffd92d4d938b6984c8a09f446a556dc30acf25e3896cc3e0826' homepage 'http://selfcontrolapp.com/' license :unknown app 'SelfControl.app' zap :delete => '~/Library/Preferences/org.eyebeam.SelfControl.plist' end
36
87
0.769841
87a5498bc3e9f65bfe5962958873d67da5df72eb
1,685
require 'chef/mixin/shell_out' include Chef::Mixin::ShellOut action :append do if new_resource.rule.kind_of?(String) rules = [new_resource.rule] else rules = new_resource.rule end if not node["simple_iptables"]["chains"][new_resource.table].include?(new_resource.chain) node.set["simple_iptables"]["chains"][new_resource.table] = node["simple_iptables"]["chains"][new_resource.table].dup << new_resource.chain unless ["PREROUTING", "INPUT", "FORWARD", "OUTPUT", "POSTROUTING"].include?(new_resource.chain) unless new_resource.chain == new_resource.direction node.set["simple_iptables"]["rules"][new_resource.table] << {:rule => "-A #{new_resource.direction} --jump #{new_resource.chain}", :weight => new_resource.weight} end end # Then apply the rules to the node rules.each do |rule| new_rule = rule_string(new_resource, rule, false) if not node["simple_iptables"]["rules"][new_resource.table].include?({:rule => new_rule, :weight => new_resource.weight}) node.set["simple_iptables"]["rules"][new_resource.table] << {:rule => new_rule, :weight => new_resource.weight} node.set["simple_iptables"]["rules"][new_resource.table].sort! {|a,b| a[:weight] <=> b[:weight]} new_resource.updated_by_last_action(true) Chef::Log.debug("added rule '#{new_rule}'") else Chef::Log.debug("ignoring duplicate simple_iptables_rule '#{new_rule}'") end end end def rule_string(new_resource, rule, include_table) jump = new_resource.jump ? "--jump #{new_resource.jump} " : "" table = include_table ? "--table #{new_resource.table} " : "" rule = "#{table}-A #{new_resource.chain} #{jump}#{rule}" rule end
43.205128
239
0.694955
abe13266a33ba90fa7974ef550abdd5aa5681f98
1,153
# Creates the primary channel through which Partners submit requests, which occurs via the API class API::V1::PartnerRequestsController < ApplicationController skip_before_action :verify_authenticity_token skip_before_action :authenticate_user! skip_before_action :authorize_user respond_to :json def create return head :forbidden unless api_key_valid? request = Request.new(request_params) if request.save render json: request, status: :created else render json: request.errors, status: :bad_request end end def show return head :forbidden unless api_key_valid? organization = Organization.find(params[:id]) render json: organization.valid_items, status: :ok rescue ActiveRecord::RecordNotFound => e render json: { error: e.message }, status: :bad_request end private def api_key_valid? return true if Rails.env.development? request.headers["X-Api-Key"] == ENV["PARTNER_KEY"] end def request_params params.require(:request).permit(:organization_id, :partner_id, :comments, request_items: [:item_id, :quantity]) end end
27.452381
94
0.718994
87ccf4c8b49dbcca8935b500313064c4cfa7c18e
3,763
require "bundler" require "omnibus" require_relative "../build-chef-dk-gem" require_relative "../../../../tasks/gemfile_util" module BuildChefDKGem class GemInstallSoftwareDef def self.define(software, software_filename) new(software, software_filename).send(:define) end include BuildChefDKGem include Omnibus::Logging protected def initialize(software, software_filename) @software = software @software_filename = software_filename end attr_reader :software, :software_filename def define software.name "#{File.basename(software_filename)[0..-4]}" software.default_version gem_version # If the source directory for building stuff changes, tell omnibus to # de-cache us software.source path: File.expand_path("../..", __FILE__) # ruby and bundler and friends software.dependency "ruby" software.dependency "rubygems" gem_name = self.gem_name gem_version = self.gem_version gem_metadata = self.gem_metadata lockfile_path = self.lockfile_path software.build do extend BuildChefDKGem if gem_version == "<skip>" if gem_metadata block do log.info(log_key) { "#{gem_name} has source #{gem_metadata} in #{lockfile_path}. We only cache rubygems.org installs in omnibus to keep things simple. The chef-dk step will build #{gem_name} ..." } end else block do log.info(log_key) { "#{gem_name} is not in the #{lockfile_path}. This can happen if your OS doesn't build it, or if chef-dk no longer depends on it. Skipping ..." } end end else block do log.info(log_key) { "Found version #{gem_version} of #{gem_name} in #{lockfile_path}. Building early to take advantage of omnibus caching ..." } end gem "install #{gem_name} -v #{gem_version} --no-doc --no-ri --ignore-dependencies --verbose -- #{install_args_for(gem_name)}", env: env end end end # Path above omnibus (where Gemfile is) def root_path File.expand_path("../../../../..", __FILE__) end def gemfile_path File.join(root_path, "Gemfile") end def lockfile_path "#{gemfile_path}.lock" end def gem_name @gem_name ||= begin # File must be named chef-<gemname>.rb # Will look at chef/Gemfile.lock and install that version of the gem using "gem install" # (and only that version) if File.basename(software_filename) =~ /^chef-dk-gem-(.+)\.rb$/ $1 else raise "#{software_filename} must be named chef-<gemname>.rb to build a gem automatically" end end end def gem_metadata @gem_metadata ||= begin bundle = GemfileUtil::Bundle.parse(gemfile_path, lockfile_path) result = bundle.gems[gem_name] if result if bundle.select_gems(without_groups: without_groups).include?(gem_name) log.info(software.name) { "Using #{gem_name} version #{result[:version]} from #{gemfile_path}" } result else log.info(software.name) { "#{gem_name} not loaded from #{gemfile_path} because it was only in groups #{without_groups.join(", ")}. Skipping ..." } nil end else log.info(software.name) { "#{gem_name} was not found in #{lockfile_path}. Skipping ..." } nil end end end def gem_version @gem_version ||= begin if gem_metadata && URI(gem_metadata[:source]) == URI("https://rubygems.org/") gem_metadata[:version] else "<skip>" end end end end end
31.621849
211
0.615732
33d21e4855feba39e729dce74d21ef8f23e89e3a
138
require("spec_helper") describe(Ingredient) do it { should have_and_belong_to_many(:recipes) } it { should have_many(:amounts) } end
19.714286
49
0.746377
21cb0bf2e958f0bf5b8e0843d34c1ab543409e64
225
class Venue < ActiveRecord::Base validates_presence_of(:name) before_save(:capitalize_name) has_and_belongs_to_many(:bands) private define_method(:capitalize_name) do self.name=(name().capitalize()) end end
18.75
36
0.755556
013a85fbef3803b1321fc5f41498333e2832ce51
954
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. module Google module Apis module DoubleclickbidmanagerV1 # Version of the google-apis-doubleclickbidmanager_v1 gem GEM_VERSION = "0.4.0" # Version of the code generator used to generate this client GENERATOR_VERSION = "0.2.0" # Revision of the discovery document this client was generated from REVISION = "20210420" end end end
32.896552
74
0.735849
d5b64ee1ce9da1c7f79fa635e1d77e5a5d259392
1,511
module Riddler class Content include ::Enumerable include ::Riddler::Concerns::Includeable include ::Riddler::Concerns::Logging def self.content_type self::CONTENT_TYPE end def self.type self::TYPE end def self.from_definition definition, context={} context = ::Riddler::Context.new_from context case definition["content_type"].to_s.downcase when "Element" ::Riddler::Element.for definition, context when "Step" ::Riddler::Step.for definition, context end end def initialize definition, context @definition = definition @context = context end def container definition["container"] end def container_location container&.location end def content_type self.class.content_type end def id definition["id"] end def journey @journey = context["journey"] end def name definition["name"] end def type self.class.type end # Should this piece of content be shown to the participant? def render? include? end # Visitors def each &block ::Riddler::Visitors::Each.new(block).accept self end def to_dot ::Riddler::Visitors::Dot.new.accept self end def enter debug "enter", content_type: content_type, id: id, journey_id: journey.id ::Riddler::Messaging.producer.publish "enter", {id: id, journey_id: journey.id} end end end
19.126582
85
0.629385
3905f86a7cfaf10ed8f7c6ab2176f6eec2401758
4,654
# encoding: UTF-8 require 'faraday' require 'faraday_middleware' require 'yajl' module Citibike # Class representing a Faraday instance used to connect to the # actual Citibike API, takes a variety of options class Connection def initialize(opts = {}) @options = { adapter: Faraday.default_adapter, headers: { 'Accept' => 'text/plain, text/html, text/*, application/json; charset=utf-8', 'UserAgent' => 'Citibike Gem' }, proxy: nil, ssl: { verify: false }, debug: false, test: false, stubs: nil, raw: false, format_path: false, format: :json, url: 'http://appservices.citibikenyc.com/' } # Reject any keys that aren't already in @options @options.keys.each do |k| @options[k] = opts[k] if opts.key?(k) end end def http @http ||= Faraday.new(@options) do |connection| connection.use Faraday::Request::UrlEncoded connection.use Faraday::Response::ParseJson unless @options[:raw] connection.use Faraday::Response::Logger if @options[:debug] connection.use Faraday::Response::RaiseError if @options[:test] connection.adapter(@options[:adapter], @options[:stubs]) else connection.adapter(@options[:adapter]) end end end # # Makes a request to the API through the set up interface # @param method [Symbol] [:get, :post, :put, :delete] # @param path [String] [The path to request from the server] # @param options = {} [Optional Hash] [Args to include in the request] # # @return [String or Hash] [The result of the request, generally a hash] def request(method, path, options = {}) if @options[:format_path] path = format_path(path, @options[:format]) end response = self.http.send(method) do |request| case method when :get, :delete request.url(path, options) when :post, :put request.path = path request.body = options unless options.empty? end end response.body end private def format_path(path, format) if path =~ /\./ path else [path, format].map(&:to_s).compact.join('.') end end end # Class representing a Faraday instance used to connect to the # alternative Citibike API, takes a variety of options class AltConnection def initialize(opts = {}) @options = { adapter: Faraday.default_adapter, headers: { 'Accept' => 'text/plain, text/html, text/*, application/json; charset=utf-8', 'UserAgent' => 'Citibike Gem' }, proxy: nil, ssl: { verify: false }, debug: false, test: false, stubs: nil, raw: false, format_path: false, format: :json, url: 'http://citibikenyc.com/' } # Reject any keys that aren't already in @options @options.keys.each do |k| @options[k] = opts[k] if opts.key?(k) end end def http @http ||= Faraday.new(@options) do |connection| connection.use Faraday::Request::UrlEncoded connection.use Faraday::Response::ParseJson unless @options[:raw] connection.use Faraday::Response::Logger if @options[:debug] connection.use Faraday::Response::RaiseError if @options[:test] connection.adapter(@options[:adapter], @options[:stubs]) else connection.adapter(@options[:adapter]) end end end # # Makes a request to the API through the set up interface # @param method [Symbol] [:get, :post, :put, :delete] # @param path [String] [The path to request from the server] # @param options = {} [Optional Hash] [Args to include in the request] # # @return [String or Hash] [The result of the request, generally a hash] def request(method, path, options = {}) if @options[:format_path] path = format_path(path, @options[:format]) end response = self.http.send(method) do |request| case method when :get, :delete request.url(path, options) when :post, :put request.path = path request.body = options unless options.empty? end end response.body end private def format_path(path, format) if path =~ /\./ path else [path, format].map(&:to_s).compact.join('.') end end end end
28.206061
87
0.576708
ff185fc690ea5179566fead4c3f00f2298b9acdc
197
class CleanupGoogleAccountColumns < ActiveRecord::Migration def up remove_column(:google_accounts, :last_ga_login_request_at) remove_column(:google_accounts, :last_google_data) end end
28.142857
62
0.812183
7ad14ccefd0549701409e3ee3aec234c050cc525
2,960
require('capybara/rspec') require('./app') require('./spec/spec_helper') Capybara.app = Sinatra::Application set(:show_exceptions, false) RSpec.configure do |config| config.after(:each) do Task.all().each() do |task| task.destroy() end List.all().each() do |list| list.destroy() end end end describe('adding a list', {:type => :feature}) do it('allows the user to add multiple lists to a board') do visit('/') fill_in('name', :with => 'First List') click_button('save-new-list') expect(page).to(have_content('First List')) fill_in('name', :with => 'Second List') click_button('save-new-list') expect(page).to(have_content('Second List')) end end describe('deleting a list', {:type => :feature}) do it('allows the user to delete a list') do test_list = create_test_list() visit('/') click_on("edit-#{test_list.id()}") click_button("delete-#{test_list.id()}") expect(page).not_to(have_content('First List')) end end describe('adding a task', {:type => :feature}) do it('allows the user to add multiple tasks to a list') do test_list = create_test_list() visit('/') fill_in("task-description-for-#{test_list.id()}", :with => 'Test task') click_button("save-task-to-#{test_list.id()}") expect(page).to(have_content('Test task')) fill_in("task-description-for-#{test_list.id()}", :with => 'Test task 2') click_button("save-task-to-#{test_list.id()}") expect(page).to(have_content('Test task 2')) end end describe('moving a task', {:type => :feature}) do it('allows the user to move a task to another list') do test_list = create_test_list() second_list = create_second_list() test_task = create_test_task(test_list.id()) visit('/') click_on("edit-#{test_list.id()}") click_button("Move to #{second_list.name()}") expect(second_list.tasks()).to(eq([test_task])) end end describe('deleting a task', {:type => :feature}) do it('allows the user to delete a task') do test_list = create_test_list() test_task = create_test_task(test_list.id()) visit('/') click_on("edit-#{test_task.id()}") click_button("delete-#{test_task.id()}") expect(page).not_to(have_content('test task')) end end describe('completing a task', {:type => :feature}) do it('allows the user to hide completed tasks') do test_list = create_test_list() test_task = create_test_task(test_list.id()) visit('/') click_button('Mark as Done') expect(page).not_to(have_content('test task')) expect(page).to(have_content('Show completed tasks')) end it('allows the user to show completed tasks') do test_list = create_test_list() test_task = create_test_task(test_list.id()) visit('/') click_button('Mark as Done') click_button('Show completed tasks') expect(page).to(have_content('test task')) expect(page).to(have_content('Hide completed tasks')) end end
30.515464
77
0.659459
f70c086fa0c2cf931c140e70e2f2b31d78e36223
1,103
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{good_sort} s.version = "0.2.4" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Jason King"] s.date = %q{2010-02-12} s.email = %q{[email protected]} s.extra_rdoc_files = ["README.markdown", "LICENSE"] s.files = ["README.markdown", "VERSION.yml", "lib/good_sort", "lib/good_sort/sorter.rb", "lib/good_sort/view_helpers.rb", "lib/good_sort/will_paginate.rb", "lib/good_sort.rb", "test/sorter_test.rb", "test/view_helpers_test.rb", "test/test_helper.rb", "LICENSE"] s.has_rdoc = true s.homepage = %q{http://github.com/JasonKing/good_sort} s.rdoc_options = ["--inline-source", "--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.1} s.summary = %q{TODO} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 2 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then else end else end end
36.766667
263
0.68631
e92bfb5e8c30222fff75cb84799db65ba756c3eb
108
# frozen_string_literal: true class InlineCustomFormBuilder < CustomFormBuilder namespace InlineForm end
18
49
0.851852
793a3aa1ec01650794acf945e70037082e89b026
3,293
# rubocop:disable Naming/VariableNumber module Swagger module V1 class Errors def self.definitions # rubocop:disable Metrics/MethodLength { error_400: { type: 'object', properties: { error: { type: 'string', example: 'Bad Request' } } }, error_401: { type: 'object', properties: { error: { type: 'string', example: 'Unauthorized' } } }, error_403: { type: 'object', properties: { error: { type: 'string', example: 'Forbidden' } } }, error_404: { type: 'object', properties: { errors: { type: 'array', items: { type: 'object', properties: { title: { type: 'string', example: 'Record not found' }, detail: { type: 'string', example: 'The record identified by 123 could not be found.' }, code: { type: 'string', example: JSONAPI::RECORD_NOT_FOUND }, status: { type: 'string', example: '404' } } } } } }, error_406: { type: 'object', properties: { errors: { type: 'array', items: { type: 'object', properties: { title: { type: 'string', example: 'Not acceptable' }, detail: { type: 'string', example: "All requests must use the 'application/vnd.api+json' Accept without media type parameters. This request specified 'application/json'." }, # rubocop:disable Layout/LineLength code: { type: 'string', example: JSONAPI::NOT_ACCEPTABLE }, status: { type: 'string', example: '406' } } } } } }, error_415: { type: 'object', properties: { errors: { type: 'array', items: { type: 'object', properties: { title: { type: 'string', example: 'Unsupported media type' }, detail: { type: 'string', example: "All requests that create or update must use the 'application/vnd.api+json' Content-Type. This request specified 'application/json'." }, # rubocop:disable Layout/LineLength code: { type: 'string', example: JSONAPI::UNSUPPORTED_MEDIA_TYPE }, status: { type: 'string', example: '415' } } } } } }, error_422: { type: 'object', properties: { error: { type: 'string', example: 'Invalid request' } } }, error_423: { type: 'object', properties: { error: { type: 'string', example: 'Record Locked' } } } } end end end end # rubocop:enable Naming/VariableNumber
33.602041
213
0.422411