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
5d4bf9406331d63ca7e113bd1b09e690e3f9dd7e
1,545
require 'spec_helper' describe_recipe 'kubernetes-cluster::flanneld' do context 'with default node attributes' do let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) } it { expect(chef_run).to enable_service('flanneld') } it { expect(chef_run).to_not enable_service('docker') } it { expect(chef_run).to_not start_service('docker') } it { expect(chef_run).to_not enable_service('kubelet') } it { expect(chef_run).to_not start_service('kubelet') } it { expect(chef_run).to_not run_execute('redo-docker-bridge') } it 'should not run execute "redo-docker-bridge"' do expect(chef_run).to_not run_execute('redo-docker-bridge').with( command: 'ifconfig docker0 down; brctl delbr docker0 adsf' ) # resource = chef_run.execute('redo-docker-bridg') # expect(resource).to notify('service[docker]').to(:restart).immediately end it 'should create template "/etc/sysconfig/flanneld"' do expect(chef_run).to create_template('/etc/sysconfig/flanneld').with( mode: '0640', source: 'flannel-flanneld.erb', variables: { etcd_client_port: '2379', etcd_cert_dir: '/etc/kubernetes/secrets' } ) resource = chef_run.template('/etc/sysconfig/flanneld') expect(resource).to notify('service[flanneld]').to(:restart).immediately expect(resource).to notify('execute[redo-docker-bridge]').to(:run).delayed expect(resource).to notify('service[kubelet]').to(:restart).delayed end end end
40.657895
80
0.680906
62c267fc7246621a2429c39fb34985c5d9d5259d
207
module Evdev module FFI class LogData < ::FFI::Struct layout( :priority, LogPriority, :global_handler, LogFuncT, :device_handler, DeviceLogFuncT ) end end end
17.25
39
0.603865
8774f6a14c18dbcc83f0b4cea2f5e6452bd0d9c2
214
require 'comment_extractor/extractor' class CommentExtractor::Extractor::Css < CommentExtractor::Extractor filename /\.css$/ filetype 'css' include CommentExtractor::Extractor::Concerns::SlashExtractor end
23.777778
68
0.794393
b983bdf9f326aaa5fd495a3ca981df3d15debb98
2,182
# frozen_string_literal: true # See https://github.com/shakacode/react_on_rails/blob/master/docs/basics/configuration.md # for many more options. ReactOnRails.configure do |config| # This configures the script to run to build the production assets by webpack. Set this to nil # if you don't want react_on_rails building this file for you. config.build_production_command = "RAILS_ENV=production NODE_ENV=production bin/webpack" ################################################################################ ################################################################################ # TEST CONFIGURATION OPTIONS # Below options are used with the use of this test helper: # ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config) ################################################################################ # If you are using this in your spec_helper.rb (or rails_helper.rb): # # ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config) # # with rspec then this controls what yarn command is run # to automatically refresh your webpack assets on every test run. # config.build_test_command = "RAILS_ENV=test bin/webpack" ################################################################################ ################################################################################ # SERVER RENDERING OPTIONS ################################################################################ # This is the file used for server rendering of React when using `(prerender: true)` # If you are never using server rendering, you should set this to "". # Note, there is only one server bundle, unlike JavaScript where you want to minimize the size # of the JS sent to the client. For the server rendering, React on Rails creates a pool of # JavaScript execution instances which should handle any component requested. # # While you may configure this to be the same as your client bundle file, this file is typically # different. You should have ONE server bundle which can create all of your server rendered # React components. # config.server_bundle_js_file = "filter-home-bundle.js" end
50.744186
98
0.593951
87b1a3e1441d0325ad2754722948b06dd9234996
1,181
module PaginationHelper def paginate(base_url,collection) set_pagination_params count = collection.count links = generate_links(base_url,count,@per_page,@page) response.headers["Link"] = links.join(",") if !links.empty? collection.skip(@offset).limit(@per_page) end def generate_links(base_url,count,per_page,page) links = [] total_pages = count/per_page total_pages = total_pages +1 if (count%per_page ) != 0 next_page = page < total_pages prev_page = page > 1 && total_pages != 1 links << generate_link(base_url,1,per_page,"first") if total_pages > 1 links << generate_link(base_url,total_pages,per_page,"last") if total_pages != 1 links << generate_link(base_url,page-1,per_page,"prev") if prev_page links << generate_link(base_url,page+1,per_page,"next") if next_page links end def generate_link(base_url, page, per_page, rel) %{<#{base_url}?page=#{page}&per_page=#{per_page}>; rel="#{rel}" } end def set_pagination_params @page = (params[:page] || 1).to_i @per_page = (params[:per_page] || 100).to_i @per_page = 200 if @per_page > 200 @offset = (@page-1)*@per_page end end
31.078947
84
0.682472
bb3137cfe8ae94a1f347b114af497980cff4b493
1,651
require 'test_helper' class UsersControllerTest < ActionDispatch::IntegrationTest def setup @user = users(:michael) @other_user = users(:archer) end test "should redirect index when not logged in" do get users_path assert_redirected_to login_url end test "should get new" do get signup_path assert_response :success end test "should redirect edit when not logged in" do get edit_user_path(@user) assert_not flash.empty? assert_redirected_to login_url end test "should redirect update when not logged in" do patch user_path(@user), params: { user: { name: @user.name, email: @user.email } } assert_not flash.empty? assert_redirected_to login_url end test "should not allow the admin attribute to be edited via the web" do log_in_as(@other_user) assert_not @other_user.admin? patch user_path(@other_user), params: { user: { password: @other_user.password, password_confirmation: @other_user.password_confirmation, admin: true } } assert_not @other_user.reload.admin? end test "should redirect destroy when not logged in" do assert_no_difference 'User.count' do delete user_path(@user) end assert_redirected_to login_url end test "should redirect destroy when logged in as a non-admin" do log_in_as(@other_user) assert_no_difference 'User.count' do delete user_path(@user) end assert_redirected_to root_url end end
28.964912
101
0.640824
4acf4f824a8e78f5998cade0453335fe01044e64
292
cask 'subtools' do version '1.0.1' sha256 '2557e042d1df12dacfe5d87ff6c96d252721f3d10a26dbb7f8dc2e3ac6248e91' url "http://www.emmgunn.com/downloads/subtools#{version}.zip" name 'SUBtools' homepage 'http://www.emmgunn.com/subtools-home/' app "subtools#{version}/SUBtools.app" end
26.545455
75
0.760274
7a2aad1a1add7a90e3299f8ec237f432b8fe3404
759
require_relative "boot" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module CampClubApp class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 6.1 config.assets.initialize_on_precompile = false # Configuration for the application, engines, and railties goes here. # # These settings can be overridden in specific environments using the files # in config/environments, which are processed later. # # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") end end
31.625
79
0.743083
e9962624465046a6e444b4e28c158b43731bf4d8
1,869
class Pulumi < Formula desc "Cloud native development platform" homepage "https://pulumi.io/" url "https://github.com/pulumi/pulumi.git", tag: "v2.21.2", revision: "543cbe194c17a515eb682b9dd105b0dcfd30a810" license "Apache-2.0" head "https://github.com/pulumi/pulumi.git" bottle do sha256 cellar: :any_skip_relocation, arm64_big_sur: "d4402df0189e33c9f72d232e8ce0cd123acbf92f1cdbd2f721b382511e57c567" sha256 cellar: :any_skip_relocation, big_sur: "a3bbd55fba0761e7c523c7eb4f4aa6260f1231531310615168aeaedadcce828d" sha256 cellar: :any_skip_relocation, catalina: "652b82433a44da52b9522dfa331c6847baca1722cd97030e8ffe39b924968050" sha256 cellar: :any_skip_relocation, mojave: "6c5197e7b9199619ab9f8abb58d0c878def9ade8f3e6d59c82f5c999b3f3e3e9" sha256 cellar: :any_skip_relocation, x86_64_linux: "e04f9013c1a9b666a65514bd15deadc2dae688db5b13f7f8a8e87116488311d6" end depends_on "go" => :build def install cd "./sdk" do system "go", "mod", "download" end cd "./pkg" do system "go", "mod", "download" end system "make", "brew" bin.install Dir["#{ENV["GOPATH"]}/bin/pulumi*"] # Install shell completions (bash_completion/"pulumi.bash").write Utils.safe_popen_read(bin/"pulumi", "gen-completion", "bash") (zsh_completion/"_pulumi").write Utils.safe_popen_read(bin/"pulumi", "gen-completion", "zsh") (fish_completion/"pulumi.fish").write Utils.safe_popen_read(bin/"pulumi", "gen-completion", "fish") end test do ENV["PULUMI_ACCESS_TOKEN"] = "local://" ENV["PULUMI_TEMPLATE_PATH"] = testpath/"templates" system "#{bin}/pulumi", "new", "aws-typescript", "--generate-only", "--force", "-y" assert_predicate testpath/"Pulumi.yaml", :exist?, "Project was not created" end end
40.630435
122
0.699304
21355973be18d86a4f732ee7fbdeb379cfb2e309
4,970
## # Subclass the We Enhance IT form builder for the autism funding application. class AutismFundingFormBuilder < WeitFormBuilder # Find formatters.rb in app/lib include Formatters # def bootstrap_form_for(object, options = {}, &block) # super(object, options, &block) # end # Returns a check_box tag def check_box(method, options = {}, checked_value = "1", unchecked_value = "0") process_width(options) { super } end # provides a set of radio buttons from a provided collection def collection_radio_buttons(method, collection, value_method, text_method, options = {}, &block) process_width(options) { super } end # Provide a drop-down select from a provided collection def collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) process_width(options) { super } end ## # Collection select with our st # If column_width: n or :col_width: n is given as an option, wrap in a # Bootstrap grid column. def collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) process_options(method, options) process_width(options) { super } end ## # Format a currency field. def currency_field(method, options = {}) options = process_options(method, options) options[:value] ||= @template.number_to_currency(object.send(method), unit: "") process_width(options) { text_field(method, options) } end ## # Format a date field. # If column_width: n or :col_width: n is given as an option, wrap in a # Bootstrap grid column. def date_field(method, options = {}) process_width(options) { super } end ## # Format a form group. # If column_width: n or :col_width: n is given as an option, wrap in a # Bootstrap grid column. # I'm just guessing about the arguments to this one, since it's not a Rails # helper, but rather a Bootstrap Forms helper. # pmc: 20161110 - added default empty hash for options def form_group(method, options = {}, &block) process_width(options) { super } end ## # Format a number field. # If column_width: n or :col_width: n is given as an option, wrap in a # Bootstrap grid column. def number_field(method, options = {}) options = process_options(method, options) process_width(options) { super } end ## # Format a phone number field and show it with punctuation def phone_field(method, options = {}) options = process_options(method, options) options[:value] ||= @template.number_to_phone(object.send(method), area_code: true) process_width(options) { super } end ## # Format a Canadian postal code field, or leave it untouched it if doesn't # look like a Canadian postal code def postal_code_field(method, options = {}) options = process_options(method, options) options[:value] ||= format_postal_code(object.send(method)) text_field(method, options) end ## # Output radio buttons that can't be changed, effectively giving a disabled # radio button group. # http://stackoverflow.com/questions/1953017/why-cant-radio-buttons-be-readonly def radio_button_static(method, tag_value, options = {}) options[:disabled] = true unless object.send(method).to_s == tag_value radio_button(method, tag_value, options) end ## # Format a select field. # If column_width: n or :col_width: n is given as an option, wrap in a # Bootstrap grid column. def select(method, choices = nil, options = {}, html_options = {}, &block) process_options(method, options) process_width(options) { super } end ## # Static control # If column_width: n or :col_width: n is given as an option, wrap in a # Bootstrap grid column. # If `lstrip: string` is given as an option, strip the string from the # left side of the label. # Set the placeholder to the label, unless :placeholder is given in the # options. def static_control(method, options = {}) options = process_options(method, options) process_width(options) { super } end ## # Format a text field def text_field(method, options = {}) options = process_options(method, options) process_width(options) { super } end private def format_label(field, options = {}) label = field.class == String ? field : field.to_s.titlecase label = label.sub(/\A#{options[:lstrip]}\s*/, "") if options[:lstrip] label end def process_options(method, options = {}) label_modifier = options.delete(:lstrip) options[:label] ||= format_label(method, lstrip: label_modifier) options[:placeholder] ||= options[:label] options end ## # Ugh. This modifies the options, which might not be usable in many # cases. def process_width(options = {}) width = (options.delete(:column_width) || options.delete(:col_width)) if width content_tag :div, yield, class: "col-md-#{width}" else yield end end end
31.0625
103
0.688732
b9bdbfddf835a5c1b0fb274d42cbfa1ce579c2c4
5,012
require 'xcodeproj' module Pod class ProjectManipulator attr_reader :configurator, :xcodeproj_path, :platform, :remove_demo_target, :string_replacements, :prefix def self.perform(options) new(options).perform end def initialize(options) @xcodeproj_path = options.fetch(:xcodeproj_path) @configurator = options.fetch(:configurator) @platform = options.fetch(:platform) @remove_demo_target = options.fetch(:remove_demo_project) @prefix = options.fetch(:prefix) end def run @string_replacements = { "PROJECT_OWNER" => @configurator.user_name, "TODAYS_DATE" => @configurator.date, "TODAYS_YEAR" => @configurator.year, "PROJECT" => @configurator.pod_name, "CPD" => @prefix } replace_internal_project_settings @project = Xcodeproj::Project.open(@xcodeproj_path) add_podspec_metadata remove_demo_project if @remove_demo_target @project.save rename_files rename_project_folder end def add_podspec_metadata project_metadata_item = @project.root_object.main_group.children.select { |group| group.name == "Podspec Metadata" }.first project_metadata_item.new_file "../" + @configurator.pod_name + ".podspec" project_metadata_item.new_file "../README.md" project_metadata_item.new_file "../LICENSE" end def remove_demo_project app_project = @project.native_targets.find { |target| target.product_type == "com.apple.product-type.application" } test_target = @project.native_targets.find { |target| target.product_type == "com.apple.product-type.bundle.unit-test" } test_target.name = @configurator.pod_name + "_Tests" # Remove the implicit dependency on the app test_dependency = test_target.dependencies.first test_dependency.remove_from_project app_project.remove_from_project # Remove the build target on the unit tests test_target.build_configuration_list.build_configurations.each do |build_config| build_config.build_settings.delete "BUNDLE_LOADER" end # Remove the references in xcode project_app_group = @project.root_object.main_group.children.select { |group| group.display_name.end_with? @configurator.pod_name }.first project_app_group.remove_from_project # Remove the product reference product = @project.products.select { |product| product.path == @configurator.pod_name + "_Example.app" }.first product.remove_from_project # Remove the actual folder + files for both projects `rm -rf templates/ios/Example/PROJECT` `rm -rf templates/swift/Example/PROJECT` # Replace the Podfile with a simpler one with only one target podfile_path = project_folder + "/Podfile" podfile_text = <<-RUBY use_frameworks! target '#{test_target.name}' do pod '#{@configurator.pod_name}', :path => '../' ${INCLUDED_PODS} end RUBY File.open(podfile_path, "w") { |file| file.puts podfile_text } end def project_folder File.dirname @xcodeproj_path end def rename_files # shared schemes have project specific names scheme_path = project_folder + "/PROJECT.xcodeproj/xcshareddata/xcschemes/" File.rename(scheme_path + "PROJECT.xcscheme", scheme_path + @configurator.pod_name + "-Example.xcscheme") # rename xcproject File.rename(project_folder + "/PROJECT.xcodeproj", project_folder + "/" + @configurator.pod_name + ".xcodeproj") unless @remove_demo_target # change app file prefixes ["CPDAppDelegate.h", "CPDAppDelegate.m", "CPDViewController.h", "CPDViewController.m","CPDRootViewController.h","CPDRootViewController.m","CPDFunctionTarget.h","CPDFunctionTarget.m","CPDFunctionReceive.h","CPDFunctionReceive.m"].each do |file| before = project_folder + "/PROJECT/" + file next unless File.exists? before after = project_folder + "/PROJECT/" + file.gsub("CPD", prefix) File.rename before, after end # rename project related files ["PROJECT-Info.plist", "PROJECT-Prefix.pch", "PROJECT.entitlements"].each do |file| before = project_folder + "/PROJECT/" + file next unless File.exists? before after = project_folder + "/PROJECT/" + file.gsub("PROJECT", @configurator.pod_name) File.rename before, after end end end def rename_project_folder if Dir.exist? project_folder + "/PROJECT" File.rename(project_folder + "/PROJECT", project_folder + "/" + @configurator.pod_name) end end def replace_internal_project_settings Dir.glob(project_folder + "/**/**/**/**").each do |name| next if Dir.exists? name text = File.read(name) for find, replace in @string_replacements text = text.gsub(find, replace) end File.open(name, "w") { |file| file.puts text } end end end end
35.295775
251
0.680168
3392149158a0c71b39bfd66306e4d0e83e4d2b2d
2,463
Website::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_controller.perform_caching = true # Defaults to nil and saved in location specified by config.assets.prefix # config.assets.manifest = YOUR_PATH # Specifies the header that your server uses for sending files # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # See everything in the log (default is :info) # config.log_level = :debug # Prepend all log lines with the following tags # config.log_tags = [ :subdomain, :uuid ] # Use a different logger for distributed setups # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production # config.cache_store = :mem_cache_store # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) # config.assets.precompile += %w( home ) # Disable delivery errors, bad email addresses will be ignored config.action_mailer.raise_delivery_errors = false config.action_mailer.delivery_method = :smtp ActionMailer::Base.smtp_settings = { address: "smtp.gmail.com", port: 587, user_name: "[email protected]", password: YAML.load_file(Rails.root.join("config/smtp.yml"))[Rails.env]["gmail_pass"], authentication: "plain", enable_starttls_auto: true } # Enable threaded mode # config.threadsafe! # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation can not be found) config.i18n.fallbacks = true # Send deprecation notices to registered listeners config.active_support.deprecation = :notify # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) # config.active_record.auto_explain_threshold_in_seconds = 0.5 end
36.761194
104
0.752335
01839d19d861a5ea69c1c430a9adab62dad25da6
17,074
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'enumerator' require 'nbtfile' require 'stringio' require 'zlib' shared_examples_for "readers and writers" do Tokens = NBTFile::Tokens unless defined? Tokens Types = NBTFile::Types unless defined? Types def self.a_reader_or_writer(desc, serialized, tokens, tree) it desc do serialized._nbtfile_force_encoding("BINARY") check_reader_or_writer(serialized, tokens, tree) end end a_reader_or_writer "should handle basic documents", "\x0a\x00\x03foo" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new()] a_reader_or_writer "should treat integers as signed", "\x0a\x00\x03foo" \ "\x03\x00\x03bar\xff\xff\xff\xfe" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Int["bar", -2], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Int.new(-2)})] a_reader_or_writer "should handle integer fields", "\x0a\x00\x03foo" \ "\x03\x00\x03bar\x01\x02\x03\x04" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Int["bar", 0x01020304], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Int.new(0x01020304)})] a_reader_or_writer "should handle short fields", "\x0a\x00\x03foo" \ "\x02\x00\x03bar\x4e\x5a" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Short["bar", 0x4e5a], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Short.new(0x4e5a)})] a_reader_or_writer "should handle byte fields", "\x0a\x00\x03foo" \ "\x01\x00\x03bar\x4e" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Byte["bar", 0x4e], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Byte.new(0x4e)})] a_reader_or_writer "should handle string fields", "\x0a\x00\x03foo" \ "\x08\x00\x03bar\x00\x04hoge" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_String["bar", "hoge"], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::String.new("hoge")})] a_reader_or_writer "should handle byte array fields", "\x0a\x00\x03foo" \ "\x07\x00\x03bar\x00\x00\x00\x05\x01\x02\x03\x04\x05" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Byte_Array["bar", "\x01\x02\x03\x04\x05"], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::ByteArray.new("\x01\x02\x03\x04\x05")})] a_reader_or_writer "should handle long fields", "\x0a\x00\x03foo" \ "\x04\x00\x03bar\x01\x02\x03\x04\x05\x06\x07\x08" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Long["bar", 0x0102030405060708], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Long.new(0x0102030405060708)})] a_reader_or_writer "should handle float fields", "\x0a\x00\x03foo" \ "\x05\x00\x03bar\x3f\xa0\x00\x00" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Float["bar", "\x3f\xa0\x00\x00".unpack("g").first], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Float.new("\x3f\xa0\x00\x00".unpack("g").first)})] a_reader_or_writer "should handle double fields", "\x0a\x00\x03foo" \ "\x06\x00\x03bar\x3f\xf4\x00\x00\x00\x00\x00\x00" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Double["bar", "\x3f\xf4\x00\x00\x00\x00\x00\x00".unpack("G").first], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Double.new("\x3f\xf4\x00\x00\x00\x00\x00\x00".unpack("G").first)})] a_reader_or_writer "should handle nested compound fields", "\x0a\x00\x03foo" \ "\x0a\x00\x03bar" \ "\x01\x00\x04hoge\x4e" \ "\x00" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Compound["bar", nil], Tokens::TAG_Byte["hoge", 0x4e], Tokens::TAG_End["", nil], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::Compound.new({ "hoge" => Types::Byte.new(0x4e)})})] simple_list_types = [ ["bytes", Types::Byte, Tokens::TAG_Byte, 0x01, lambda { |ns| ns.pack("C*") }], ["shorts", Types::Short, Tokens::TAG_Short, 0x02, lambda { |ns| ns.pack("n*") }], ["ints", Types::Int, Tokens::TAG_Int, 0x03, lambda { |ns| ns.pack("N*") }], ["longs", Types::Long, Tokens::TAG_Long, 0x04, lambda { |ns| ns.map { |n| [n].pack("x4N") }.join("") }], ["floats", Types::Float, Tokens::TAG_Float, 0x05, lambda { |ns| ns.pack("g*") }], ["doubles", Types::Double, Tokens::TAG_Double, 0x06, lambda { |ns| ns.pack("G*") }], ] for label, type, token, repr, pack in simple_list_types values = [9, 5] a_reader_or_writer "should handle lists of #{label}", "\x0a\x00\x03foo" \ "\x09\x00\x03bar#{[repr].pack("C")}\x00\x00\x00\x02" \ "#{pack.call(values)}" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_List["bar", token], token[0, values[0]], token[1, values[1]], Tokens::TAG_End[2, nil], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::List.new(type, values.map { |v| type.new(v) })})] end a_reader_or_writer "should handle lists of empty", "\x0a\x00\x03foo" \ "\x09\x00\x03bar\x00\x00\x00\x00\x00" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_List["bar", Tokens::TAG_End], Tokens::TAG_End[0, nil], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::List.new(Types::End, [])})] a_reader_or_writer "should handle nested lists", "\x0a\x00\x03foo" \ "\x09\x00\x03bar\x09\x00\x00\x00\x01" \ "\x01\x00\x00\x00\x01" \ "\x4a" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_List["bar", Tokens::TAG_List], Tokens::TAG_List[0, Tokens::TAG_Byte], Tokens::TAG_Byte[0, 0x4a], Tokens::TAG_End[1, nil], Tokens::TAG_End[1, nil], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::List.new(Types::List, [ Types::List.new(Types::Byte, [Types::Byte.new(0x4a)])])})] a_reader_or_writer "should handle int array fields", "\x0a\x00\x03foo" \ "\x0b\x00\x03bar\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Int_Array["bar", [0x1, 0x2]], Tokens::TAG_End["", nil]], ["foo", Types::Compound.new({ "bar" => Types::IntArray.new([0x1, 0x2])})] end describe "NBTFile::tokenize (zipped input)" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(input, tokens, tree) io = make_zipped_stream(input) actual_tokens = [] NBTFile.tokenize(io) do |token| actual_tokens << token end actual_tokens.should == tokens end end describe "NBTFile::tokenize (non-zipped input)" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(input, tokens, tree) io = StringIO.new(input, "rb") actual_tokens = [] NBTFile.tokenize_uncompressed(io) do |token| actual_tokens << token end actual_tokens.should == tokens end end describe "NBTFile::tokenize_compressed" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(input, tokens, tree) io = make_zipped_stream(input) actual_tokens = [] NBTFile.tokenize_compressed(io) do |token| actual_tokens << token end actual_tokens.should == tokens end end describe "NBTFile::tokenize_uncompressed" do it_should_behave_like "readers and writers" def check_reader_or_writer(input, tokens, tree) io = StringIO.new(input, "rb") actual_tokens = [] NBTFile.tokenize_uncompressed(io) do |token| actual_tokens << token end actual_tokens.should == tokens end end describe "NBTFile::tokenize without a block" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(input, tokens, tree) io = make_zipped_stream(input) actual_tokens = NBTFile.tokenize(io) actual_tokens.should be_a_kind_of(Enumerable) actual_tokens.to_a.should == tokens end end describe "NBTFile::tokenize_uncompressed without a block" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(input, tokens, tree) io = StringIO.new(input) actual_tokens = NBTFile.tokenize_uncompressed(io) actual_tokens.should be_a_kind_of(Enumerable) actual_tokens.to_a.should == tokens end end describe "NBTFile::emit_uncompressed" do it_should_behave_like "readers and writers" def check_reader_or_writer(output, tokens, tree) io = StringIO.new() NBTFile.emit_uncompressed(io) do |writer| for token in tokens writer.emit_token(token) end end io.string.force_encoding('BINARY').should == output end end describe "NBTFile::emit" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(output, tokens, tree) io = StringIO.new() NBTFile.emit(io) do |writer| for token in tokens writer.emit_token(token) end end actual_output = unzip_string(io.string) actual_output.should == output end def self.emit_shorthand(description, output, &block) it description do io = StringIO.new() NBTFile.emit(io, &block) actual_output = unzip_string(io.string) actual_output.should == output end end it "should convert strings to UTF-8 (on encoding-aware rubies)" do check_reader_or_writer "\x0a\x00\x03foo" \ "\x08\x00\x03bar\x00\x04hoge" \ "\x00", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_String["bar", "hoge"._nbtfile_encode("UTF-16LE")], Tokens::TAG_End["", nil]], nil end it "should reject malformed UTF-8 strings" do io = StringIO.new NBTFile.emit(io) do |writer| writer.emit_compound("foo") do lambda { str = "hoge\xff" str._nbtfile_force_encoding("UTF-8") writer.emit_token(Tokens::TAG_String["bar", str]) }.should raise_error(NBTFile::EncodingError) end end end emit_shorthand "should support shorthand for emitting lists", "\x0a\x00\x04test" \ "\x09\x00\x03foo\x01\x00\x00\x00\x02" \ "\x0c\x2b" \ "\x00" do |writer| writer.emit_token(Tokens::TAG_Compound["test", nil]) writer.emit_list("foo", Tokens::TAG_Byte) do writer.emit_item(12) writer.emit_item(43) end writer.emit_token(Tokens::TAG_End[nil, nil]) end emit_shorthand "should support shorthand for emitting compound structures", "\x0a\x00\x04test" \ "\x0a\x00\x03xyz" \ "\x01\x00\x03foo\x08" \ "\x01\x00\x03bar\x02" \ "\x00" \ "\x00" do |writer| writer.emit_token(Tokens::TAG_Compound["test", nil]) writer.emit_compound("xyz") do writer.emit_token(Tokens::TAG_Byte["foo", 0x08]) writer.emit_token(Tokens::TAG_Byte["bar", 0x02]) end writer.emit_token(Tokens::TAG_End[nil, nil]) end end describe "NBTFile::read" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(input, tokens, tree) io = make_zipped_stream(input) actual_tree = NBTFile.read(io) actual_tree.should == tree end end describe "NBTFile::write" do include ZlibHelpers it_should_behave_like "readers and writers" def check_reader_or_writer(output, tokens, tree) io = StringIO.new() name, body = tree NBTFile.write(io, name, body) actual_output = unzip_string(io.string) actual_output.should == output end end describe "NBTFile::load" do include ZlibHelpers def self.nbtfile_load(description, tokens, result) it description do io = StringIO.new() NBTFile.emit(io) do |writer| for token in tokens writer.emit_token(token) end end actual_result = NBTFile.load(StringIO.new(io.string)) actual_result.should == result end end nbtfile_load "should generate a top-level pair", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Byte["a", 19], Tokens::TAG_Byte["b", 23], Tokens::TAG_End[nil, nil]], ["foo", {"a" => 19, "b" => 23}] nbtfile_load "should map compound structures to hashes", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Compound["bar", nil], Tokens::TAG_Byte["a", 123], Tokens::TAG_Byte["b", 56], Tokens::TAG_End[nil, nil], Tokens::TAG_End[nil, nil]], ["foo", {"bar" => {"a" => 123, "b" => 56}}] nbtfile_load "should map lists to arrays", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_List["bar", Tokens::TAG_Byte], Tokens::TAG_Byte[0, 32], Tokens::TAG_Byte[1, 45], Tokens::TAG_End[2, nil], Tokens::TAG_End["", nil]], ["foo", {"bar" => [32, 45]}] end describe "NBTFile::transcode_to_yaml" do def self.nbtfile_transcode(description, tokens, result) it description do io = StringIO.new() NBTFile.emit(io) do |writer| for token in tokens writer.emit_token(token) end end out = StringIO.new() NBTFile.transcode_to_yaml(StringIO.new(io.string), out) actual_result = YAML.load(out.string) actual_result.should == result end end nbtfile_transcode "should transcode to YAML", [Tokens::TAG_Compound["foo", nil], Tokens::TAG_Byte["a", 19], Tokens::TAG_Byte["b", 23], Tokens::TAG_End[nil, nil]], ["foo", {"a" => 19, "b" => 23}] end
35.719665
108
0.512124
265d38d0cc865718764cf5bd211b6bf238436c09
750
require 'spec_helper' require_relative 'support/pages/cost_report_page' describe 'Cost report project context', type: :feature, js: true do let(:project1) { FactoryBot.create :project } let(:project2) { FactoryBot.create :project } let(:admin) { FactoryBot.create :admin } let(:report_page) { ::Pages::CostReportPage.new project } before do project1 project2 login_as admin end it "switches the project context when visiting another project's cost report" do visit cost_reports_path(project1) expect(page).to have_selector('#project_id_arg_1_val option', text: project1.name) visit cost_reports_path(project2) expect(page).to have_selector('#project_id_arg_1_val option', text: project2.name) end end
30
86
0.745333
61548ecd986e7bcd1cf1d7589c5de952ed372cb8
3,639
require 'net/sftp' require 'uri' require_relative '../spec_helper' module SFTPHelper class MockSession < ::Net::SFTP::Session def initialize # Intentionally do not call super end end class MockEntry attr_reader :attributes attr_reader :name def initialize(name) @name = name @attributes = ::Net::SFTP::Protocol::V01::Attributes.new end end attr_reader :sftp_attributes_directory attr_reader :sftp_attributes_file attr_reader :sftp_attributes_mtime attr_reader :sftp_attributes_size attr_reader :sftp_close attr_reader :sftp_dir_entries attr_reader :sftp_dir_glob attr_reader :sftp_download attr_reader :sftp_fstat attr_reader :sftp_open attr_reader :sftp_read attr_reader :sftp_start def sftp_stub(config, is_file, file_name, file_extension, file_content, file_mtime) @sftp_attributes_directory = false @sftp_attributes_file = false @sftp_attributes_mtime = false @sftp_attributes_name = false @sftp_attributes_size = false @sftp_close = false @sftp_dir_entries = false @sftp_dir_glob = false @sftp_download = false @sftp_fstat = false @sftp_open = false @sftp_read = false @sftp_start = false uri = URI.parse(config.log_files[0]) ::Net::SFTP.stub(:start) do |host, user, options, &blk| expect(host).to eq(uri.host) expect(user).to eq(uri.user) expect(options).to include(port: uri.port) unless uri.port.nil? expect(options).to include(password: uri.password) unless uri.password.nil? expect(options).to include(keys: config.log_file_sftp_keys) if uri.password.nil? blk.call(MockSession.new) @sftp_start = true end MockSession.any_instance.stub(:close!) do @sftp_close = true end MockSession.any_instance.stub(:download!) do |_source, target| @sftp_download = true File.open(target, 'w') do |file| file.write(file_content) end end MockSession.any_instance.stub(:fstat!) do @sftp_fstat = true ::Net::SFTP::Protocol::V01::Attributes.new end MockSession.any_instance.stub(:open!) do @sftp_open = true nil end MockSession.any_instance.stub(:read!) do |_, start, read_size| @sftp_read = true file_content.slice(start, read_size) end ::Net::SFTP::Protocol::V01::Attributes.any_instance.stub(:directory?) do @sftp_attributes_directory = true !is_file end ::Net::SFTP::Protocol::V01::Attributes.any_instance.stub(:file?) do @sftp_attributes_file = true is_file end ::Net::SFTP::Protocol::V01::Attributes.any_instance.stub(:mtime) do @sftp_attributes_mtime = true file_mtime end ::Net::SFTP::Protocol::V01::Attributes.any_instance.stub(:name) do @sftp_attributes_name = true "#{ file_name }#{ file_extension }" end ::Net::SFTP::Protocol::V01::Attributes.any_instance.stub(:size) do @sftp_attributes_size = true file_content.length end ::Net::SFTP::Operations::Dir.any_instance.stub(:entries) do # We have to make sure if_file is now true is_file = true @sftp_dir_entries = true [MockEntry.new("#{ file_name }#{ file_extension }")] end ::Net::SFTP::Operations::Dir.any_instance.stub(:glob) do # We have to make sure if_file is now true is_file = true @sftp_dir_glob = true [MockEntry.new("#{ file_name }#{ file_extension }")] end end end
28.209302
86
0.651827
8718fdbd382ba20f037d0b1dcca4eafc4a9b24a0
6,468
# frozen_string_literal: true module DeadEnd # Represents a single line of code of a given source file # # This object contains metadata about the line such as # amount of indentation, if it is empty or not, and # lexical data, such as if it has an `end` or a keyword # in it. # # Visibility of lines can be toggled off. Marking a line as invisible # indicates that it should not be used for syntax checks. # It's functionally the same as commenting it out. # # Example: # # line = CodeLine.from_source("def foo\n").first # line.number => 1 # line.empty? # => false # line.visible? # => true # line.mark_invisible # line.visible? # => false # class CodeLine TRAILING_SLASH = ("\\" + $/).freeze # Returns an array of CodeLine objects # from the source string def self.from_source(source) lex_array_for_line = LexAll.new(source: source).each_with_object(Hash.new { |h, k| h[k] = [] }) { |lex, hash| hash[lex.line] << lex } source.lines.map.with_index do |line, index| CodeLine.new( line: line, index: index, lex: lex_array_for_line[index + 1] ) end end attr_reader :line, :index, :lex, :line_number, :indent def initialize(line:, index:, lex:) @lex = lex @line = line @index = index @original = line.freeze @line_number = @index + 1 if line.strip.empty? @empty = true @indent = 0 else @empty = false @indent = SpaceCount.indent(line) end kw_count = 0 end_count = 0 @lex.each do |lex| kw_count += 1 if lex.is_kw? end_count += 1 if lex.is_end? end kw_count -= oneliner_method_count @is_kw = (kw_count - end_count) > 0 @is_end = (end_count - kw_count) > 0 end # Used for stable sort via indentation level # # Ruby's sort is not "stable" meaning that when # multiple elements have the same value, they are # not guaranteed to return in the same order they # were put in. # # So when multiple code lines have the same indentation # level, they're sorted by their index value which is unique # and consistent. # # This is mostly needed for consistency of the test suite def indent_index @indent_index ||= [indent, index] end alias_method :number, :line_number # Returns true if the code line is determined # to contain a keyword that matches with an `end` # # For example: `def`, `do`, `begin`, `ensure`, etc. def is_kw? @is_kw end # Returns true if the code line is determined # to contain an `end` keyword def is_end? @is_end end # Used to hide lines # # The search alorithm will group lines into blocks # then if those blocks are determined to represent # valid code they will be hidden def mark_invisible @line = "" end # Means the line was marked as "invisible" # Confusingly, "empty" lines are visible...they # just don't contain any source code other than a newline ("\n"). def visible? !line.empty? end # Opposite or `visible?` (note: different than `empty?`) def hidden? !visible? end # An `empty?` line is one that was originally left # empty in the source code, while a "hidden" line # is one that we've since marked as "invisible" def empty? @empty end # Opposite of `empty?` (note: different than `visible?`) def not_empty? !empty? end # Renders the given line # # Also allows us to represent source code as # an array of code lines. # # When we have an array of code line elements # calling `join` on the array will call `to_s` # on each element, which essentially converts # it back into it's original source string. def to_s line end # When the code line is marked invisible # we retain the original value of it's line # this is useful for debugging and for # showing extra context # # DisplayCodeWithLineNumbers will render # all lines given to it, not just visible # lines, it uses the original method to # obtain them. attr_reader :original # Comparison operator, needed for equality # and sorting def <=>(other) index <=> other.index end # [Not stable API] # # Lines that have a `on_ignored_nl` type token and NOT # a `BEG` type seem to be a good proxy for the ability # to join multiple lines into one. # # This predicate method is used to determine when those # two criteria have been met. # # The one known case this doesn't handle is: # # Ripper.lex <<~EOM # a && # b || # c # EOM # # For some reason this introduces `on_ignore_newline` but with BEG type def ignore_newline_not_beg? lex_value = lex.detect { |l| l.type == :on_ignored_nl } !!(lex_value && !lex_value.expr_beg?) end # Determines if the given line has a trailing slash # # lines = CodeLine.from_source(<<~EOM) # it "foo" \ # EOM # expect(lines.first.trailing_slash?).to eq(true) # def trailing_slash? last = @lex.last return false unless last return false unless last.type == :on_sp last.token == TRAILING_SLASH end # Endless method detection # # From https://github.com/ruby/irb/commit/826ae909c9c93a2ddca6f9cfcd9c94dbf53d44ab # Detecting a "oneliner" seems to need a state machine. # This can be done by looking mostly at the "state" (last value): # # ENDFN -> BEG (token = '=' ) -> END # private def oneliner_method_count oneliner_count = 0 in_oneliner_def = nil @lex.each do |lex| if in_oneliner_def.nil? in_oneliner_def = :ENDFN if lex.state.allbits?(Ripper::EXPR_ENDFN) elsif lex.state.allbits?(Ripper::EXPR_ENDFN) # Continue elsif lex.state.allbits?(Ripper::EXPR_BEG) in_oneliner_def = :BODY if lex.token == "=" elsif lex.state.allbits?(Ripper::EXPR_END) # We found an endless method, count it oneliner_count += 1 if in_oneliner_def == :BODY in_oneliner_def = nil else in_oneliner_def = nil end end oneliner_count end end end
27.641026
139
0.612554
edd0b75ff65259c231e8e647aed7d018675575a6
1,846
class Mg3a < Formula desc "Small Emacs-like editor inspired like mg with UTF8 support" homepage "http://www.bengtl.net/files/mg3a/" url "http://www.bengtl.net/files/mg3a/mg3a.160511.tar.gz" sha256 "1281e31930216565cf6572e05064e06fcbf64074f9ebf4677ef0e4b22fbf21f8" bottle do cellar :any_skip_relocation sha256 "62ae10d29c7f8b9df0ea3f2d6ba76ac11ca2afa27c1bac68eb5328fd941bd67c" => :el_capitan sha256 "0739510b46503faecb3793d9a230d33a283b17dfc3b208087d2fb44e6e9fbe67" => :yosemite sha256 "334f8cafe8d0410aab5a07d99d530babdccffa1f63fdc6286b947dce87ef9222" => :mavericks end conflicts_with "mg", :because => "both install `mg`" option "with-c-mode", "Include the original C mode" option "with-clike-mode", "Include the C mode that also handles Perl and Java" option "with-python-mode", "Include the Python mode" option "with-most", "Include c-like and python modes, user modes and user macros" option "with-all", "Include all fancy stuff" def install if build.with?("all") mg3aopts = "-DALL" if build.with?("all") else mg3aopts = %w[-DDIRED -DPREFIXREGION -DUSER_MODES -DUSER_MACROS] mg3aopts << "-DLANGMODE_C" if build.with?("c-mode") mg3aopts << "-DLANGMODE_PYTHON" if build.with?("python-mode") || build.with?("most") mg3aopts << "-DLANGMODE_CLIKE" if build.with?("clike-mode") || build.with?("most") end system "make", "CDEFS=#{mg3aopts * " "}", "LIBS=-lncurses", "COPT=-O3" bin.install "mg" doc.install Dir["bl/dot.*"] doc.install Dir["README*"] end test do (testpath/"command.sh").write <<-EOS.undent #!/usr/bin/expect -f set timeout -1 spawn #{bin}/mg match_max 100000 send -- "\u0018\u0003" expect eof EOS (testpath/"command.sh").chmod 0755 system testpath/"command.sh" end end
35.5
92
0.690141
ffba1e39e843cad58712819e8ca4b58b89100d22
409
class Numeric if (instance_method :truncate).arity == 0 def truncate_to_precision precision if (precision = precision.to_i) > 0 factor = 10 ** precision (self * factor).truncate.fdiv factor else truncate end end else # use native method in Ruby >= 2.4 alias :truncate_to_precision :truncate end unless method_defined? :truncate_to_precision end
25.5625
51
0.665037
7a0ff23b95fbee13e0fe37f1c44f2dbd28046d04
128
class RemoveCostFromProjects < ActiveRecord::Migration[5.2] def change remove_column :projects, :cost, :decimal end end
21.333333
59
0.757813
1a812dbf76b5e365e6f749a9b84b5edeb69e1232
170,964
# 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 ServicenetworkingV1 # Request to create a subnetwork in a previously peered service network. class AddSubnetworkRequest include Google::Apis::Core::Hashable # Required. A resource that represents the service consumer, such as # `projects/123456`. The project number can be different from the # value in the consumer network parameter. For example, the network might be # part of a Shared VPC network. In those cases, Service Networking validates # that this resource belongs to that Shared VPC. # Corresponds to the JSON property `consumer` # @return [String] attr_accessor :consumer # Required. The name of the service consumer's VPC network. The network # must have an existing private connection that was provisioned through the # connections.create method. The name must be in the following format: # `projects/`project`/global/networks/`network``, where `project` # is a project number, such as `12345`. `network` is the name of a # VPC network in the project. # Corresponds to the JSON property `consumerNetwork` # @return [String] attr_accessor :consumer_network # Optional. Description of the subnet. # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # Required. The prefix length of the subnet's IP address range. Use CIDR # range notation, such as `30` to provision a subnet with an # `x.x.x.x/30` CIDR range. The IP address range is drawn from a # pool of available ranges in the service consumer's allocated range. # Corresponds to the JSON property `ipPrefixLength` # @return [Fixnum] attr_accessor :ip_prefix_length # Optional. The private IPv6 google access type for the VMs in this subnet. # For information about the access types that can be set using this field, # see [subnetwork](/compute/docs/reference/rest/v1/subnetworks) # in the Compute API documentation. # Corresponds to the JSON property `privateIpv6GoogleAccess` # @return [String] attr_accessor :private_ipv6_google_access # Required. The name of a [region](/compute/docs/regions-zones) # for the subnet, such `europe-west1`. # Corresponds to the JSON property `region` # @return [String] attr_accessor :region # Optional. The starting address of a range. The address must be a valid # IPv4 address in the x.x.x.x format. This value combined with the IP prefix # range is the CIDR range for the subnet. The range must be within the # allocated range that is assigned to the private connection. If the CIDR # range isn't available, the call fails. # Corresponds to the JSON property `requestedAddress` # @return [String] attr_accessor :requested_address # Required. A name for the new subnet. For information about the naming # requirements, see [subnetwork](/compute/docs/reference/rest/v1/subnetworks) # in the Compute API documentation. # Corresponds to the JSON property `subnetwork` # @return [String] attr_accessor :subnetwork # A list of members that are granted the `compute.networkUser` # role on the subnet. # Corresponds to the JSON property `subnetworkUsers` # @return [Array<String>] attr_accessor :subnetwork_users def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @consumer = args[:consumer] if args.key?(:consumer) @consumer_network = args[:consumer_network] if args.key?(:consumer_network) @description = args[:description] if args.key?(:description) @ip_prefix_length = args[:ip_prefix_length] if args.key?(:ip_prefix_length) @private_ipv6_google_access = args[:private_ipv6_google_access] if args.key?(:private_ipv6_google_access) @region = args[:region] if args.key?(:region) @requested_address = args[:requested_address] if args.key?(:requested_address) @subnetwork = args[:subnetwork] if args.key?(:subnetwork) @subnetwork_users = args[:subnetwork_users] if args.key?(:subnetwork_users) end end # Api is a light-weight descriptor for an API Interface. # Interfaces are also described as "protocol buffer services" in some contexts, # such as by the "service" keyword in a .proto file, but they are different # from API Services, which represent a concrete implementation of an interface # as opposed to simply a description of methods and bindings. They are also # sometimes simply referred to as "APIs" in other contexts, such as the name of # this message itself. See https://cloud.google.com/apis/design/glossary for # detailed terminology. class Api include Google::Apis::Core::Hashable # The methods of this interface, in unspecified order. # Corresponds to the JSON property `methods` # @return [Array<Google::Apis::ServicenetworkingV1::MethodProp>] attr_accessor :methods_prop # Included interfaces. See Mixin. # Corresponds to the JSON property `mixins` # @return [Array<Google::Apis::ServicenetworkingV1::Mixin>] attr_accessor :mixins # The fully qualified name of this interface, including package name # followed by the interface's simple name. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Any metadata attached to the interface. # Corresponds to the JSON property `options` # @return [Array<Google::Apis::ServicenetworkingV1::Option>] attr_accessor :options # `SourceContext` represents information about the source of a # protobuf element, like the file in which it is defined. # Corresponds to the JSON property `sourceContext` # @return [Google::Apis::ServicenetworkingV1::SourceContext] attr_accessor :source_context # The source syntax of the service. # Corresponds to the JSON property `syntax` # @return [String] attr_accessor :syntax # A version string for this interface. If specified, must have the form # `major-version.minor-version`, as in `1.10`. If the minor version is # omitted, it defaults to zero. If the entire version field is empty, the # major version is derived from the package name, as outlined below. If the # field is not empty, the version in the package name will be verified to be # consistent with what is provided here. # The versioning schema uses [semantic # versioning](http://semver.org) where the major version number # indicates a breaking change and the minor version an additive, # non-breaking change. Both version numbers are signals to users # what to expect from different versions, and should be carefully # chosen based on the product plan. # The major version is also reflected in the package name of the # interface, which must end in `v<major-version>`, as in # `google.feature.v1`. For major versions 0 and 1, the suffix can # be omitted. Zero major versions must only be used for # experimental, non-GA interfaces. # Corresponds to the JSON property `version` # @return [String] attr_accessor :version def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @methods_prop = args[:methods_prop] if args.key?(:methods_prop) @mixins = args[:mixins] if args.key?(:mixins) @name = args[:name] if args.key?(:name) @options = args[:options] if args.key?(:options) @source_context = args[:source_context] if args.key?(:source_context) @syntax = args[:syntax] if args.key?(:syntax) @version = args[:version] if args.key?(:version) end end # Configuration for an authentication provider, including support for # [JSON Web Token # (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). class AuthProvider include Google::Apis::Core::Hashable # The list of JWT # [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32# # section-4.1.3). # that are allowed to access. A JWT containing any of these audiences will # be accepted. When this setting is absent, only JWTs with audience # "https://Service_name/API_name" # will be accepted. For example, if no audiences are in the setting, # LibraryService API will only accept JWTs with the following audience # "https://library-example.googleapis.com/google.example.library.v1. # LibraryService". # Example: # audiences: bookstore_android.apps.googleusercontent.com, # bookstore_web.apps.googleusercontent.com # Corresponds to the JSON property `audiences` # @return [String] attr_accessor :audiences # Redirect URL if JWT token is required but not present or is expired. # Implement authorizationUrl of securityDefinitions in OpenAPI spec. # Corresponds to the JSON property `authorizationUrl` # @return [String] attr_accessor :authorization_url # The unique identifier of the auth provider. It will be referred to by # `AuthRequirement.provider_id`. # Example: "bookstore_auth". # Corresponds to the JSON property `id` # @return [String] attr_accessor :id # Identifies the principal that issued the JWT. See # https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32#section-4.1.1 # Usually a URL or an email address. # Example: https://securetoken.google.com # Example: [email protected] # Corresponds to the JSON property `issuer` # @return [String] attr_accessor :issuer # URL of the provider's public key set to validate signature of the JWT. See # [OpenID # Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html# # ProviderMetadata). # Optional if the key set document: # - can be retrieved from # [OpenID # Discovery](https://openid.net/specs/openid-connect-discovery-1_0.html of # the issuer. # - can be inferred from the email domain of the issuer (e.g. a Google # service account). # Example: https://www.googleapis.com/oauth2/v1/certs # Corresponds to the JSON property `jwksUri` # @return [String] attr_accessor :jwks_uri # Defines the locations to extract the JWT. # JWT locations can be either from HTTP headers or URL query parameters. # The rule is that the first match wins. The checking order is: checking # all headers first, then URL query parameters. # If not specified, default to use following 3 locations: # 1) Authorization: Bearer # 2) x-goog-iap-jwt-assertion # 3) access_token query parameter # Default locations can be specified as followings: # jwt_locations: # - header: Authorization # value_prefix: "Bearer " # - header: x-goog-iap-jwt-assertion # - query: access_token # Corresponds to the JSON property `jwtLocations` # @return [Array<Google::Apis::ServicenetworkingV1::JwtLocation>] attr_accessor :jwt_locations def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @audiences = args[:audiences] if args.key?(:audiences) @authorization_url = args[:authorization_url] if args.key?(:authorization_url) @id = args[:id] if args.key?(:id) @issuer = args[:issuer] if args.key?(:issuer) @jwks_uri = args[:jwks_uri] if args.key?(:jwks_uri) @jwt_locations = args[:jwt_locations] if args.key?(:jwt_locations) end end # User-defined authentication requirements, including support for # [JSON Web Token # (JWT)](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32). class AuthRequirement include Google::Apis::Core::Hashable # NOTE: This will be deprecated soon, once AuthProvider.audiences is # implemented and accepted in all the runtime components. # The list of JWT # [audiences](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32# # section-4.1.3). # that are allowed to access. A JWT containing any of these audiences will # be accepted. When this setting is absent, only JWTs with audience # "https://Service_name/API_name" # will be accepted. For example, if no audiences are in the setting, # LibraryService API will only accept JWTs with the following audience # "https://library-example.googleapis.com/google.example.library.v1. # LibraryService". # Example: # audiences: bookstore_android.apps.googleusercontent.com, # bookstore_web.apps.googleusercontent.com # Corresponds to the JSON property `audiences` # @return [String] attr_accessor :audiences # id from authentication provider. # Example: # provider_id: bookstore_auth # Corresponds to the JSON property `providerId` # @return [String] attr_accessor :provider_id def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @audiences = args[:audiences] if args.key?(:audiences) @provider_id = args[:provider_id] if args.key?(:provider_id) end end # `Authentication` defines the authentication configuration for an API. # Example for an API targeted for external use: # name: calendar.googleapis.com # authentication: # providers: # - id: google_calendar_auth # jwks_uri: https://www.googleapis.com/oauth2/v1/certs # issuer: https://securetoken.google.com # rules: # - selector: "*" # requirements: # provider_id: google_calendar_auth class Authentication include Google::Apis::Core::Hashable # Defines a set of authentication providers that a service supports. # Corresponds to the JSON property `providers` # @return [Array<Google::Apis::ServicenetworkingV1::AuthProvider>] attr_accessor :providers # A list of authentication rules that apply to individual API methods. # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::AuthenticationRule>] attr_accessor :rules def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @providers = args[:providers] if args.key?(:providers) @rules = args[:rules] if args.key?(:rules) end end # Authentication rules for the service. # By default, if a method has any authentication requirements, every request # must include a valid credential matching one of the requirements. # It's an error to include more than one kind of credential in a single # request. # If a method doesn't have any auth requirements, request credentials will be # ignored. class AuthenticationRule include Google::Apis::Core::Hashable # If true, the service accepts API keys without any other credential. # Corresponds to the JSON property `allowWithoutCredential` # @return [Boolean] attr_accessor :allow_without_credential alias_method :allow_without_credential?, :allow_without_credential # OAuth scopes are a way to define data and permissions on data. For example, # there are scopes defined for "Read-only access to Google Calendar" and # "Access to Cloud Platform". Users can consent to a scope for an application, # giving it permission to access that data on their behalf. # OAuth scope specifications should be fairly coarse grained; a user will need # to see and understand the text description of what your scope means. # In most cases: use one or at most two OAuth scopes for an entire family of # products. If your product has multiple APIs, you should probably be sharing # the OAuth scope across all of those APIs. # When you need finer grained OAuth consent screens: talk with your product # management about how developers will use them in practice. # Please note that even though each of the canonical scopes is enough for a # request to be accepted and passed to the backend, a request can still fail # due to the backend requiring additional scopes or permissions. # Corresponds to the JSON property `oauth` # @return [Google::Apis::ServicenetworkingV1::OAuthRequirements] attr_accessor :oauth # Requirements for additional authentication providers. # Corresponds to the JSON property `requirements` # @return [Array<Google::Apis::ServicenetworkingV1::AuthRequirement>] attr_accessor :requirements # Selects the methods to which this rule applies. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @allow_without_credential = args[:allow_without_credential] if args.key?(:allow_without_credential) @oauth = args[:oauth] if args.key?(:oauth) @requirements = args[:requirements] if args.key?(:requirements) @selector = args[:selector] if args.key?(:selector) end end # `Backend` defines the backend configuration for a service. class Backend include Google::Apis::Core::Hashable # A list of API backend rules that apply to individual API methods. # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::BackendRule>] attr_accessor :rules def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @rules = args[:rules] if args.key?(:rules) end end # A backend rule provides configuration for an individual API element. class BackendRule include Google::Apis::Core::Hashable # The address of the API backend. # The scheme is used to determine the backend protocol and security. # The following schemes are accepted: # SCHEME PROTOCOL SECURITY # http:// HTTP None # https:// HTTP TLS # grpc:// gRPC None # grpcs:// gRPC TLS # It is recommended to explicitly include a scheme. Leaving out the scheme # may cause constrasting behaviors across platforms. # If the port is unspecified, the default is: # - 80 for schemes without TLS # - 443 for schemes with TLS # For HTTP backends, use protocol # to specify the protocol version. # Corresponds to the JSON property `address` # @return [String] attr_accessor :address # The number of seconds to wait for a response from a request. The default # varies based on the request protocol and deployment environment. # Corresponds to the JSON property `deadline` # @return [Float] attr_accessor :deadline # When disable_auth is true, a JWT ID token won't be generated and the # original "Authorization" HTTP header will be preserved. If the header is # used to carry the original token and is expected by the backend, this # field must be set to true to preserve the header. # Corresponds to the JSON property `disableAuth` # @return [Boolean] attr_accessor :disable_auth alias_method :disable_auth?, :disable_auth # The JWT audience is used when generating a JWT ID token for the backend. # This ID token will be added in the HTTP "authorization" header, and sent # to the backend. # Corresponds to the JSON property `jwtAudience` # @return [String] attr_accessor :jwt_audience # Minimum deadline in seconds needed for this method. Calls having deadline # value lower than this will be rejected. # Corresponds to the JSON property `minDeadline` # @return [Float] attr_accessor :min_deadline # The number of seconds to wait for the completion of a long running # operation. The default is no deadline. # Corresponds to the JSON property `operationDeadline` # @return [Float] attr_accessor :operation_deadline # # Corresponds to the JSON property `pathTranslation` # @return [String] attr_accessor :path_translation # The protocol used for sending a request to the backend. # The supported values are "http/1.1" and "h2". # The default value is inferred from the scheme in the # address field: # SCHEME PROTOCOL # http:// http/1.1 # https:// http/1.1 # grpc:// h2 # grpcs:// h2 # For secure HTTP backends (https://) that support HTTP/2, set this field # to "h2" for improved performance. # Configuring this field to non-default values is only supported for secure # HTTP backends. This field will be ignored for all other backends. # See # https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype- # values.xhtml#alpn-protocol-ids # for more details on the supported values. # Corresponds to the JSON property `protocol` # @return [String] attr_accessor :protocol # Selects the methods to which this rule applies. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @address = args[:address] if args.key?(:address) @deadline = args[:deadline] if args.key?(:deadline) @disable_auth = args[:disable_auth] if args.key?(:disable_auth) @jwt_audience = args[:jwt_audience] if args.key?(:jwt_audience) @min_deadline = args[:min_deadline] if args.key?(:min_deadline) @operation_deadline = args[:operation_deadline] if args.key?(:operation_deadline) @path_translation = args[:path_translation] if args.key?(:path_translation) @protocol = args[:protocol] if args.key?(:protocol) @selector = args[:selector] if args.key?(:selector) end end # Billing related configuration of the service. # The following example shows how to configure monitored resources and metrics # for billing: # monitored_resources: # - type: library.googleapis.com/branch # labels: # - key: /city # description: The city where the library branch is located in. # - key: /name # description: The name of the branch. # metrics: # - name: library.googleapis.com/book/borrowed_count # metric_kind: DELTA # value_type: INT64 # billing: # consumer_destinations: # - monitored_resource: library.googleapis.com/branch # metrics: # - library.googleapis.com/book/borrowed_count class Billing include Google::Apis::Core::Hashable # Billing configurations for sending metrics to the consumer project. # There can be multiple consumer destinations per service, each one must have # a different monitored resource type. A metric can be used in at most # one consumer destination. # Corresponds to the JSON property `consumerDestinations` # @return [Array<Google::Apis::ServicenetworkingV1::BillingDestination>] attr_accessor :consumer_destinations def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @consumer_destinations = args[:consumer_destinations] if args.key?(:consumer_destinations) end end # Configuration of a specific billing destination (Currently only support # bill against consumer project). class BillingDestination include Google::Apis::Core::Hashable # Names of the metrics to report to this billing destination. # Each name must be defined in Service.metrics section. # Corresponds to the JSON property `metrics` # @return [Array<String>] attr_accessor :metrics # The monitored resource type. The type must be defined in # Service.monitored_resources section. # Corresponds to the JSON property `monitoredResource` # @return [String] attr_accessor :monitored_resource def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @metrics = args[:metrics] if args.key?(:metrics) @monitored_resource = args[:monitored_resource] if args.key?(:monitored_resource) end end # The request message for Operations.CancelOperation. class CancelOperationRequest include Google::Apis::Core::Hashable def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) end end # Represents a private connection resource. A private connection is implemented # as a VPC Network Peering connection between a service producer's VPC network # and a service consumer's VPC network. class Connection include Google::Apis::Core::Hashable # The name of service consumer's VPC network that's connected with service # producer network, in the following format: # `projects/`project`/global/networks/`network``. # ``project`` is a project number, such as in `12345` that includes # the VPC service consumer's VPC network. ``network`` is the name of the # service consumer's VPC network. # Corresponds to the JSON property `network` # @return [String] attr_accessor :network # Output only. The name of the VPC Network Peering connection that was created # by the # service producer. # Corresponds to the JSON property `peering` # @return [String] attr_accessor :peering # The name of one or more allocated IP address ranges for this service # producer of type `PEERING`. # Note that invoking CreateConnection method with a different range when # connection is already established will not modify already provisioned # service producer subnetworks. # If CreateConnection method is invoked repeatedly to reconnect when peering # connection had been disconnected on the consumer side, leaving this field # empty will restore previously allocated IP ranges. # Corresponds to the JSON property `reservedPeeringRanges` # @return [Array<String>] attr_accessor :reserved_peering_ranges # Output only. The name of the peering service that's associated with this # connection, in # the following format: `services/`service name``. # Corresponds to the JSON property `service` # @return [String] attr_accessor :service def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @network = args[:network] if args.key?(:network) @peering = args[:peering] if args.key?(:peering) @reserved_peering_ranges = args[:reserved_peering_ranges] if args.key?(:reserved_peering_ranges) @service = args[:service] if args.key?(:service) end end # Represents a consumer project. class ConsumerProject include Google::Apis::Core::Hashable # Required. Project number of the consumer that is launching the service # instance. It # can own the network that is peered with Google or, be a service project in # an XPN where the host project has the network. # Corresponds to the JSON property `projectNum` # @return [Fixnum] attr_accessor :project_num def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @project_num = args[:project_num] if args.key?(:project_num) end end # `Context` defines which contexts an API requests. # Example: # context: # rules: # - selector: "*" # requested: # - google.rpc.context.ProjectContext # - google.rpc.context.OriginContext # The above specifies that all methods in the API request # `google.rpc.context.ProjectContext` and # `google.rpc.context.OriginContext`. # Available context types are defined in package # `google.rpc.context`. # This also provides mechanism to whitelist any protobuf message extension that # can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and # “x-goog-ext-<extension_id>-jspb” format. For example, list any service # specific protobuf types that can appear in grpc metadata as follows in your # yaml file: # Example: # context: # rules: # - selector: "google.example.library.v1.LibraryService.CreateBook" # allowed_request_extensions: # - google.foo.v1.NewExtension # allowed_response_extensions: # - google.foo.v1.NewExtension # You can also specify extension ID instead of fully qualified extension name # here. class Context include Google::Apis::Core::Hashable # A list of RPC context rules that apply to individual API methods. # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::ContextRule>] attr_accessor :rules def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @rules = args[:rules] if args.key?(:rules) end end # A context rule provides information about the context for an individual API # element. class ContextRule include Google::Apis::Core::Hashable # A list of full type names or extension IDs of extensions allowed in grpc # side channel from client to backend. # Corresponds to the JSON property `allowedRequestExtensions` # @return [Array<String>] attr_accessor :allowed_request_extensions # A list of full type names or extension IDs of extensions allowed in grpc # side channel from backend to client. # Corresponds to the JSON property `allowedResponseExtensions` # @return [Array<String>] attr_accessor :allowed_response_extensions # A list of full type names of provided contexts. # Corresponds to the JSON property `provided` # @return [Array<String>] attr_accessor :provided # A list of full type names of requested contexts. # Corresponds to the JSON property `requested` # @return [Array<String>] attr_accessor :requested # Selects the methods to which this rule applies. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @allowed_request_extensions = args[:allowed_request_extensions] if args.key?(:allowed_request_extensions) @allowed_response_extensions = args[:allowed_response_extensions] if args.key?(:allowed_response_extensions) @provided = args[:provided] if args.key?(:provided) @requested = args[:requested] if args.key?(:requested) @selector = args[:selector] if args.key?(:selector) end end # Selects and configures the service controller used by the service. The # service controller handles features like abuse, quota, billing, logging, # monitoring, etc. class Control include Google::Apis::Core::Hashable # The service control environment to use. If empty, no control plane # feature (like quota and billing) will be enabled. # Corresponds to the JSON property `environment` # @return [String] attr_accessor :environment def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @environment = args[:environment] if args.key?(:environment) end end # Customize service error responses. For example, list any service # specific protobuf types that can appear in error detail lists of # error responses. # Example: # custom_error: # types: # - google.foo.v1.CustomError # - google.foo.v1.AnotherError class CustomError include Google::Apis::Core::Hashable # The list of custom error rules that apply to individual API messages. # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::CustomErrorRule>] attr_accessor :rules # The list of custom error detail types, e.g. 'google.foo.v1.CustomError'. # Corresponds to the JSON property `types` # @return [Array<String>] attr_accessor :types def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @rules = args[:rules] if args.key?(:rules) @types = args[:types] if args.key?(:types) end end # A custom error rule. class CustomErrorRule include Google::Apis::Core::Hashable # Mark this message as possible payload in error response. Otherwise, # objects of this type will be filtered when they appear in error payload. # Corresponds to the JSON property `isErrorType` # @return [Boolean] attr_accessor :is_error_type alias_method :is_error_type?, :is_error_type # Selects messages to which this rule applies. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @is_error_type = args[:is_error_type] if args.key?(:is_error_type) @selector = args[:selector] if args.key?(:selector) end end # A custom pattern is used for defining custom HTTP verb. class CustomHttpPattern include Google::Apis::Core::Hashable # The name of this custom HTTP verb. # Corresponds to the JSON property `kind` # @return [String] attr_accessor :kind # The path matched by this custom verb. # Corresponds to the JSON property `path` # @return [String] attr_accessor :path def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @kind = args[:kind] if args.key?(:kind) @path = args[:path] if args.key?(:path) end end # Request to disable VPC service controls. class DisableVpcServiceControlsRequest include Google::Apis::Core::Hashable # Required. The network that the consumer is using to connect with services. # Must be in the form of projects/`project`/global/networks/`network` # `project` is a project number, as in '12345' # `network` is network name. # Corresponds to the JSON property `consumerNetwork` # @return [String] attr_accessor :consumer_network def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @consumer_network = args[:consumer_network] if args.key?(:consumer_network) end end # `Documentation` provides the information for describing a service. # Example: # <pre><code>documentation: # summary: > # The Google Calendar API gives access # to most calendar features. # pages: # - name: Overview # content: &#40;== include google/foo/overview.md ==&#41; # - name: Tutorial # content: &#40;== include google/foo/tutorial.md ==&#41; # subpages; # - name: Java # content: &#40;== include google/foo/tutorial_java.md ==&#41; # rules: # - selector: google.calendar.Calendar.Get # description: > # ... # - selector: google.calendar.Calendar.Put # description: > # ... # </code></pre> # Documentation is provided in markdown syntax. In addition to # standard markdown features, definition lists, tables and fenced # code blocks are supported. Section headers can be provided and are # interpreted relative to the section nesting of the context where # a documentation fragment is embedded. # Documentation from the IDL is merged with documentation defined # via the config at normalization time, where documentation provided # by config rules overrides IDL provided. # A number of constructs specific to the API platform are supported # in documentation text. # In order to reference a proto element, the following # notation can be used: # <pre><code>&#91;fully.qualified.proto.name]&#91;]</code></pre> # To override the display text used for the link, this can be used: # <pre><code>&#91;display text]&#91;fully.qualified.proto.name]</code></pre> # Text can be excluded from doc using the following notation: # <pre><code>&#40;-- internal comment --&#41;</code></pre> # A few directives are available in documentation. Note that # directives must appear on a single line to be properly # identified. The `include` directive includes a markdown file from # an external source: # <pre><code>&#40;== include path/to/file ==&#41;</code></pre> # The `resource_for` directive marks a message to be the resource of # a collection in REST view. If it is not specified, tools attempt # to infer the resource from the operations in a collection: # <pre><code>&#40;== resource_for v1.shelves.books ==&#41;</code></pre> # The directive `suppress_warning` does not directly affect documentation # and is documented together with service config validation. class Documentation include Google::Apis::Core::Hashable # The URL to the root of documentation. # Corresponds to the JSON property `documentationRootUrl` # @return [String] attr_accessor :documentation_root_url # Declares a single overview page. For example: # <pre><code>documentation: # summary: ... # overview: &#40;== include overview.md ==&#41; # </code></pre> # This is a shortcut for the following declaration (using pages style): # <pre><code>documentation: # summary: ... # pages: # - name: Overview # content: &#40;== include overview.md ==&#41; # </code></pre> # Note: you cannot specify both `overview` field and `pages` field. # Corresponds to the JSON property `overview` # @return [String] attr_accessor :overview # The top level pages for the documentation set. # Corresponds to the JSON property `pages` # @return [Array<Google::Apis::ServicenetworkingV1::Page>] attr_accessor :pages # A list of documentation rules that apply to individual API elements. # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::DocumentationRule>] attr_accessor :rules # Specifies the service root url if the default one (the service name # from the yaml file) is not suitable. This can be seen in any fully # specified service urls as well as sections that show a base that other # urls are relative to. # Corresponds to the JSON property `serviceRootUrl` # @return [String] attr_accessor :service_root_url # A short summary of what the service does. Can only be provided by # plain text. # Corresponds to the JSON property `summary` # @return [String] attr_accessor :summary def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @documentation_root_url = args[:documentation_root_url] if args.key?(:documentation_root_url) @overview = args[:overview] if args.key?(:overview) @pages = args[:pages] if args.key?(:pages) @rules = args[:rules] if args.key?(:rules) @service_root_url = args[:service_root_url] if args.key?(:service_root_url) @summary = args[:summary] if args.key?(:summary) end end # A documentation rule provides information about individual API elements. class DocumentationRule include Google::Apis::Core::Hashable # Deprecation description of the selected element(s). It can be provided if # an element is marked as `deprecated`. # Corresponds to the JSON property `deprecationDescription` # @return [String] attr_accessor :deprecation_description # Description of the selected API(s). # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # The selector is a comma-separated list of patterns. Each pattern is a # qualified name of the element which may end in "*", indicating a wildcard. # Wildcards are only allowed at the end and for a whole component of the # qualified name, i.e. "foo.*" is ok, but not "foo.b*" or "foo.*.bar". A # wildcard will match one or more components. To specify a default for all # applicable elements, the whole pattern "*" is used. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @deprecation_description = args[:deprecation_description] if args.key?(:deprecation_description) @description = args[:description] if args.key?(:description) @selector = args[:selector] if args.key?(:selector) end end # A generic empty message that you can re-use to avoid defining duplicated # empty messages in your APIs. A typical example is to use it as the request # or the response type of an API method. For instance: # service Foo ` # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); # ` # The JSON representation for `Empty` is empty JSON object ````. class Empty include Google::Apis::Core::Hashable def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) end end # Request to enable VPC service controls. class EnableVpcServiceControlsRequest include Google::Apis::Core::Hashable # Required. The network that the consumer is using to connect with services. # Must be in the form of projects/`project`/global/networks/`network` # `project` is a project number, as in '12345' # `network` is network name. # Corresponds to the JSON property `consumerNetwork` # @return [String] attr_accessor :consumer_network def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @consumer_network = args[:consumer_network] if args.key?(:consumer_network) end end # `Endpoint` describes a network endpoint that serves a set of APIs. # A service may expose any number of endpoints, and all endpoints share the # same service configuration, such as quota configuration and monitoring # configuration. # Example service configuration: # name: library-example.googleapis.com # endpoints: # # Below entry makes 'google.example.library.v1.Library' # # API be served from endpoint address library-example.googleapis.com. # # It also allows HTTP OPTIONS calls to be passed to the backend, for # # it to decide whether the subsequent cross-origin request is # # allowed to proceed. # - name: library-example.googleapis.com # allow_cors: true class Endpoint include Google::Apis::Core::Hashable # DEPRECATED: This field is no longer supported. Instead of using aliases, # please specify multiple google.api.Endpoint for each of the intended # aliases. # Additional names that this endpoint will be hosted on. # Corresponds to the JSON property `aliases` # @return [Array<String>] attr_accessor :aliases # Allowing # [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing), aka # cross-domain traffic, would allow the backends served from this endpoint to # receive and respond to HTTP OPTIONS requests. The response will be used by # the browser to determine whether the subsequent cross-origin request is # allowed to proceed. # Corresponds to the JSON property `allowCors` # @return [Boolean] attr_accessor :allow_cors alias_method :allow_cors?, :allow_cors # The list of features enabled on this endpoint. # Corresponds to the JSON property `features` # @return [Array<String>] attr_accessor :features # The canonical name of this endpoint. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The specification of an Internet routable address of API frontend that will # handle requests to this [API # Endpoint](https://cloud.google.com/apis/design/glossary). It should be # either a valid IPv4 address or a fully-qualified domain name. For example, # "8.8.8.8" or "myservice.appspot.com". # Corresponds to the JSON property `target` # @return [String] attr_accessor :target def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @aliases = args[:aliases] if args.key?(:aliases) @allow_cors = args[:allow_cors] if args.key?(:allow_cors) @features = args[:features] if args.key?(:features) @name = args[:name] if args.key?(:name) @target = args[:target] if args.key?(:target) end end # Enum type definition. class Enum include Google::Apis::Core::Hashable # Enum value definitions. # Corresponds to the JSON property `enumvalue` # @return [Array<Google::Apis::ServicenetworkingV1::EnumValue>] attr_accessor :enumvalue # Enum type name. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Protocol buffer options. # Corresponds to the JSON property `options` # @return [Array<Google::Apis::ServicenetworkingV1::Option>] attr_accessor :options # `SourceContext` represents information about the source of a # protobuf element, like the file in which it is defined. # Corresponds to the JSON property `sourceContext` # @return [Google::Apis::ServicenetworkingV1::SourceContext] attr_accessor :source_context # The source syntax. # Corresponds to the JSON property `syntax` # @return [String] attr_accessor :syntax def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @enumvalue = args[:enumvalue] if args.key?(:enumvalue) @name = args[:name] if args.key?(:name) @options = args[:options] if args.key?(:options) @source_context = args[:source_context] if args.key?(:source_context) @syntax = args[:syntax] if args.key?(:syntax) end end # Enum value definition. class EnumValue include Google::Apis::Core::Hashable # Enum value name. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Enum value number. # Corresponds to the JSON property `number` # @return [Fixnum] attr_accessor :number # Protocol buffer options. # Corresponds to the JSON property `options` # @return [Array<Google::Apis::ServicenetworkingV1::Option>] attr_accessor :options def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @name = args[:name] if args.key?(:name) @number = args[:number] if args.key?(:number) @options = args[:options] if args.key?(:options) end end # A single field of a message type. class Field include Google::Apis::Core::Hashable # The field cardinality. # Corresponds to the JSON property `cardinality` # @return [String] attr_accessor :cardinality # The string value of the default value of this field. Proto2 syntax only. # Corresponds to the JSON property `defaultValue` # @return [String] attr_accessor :default_value # The field JSON name. # Corresponds to the JSON property `jsonName` # @return [String] attr_accessor :json_name # The field type. # Corresponds to the JSON property `kind` # @return [String] attr_accessor :kind # The field name. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The field number. # Corresponds to the JSON property `number` # @return [Fixnum] attr_accessor :number # The index of the field type in `Type.oneofs`, for message or enumeration # types. The first type has index 1; zero means the type is not in the list. # Corresponds to the JSON property `oneofIndex` # @return [Fixnum] attr_accessor :oneof_index # The protocol buffer options. # Corresponds to the JSON property `options` # @return [Array<Google::Apis::ServicenetworkingV1::Option>] attr_accessor :options # Whether to use alternative packed wire representation. # Corresponds to the JSON property `packed` # @return [Boolean] attr_accessor :packed alias_method :packed?, :packed # The field type URL, without the scheme, for message or enumeration # types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. # Corresponds to the JSON property `typeUrl` # @return [String] attr_accessor :type_url def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @cardinality = args[:cardinality] if args.key?(:cardinality) @default_value = args[:default_value] if args.key?(:default_value) @json_name = args[:json_name] if args.key?(:json_name) @kind = args[:kind] if args.key?(:kind) @name = args[:name] if args.key?(:name) @number = args[:number] if args.key?(:number) @oneof_index = args[:oneof_index] if args.key?(:oneof_index) @options = args[:options] if args.key?(:options) @packed = args[:packed] if args.key?(:packed) @type_url = args[:type_url] if args.key?(:type_url) end end # Represents a subnet that was created or discovered by a private access # management service. class GoogleCloudServicenetworkingV1betaSubnetwork include Google::Apis::Core::Hashable # Subnetwork CIDR range in `10.x.x.x/y` format. # Corresponds to the JSON property `ipCidrRange` # @return [String] attr_accessor :ip_cidr_range # Subnetwork name. # See https://cloud.google.com/compute/docs/vpc/ # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # In the Shared VPC host project, the VPC network that's peered with the # consumer network. For example: # `projects/1234321/global/networks/host-network` # Corresponds to the JSON property `network` # @return [String] attr_accessor :network # This is a discovered subnet that is not within the current consumer # allocated ranges. # Corresponds to the JSON property `outsideAllocation` # @return [Boolean] attr_accessor :outside_allocation alias_method :outside_allocation?, :outside_allocation def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @ip_cidr_range = args[:ip_cidr_range] if args.key?(:ip_cidr_range) @name = args[:name] if args.key?(:name) @network = args[:network] if args.key?(:network) @outside_allocation = args[:outside_allocation] if args.key?(:outside_allocation) end end # Defines the HTTP configuration for an API service. It contains a list of # HttpRule, each specifying the mapping of an RPC method # to one or more HTTP REST API methods. class Http include Google::Apis::Core::Hashable # When set to true, URL path parameters will be fully URI-decoded except in # cases of single segment matches in reserved expansion, where "%2F" will be # left encoded. # The default behavior is to not decode RFC 6570 reserved characters in multi # segment matches. # Corresponds to the JSON property `fullyDecodeReservedExpansion` # @return [Boolean] attr_accessor :fully_decode_reserved_expansion alias_method :fully_decode_reserved_expansion?, :fully_decode_reserved_expansion # A list of HTTP configuration rules that apply to individual API methods. # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::HttpRule>] attr_accessor :rules def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @fully_decode_reserved_expansion = args[:fully_decode_reserved_expansion] if args.key?(:fully_decode_reserved_expansion) @rules = args[:rules] if args.key?(:rules) end end # # gRPC Transcoding # gRPC Transcoding is a feature for mapping between a gRPC method and one or # more HTTP REST endpoints. It allows developers to build a single API service # that supports both gRPC APIs and REST APIs. Many systems, including [Google # APIs](https://github.com/googleapis/googleapis), # [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC # Gateway](https://github.com/grpc-ecosystem/grpc-gateway), # and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature # and use it for large scale production services. # `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies # how different portions of the gRPC request message are mapped to the URL # path, URL query parameters, and HTTP request body. It also controls how the # gRPC response message is mapped to the HTTP response body. `HttpRule` is # typically specified as an `google.api.http` annotation on the gRPC method. # Each mapping specifies a URL path template and an HTTP method. The path # template may refer to one or more fields in the gRPC request message, as long # as each field is a non-repeated field with a primitive (non-message) type. # The path template controls how fields of the request message are mapped to # the URL path. # Example: # service Messaging ` # rpc GetMessage(GetMessageRequest) returns (Message) ` # option (google.api.http) = ` # get: "/v1/`name=messages/*`" # `; # ` # ` # message GetMessageRequest ` # string name = 1; // Mapped to URL path. # ` # message Message ` # string text = 1; // The resource content. # ` # This enables an HTTP REST to gRPC mapping as below: # HTTP | gRPC # -----|----- # `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` # Any fields in the request message which are not bound by the path template # automatically become HTTP query parameters if there is no HTTP request body. # For example: # service Messaging ` # rpc GetMessage(GetMessageRequest) returns (Message) ` # option (google.api.http) = ` # get:"/v1/messages/`message_id`" # `; # ` # ` # message GetMessageRequest ` # message SubMessage ` # string subfield = 1; # ` # string message_id = 1; // Mapped to URL path. # int64 revision = 2; // Mapped to URL query parameter `revision`. # SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. # ` # This enables a HTTP JSON to RPC mapping as below: # HTTP | gRPC # -----|----- # `GET /v1/messages/123456?revision=2&sub.subfield=foo` | # `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: # "foo"))` # Note that fields which are mapped to URL query parameters must have a # primitive type or a repeated primitive type or a non-repeated message type. # In the case of a repeated type, the parameter can be repeated in the URL # as `...?param=A&param=B`. In the case of a message type, each field of the # message is mapped to a separate parameter, such as # `...?foo.a=A&foo.b=B&foo.c=C`. # For HTTP methods that allow a request body, the `body` field # specifies the mapping. Consider a REST update method on the # message resource collection: # service Messaging ` # rpc UpdateMessage(UpdateMessageRequest) returns (Message) ` # option (google.api.http) = ` # patch: "/v1/messages/`message_id`" # body: "message" # `; # ` # ` # message UpdateMessageRequest ` # string message_id = 1; // mapped to the URL # Message message = 2; // mapped to the body # ` # The following HTTP JSON to RPC mapping is enabled, where the # representation of the JSON in the request body is determined by # protos JSON encoding: # HTTP | gRPC # -----|----- # `PATCH /v1/messages/123456 ` "text": "Hi!" `` | `UpdateMessage(message_id: # "123456" message ` text: "Hi!" `)` # The special name `*` can be used in the body mapping to define that # every field not bound by the path template should be mapped to the # request body. This enables the following alternative definition of # the update method: # service Messaging ` # rpc UpdateMessage(Message) returns (Message) ` # option (google.api.http) = ` # patch: "/v1/messages/`message_id`" # body: "*" # `; # ` # ` # message Message ` # string message_id = 1; # string text = 2; # ` # The following HTTP JSON to RPC mapping is enabled: # HTTP | gRPC # -----|----- # `PATCH /v1/messages/123456 ` "text": "Hi!" `` | `UpdateMessage(message_id: # "123456" text: "Hi!")` # Note that when using `*` in the body mapping, it is not possible to # have HTTP parameters, as all fields not bound by the path end in # the body. This makes this option more rarely used in practice when # defining REST APIs. The common usage of `*` is in custom methods # which don't use the URL at all for transferring data. # It is possible to define multiple HTTP methods for one RPC by using # the `additional_bindings` option. Example: # service Messaging ` # rpc GetMessage(GetMessageRequest) returns (Message) ` # option (google.api.http) = ` # get: "/v1/messages/`message_id`" # additional_bindings ` # get: "/v1/users/`user_id`/messages/`message_id`" # ` # `; # ` # ` # message GetMessageRequest ` # string message_id = 1; # string user_id = 2; # ` # This enables the following two alternative HTTP JSON to RPC mappings: # HTTP | gRPC # -----|----- # `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` # `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: # "123456")` # ## Rules for HTTP mapping # 1. Leaf request fields (recursive expansion nested messages in the request # message) are classified into three categories: # - Fields referred by the path template. They are passed via the URL path. # - Fields referred by the HttpRule.body. They are passed via the HTTP # request body. # - All other fields are passed via the URL query parameters, and the # parameter name is the field path in the request message. A repeated # field can be represented as multiple query parameters under the same # name. # 2. If HttpRule.body is "*", there is no URL query parameter, all fields # are passed via URL path and HTTP request body. # 3. If HttpRule.body is omitted, there is no HTTP request body, all # fields are passed via URL path and URL query parameters. # ### Path template syntax # Template = "/" Segments [ Verb ] ; # Segments = Segment ` "/" Segment ` ; # Segment = "*" | "**" | LITERAL | Variable ; # Variable = "`" FieldPath [ "=" Segments ] "`" ; # FieldPath = IDENT ` "." IDENT ` ; # Verb = ":" LITERAL ; # The syntax `*` matches a single URL path segment. The syntax `**` matches # zero or more URL path segments, which must be the last part of the URL path # except the `Verb`. # The syntax `Variable` matches part of the URL path as specified by its # template. A variable template must not contain other variables. If a variable # matches a single path segment, its template may be omitted, e.g. ``var`` # is equivalent to ``var=*``. # The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` # contains any reserved character, such characters should be percent-encoded # before the matching. # If a variable contains exactly one path segment, such as `"`var`"` or # `"`var=*`"`, when such a variable is expanded into a URL path on the client # side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The # server side does the reverse decoding. Such variables show up in the # [Discovery # Document](https://developers.google.com/discovery/v1/reference/apis) as # ``var``. # If a variable contains multiple path segments, such as `"`var=foo/*`"` # or `"`var=**`"`, when such a variable is expanded into a URL path on the # client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. # The server side does the reverse decoding, except "%2F" and "%2f" are left # unchanged. Such variables show up in the # [Discovery # Document](https://developers.google.com/discovery/v1/reference/apis) as # ``+var``. # ## Using gRPC API Service Configuration # gRPC API Service Configuration (service config) is a configuration language # for configuring a gRPC service to become a user-facing product. The # service config is simply the YAML representation of the `google.api.Service` # proto message. # As an alternative to annotating your proto file, you can configure gRPC # transcoding in your service config YAML files. You do this by specifying a # `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same # effect as the proto annotation. This can be particularly useful if you # have a proto that is reused in multiple services. Note that any transcoding # specified in the service config will override any matching transcoding # configuration in the proto. # Example: # http: # rules: # # Selects a gRPC method and applies HttpRule to it. # - selector: example.v1.Messaging.GetMessage # get: /v1/messages/`message_id`/`sub.subfield` # ## Special notes # When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the # proto to JSON conversion must follow the [proto3 # specification](https://developers.google.com/protocol-buffers/docs/proto3#json) # . # While the single segment variable follows the semantics of # [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String # Expansion, the multi segment variable **does not** follow RFC 6570 Section # 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion # does not expand special characters like `?` and `#`, which would lead # to invalid URLs. As the result, gRPC Transcoding uses a custom encoding # for multi segment variables. # The path variables **must not** refer to any repeated or mapped field, # because client libraries are not capable of handling such variable expansion. # The path variables **must not** capture the leading "/" character. The reason # is that the most common use case "`var`" does not capture the leading "/" # character. For consistency, all path variables must share the same behavior. # Repeated message fields must not be mapped to URL query parameters, because # no client library can support such complicated mapping. # If an API needs to use a JSON array for request or response body, it can map # the request or response body to a repeated field. However, some gRPC # Transcoding implementations may not support this feature. class HttpRule include Google::Apis::Core::Hashable # Additional HTTP bindings for the selector. Nested bindings must # not contain an `additional_bindings` field themselves (that is, # the nesting may only be one level deep). # Corresponds to the JSON property `additionalBindings` # @return [Array<Google::Apis::ServicenetworkingV1::HttpRule>] attr_accessor :additional_bindings # When this flag is set to true, HTTP requests will be allowed to invoke a # half-duplex streaming method. # Corresponds to the JSON property `allowHalfDuplex` # @return [Boolean] attr_accessor :allow_half_duplex alias_method :allow_half_duplex?, :allow_half_duplex # The name of the request field whose value is mapped to the HTTP request # body, or `*` for mapping all request fields not captured by the path # pattern to the HTTP body, or omitted for not having any HTTP request body. # NOTE: the referred field must be present at the top-level of the request # message type. # Corresponds to the JSON property `body` # @return [String] attr_accessor :body # A custom pattern is used for defining custom HTTP verb. # Corresponds to the JSON property `custom` # @return [Google::Apis::ServicenetworkingV1::CustomHttpPattern] attr_accessor :custom # Maps to HTTP DELETE. Used for deleting a resource. # Corresponds to the JSON property `delete` # @return [String] attr_accessor :delete # Maps to HTTP GET. Used for listing and getting information about # resources. # Corresponds to the JSON property `get` # @return [String] attr_accessor :get # Maps to HTTP PATCH. Used for updating a resource. # Corresponds to the JSON property `patch` # @return [String] attr_accessor :patch # Maps to HTTP POST. Used for creating a resource or performing an action. # Corresponds to the JSON property `post` # @return [String] attr_accessor :post # Maps to HTTP PUT. Used for replacing a resource. # Corresponds to the JSON property `put` # @return [String] attr_accessor :put # Optional. The name of the response field whose value is mapped to the HTTP # response body. When omitted, the entire response message will be used # as the HTTP response body. # NOTE: The referred field must be present at the top-level of the response # message type. # Corresponds to the JSON property `responseBody` # @return [String] attr_accessor :response_body # Selects a method to which this rule applies. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @additional_bindings = args[:additional_bindings] if args.key?(:additional_bindings) @allow_half_duplex = args[:allow_half_duplex] if args.key?(:allow_half_duplex) @body = args[:body] if args.key?(:body) @custom = args[:custom] if args.key?(:custom) @delete = args[:delete] if args.key?(:delete) @get = args[:get] if args.key?(:get) @patch = args[:patch] if args.key?(:patch) @post = args[:post] if args.key?(:post) @put = args[:put] if args.key?(:put) @response_body = args[:response_body] if args.key?(:response_body) @selector = args[:selector] if args.key?(:selector) end end # Specifies a location to extract JWT from an API request. class JwtLocation include Google::Apis::Core::Hashable # Specifies HTTP header name to extract JWT token. # Corresponds to the JSON property `header` # @return [String] attr_accessor :header # Specifies URL query parameter name to extract JWT token. # Corresponds to the JSON property `query` # @return [String] attr_accessor :query # The value prefix. The value format is "value_prefix`token`" # Only applies to "in" header type. Must be empty for "in" query type. # If not empty, the header value has to match (case sensitive) this prefix. # If not matched, JWT will not be extracted. If matched, JWT will be # extracted after the prefix is removed. # For example, for "Authorization: Bearer `JWT`", # value_prefix="Bearer " with a space at the end. # Corresponds to the JSON property `valuePrefix` # @return [String] attr_accessor :value_prefix def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @header = args[:header] if args.key?(:header) @query = args[:query] if args.key?(:query) @value_prefix = args[:value_prefix] if args.key?(:value_prefix) end end # A description of a label. class LabelDescriptor include Google::Apis::Core::Hashable # A human-readable description for the label. # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # The label key. # Corresponds to the JSON property `key` # @return [String] attr_accessor :key # The type of data that can be assigned to the label. # Corresponds to the JSON property `valueType` # @return [String] attr_accessor :value_type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @description = args[:description] if args.key?(:description) @key = args[:key] if args.key?(:key) @value_type = args[:value_type] if args.key?(:value_type) end end # ListConnectionsResponse is the response to list peering states for the # given service and consumer project. class ListConnectionsResponse include Google::Apis::Core::Hashable # The list of Connections. # Corresponds to the JSON property `connections` # @return [Array<Google::Apis::ServicenetworkingV1::Connection>] attr_accessor :connections def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @connections = args[:connections] if args.key?(:connections) end end # The response message for Operations.ListOperations. class ListOperationsResponse include Google::Apis::Core::Hashable # The standard List next-page token. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token # A list of operations that matches the specified filter in the request. # Corresponds to the JSON property `operations` # @return [Array<Google::Apis::ServicenetworkingV1::Operation>] attr_accessor :operations def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) @operations = args[:operations] if args.key?(:operations) end end # A description of a log type. Example in YAML format: # - name: library.googleapis.com/activity_history # description: The history of borrowing and returning library items. # display_name: Activity # labels: # - key: /customer_id # description: Identifier of a library customer class LogDescriptor include Google::Apis::Core::Hashable # A human-readable description of this log. This information appears in # the documentation and can contain details. # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # The human-readable name for this log. This information appears on # the user interface and should be concise. # Corresponds to the JSON property `displayName` # @return [String] attr_accessor :display_name # The set of labels that are available to describe a specific log entry. # Runtime requests that contain labels not specified here are # considered invalid. # Corresponds to the JSON property `labels` # @return [Array<Google::Apis::ServicenetworkingV1::LabelDescriptor>] attr_accessor :labels # The name of the log. It must be less than 512 characters long and can # include the following characters: upper- and lower-case alphanumeric # characters [A-Za-z0-9], and punctuation characters including # slash, underscore, hyphen, period [/_-.]. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @description = args[:description] if args.key?(:description) @display_name = args[:display_name] if args.key?(:display_name) @labels = args[:labels] if args.key?(:labels) @name = args[:name] if args.key?(:name) end end # Logging configuration of the service. # The following example shows how to configure logs to be sent to the # producer and consumer projects. In the example, the `activity_history` # log is sent to both the producer and consumer projects, whereas the # `purchase_history` log is only sent to the producer project. # monitored_resources: # - type: library.googleapis.com/branch # labels: # - key: /city # description: The city where the library branch is located in. # - key: /name # description: The name of the branch. # logs: # - name: activity_history # labels: # - key: /customer_id # - name: purchase_history # logging: # producer_destinations: # - monitored_resource: library.googleapis.com/branch # logs: # - activity_history # - purchase_history # consumer_destinations: # - monitored_resource: library.googleapis.com/branch # logs: # - activity_history class Logging include Google::Apis::Core::Hashable # Logging configurations for sending logs to the consumer project. # There can be multiple consumer destinations, each one must have a # different monitored resource type. A log can be used in at most # one consumer destination. # Corresponds to the JSON property `consumerDestinations` # @return [Array<Google::Apis::ServicenetworkingV1::LoggingDestination>] attr_accessor :consumer_destinations # Logging configurations for sending logs to the producer project. # There can be multiple producer destinations, each one must have a # different monitored resource type. A log can be used in at most # one producer destination. # Corresponds to the JSON property `producerDestinations` # @return [Array<Google::Apis::ServicenetworkingV1::LoggingDestination>] attr_accessor :producer_destinations def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @consumer_destinations = args[:consumer_destinations] if args.key?(:consumer_destinations) @producer_destinations = args[:producer_destinations] if args.key?(:producer_destinations) end end # Configuration of a specific logging destination (the producer project # or the consumer project). class LoggingDestination include Google::Apis::Core::Hashable # Names of the logs to be sent to this destination. Each name must # be defined in the Service.logs section. If the log name is # not a domain scoped name, it will be automatically prefixed with # the service name followed by "/". # Corresponds to the JSON property `logs` # @return [Array<String>] attr_accessor :logs # The monitored resource type. The type must be defined in the # Service.monitored_resources section. # Corresponds to the JSON property `monitoredResource` # @return [String] attr_accessor :monitored_resource def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @logs = args[:logs] if args.key?(:logs) @monitored_resource = args[:monitored_resource] if args.key?(:monitored_resource) end end # Method represents a method of an API interface. class MethodProp include Google::Apis::Core::Hashable # The simple name of this method. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Any metadata attached to the method. # Corresponds to the JSON property `options` # @return [Array<Google::Apis::ServicenetworkingV1::Option>] attr_accessor :options # If true, the request is streamed. # Corresponds to the JSON property `requestStreaming` # @return [Boolean] attr_accessor :request_streaming alias_method :request_streaming?, :request_streaming # A URL of the input message type. # Corresponds to the JSON property `requestTypeUrl` # @return [String] attr_accessor :request_type_url # If true, the response is streamed. # Corresponds to the JSON property `responseStreaming` # @return [Boolean] attr_accessor :response_streaming alias_method :response_streaming?, :response_streaming # The URL of the output message type. # Corresponds to the JSON property `responseTypeUrl` # @return [String] attr_accessor :response_type_url # The source syntax of this method. # Corresponds to the JSON property `syntax` # @return [String] attr_accessor :syntax def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @name = args[:name] if args.key?(:name) @options = args[:options] if args.key?(:options) @request_streaming = args[:request_streaming] if args.key?(:request_streaming) @request_type_url = args[:request_type_url] if args.key?(:request_type_url) @response_streaming = args[:response_streaming] if args.key?(:response_streaming) @response_type_url = args[:response_type_url] if args.key?(:response_type_url) @syntax = args[:syntax] if args.key?(:syntax) end end # Defines a metric type and its schema. Once a metric descriptor is created, # deleting or altering it stops data collection and makes the metric type's # existing data unusable. class MetricDescriptor include Google::Apis::Core::Hashable # A detailed description of the metric, which can be used in documentation. # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # A concise name for the metric, which can be displayed in user interfaces. # Use sentence case without an ending period, for example "Request count". # This field is optional but it is recommended to be set for any metrics # associated with user-visible concepts, such as Quota. # Corresponds to the JSON property `displayName` # @return [String] attr_accessor :display_name # The set of labels that can be used to describe a specific # instance of this metric type. For example, the # `appengine.googleapis.com/http/server/response_latencies` metric # type has a label for the HTTP response code, `response_code`, so # you can look at latencies for successful responses or just # for responses that failed. # Corresponds to the JSON property `labels` # @return [Array<Google::Apis::ServicenetworkingV1::LabelDescriptor>] attr_accessor :labels # Optional. The launch stage of the metric definition. # Corresponds to the JSON property `launchStage` # @return [String] attr_accessor :launch_stage # Additional annotations that can be used to guide the usage of a metric. # Corresponds to the JSON property `metadata` # @return [Google::Apis::ServicenetworkingV1::MetricDescriptorMetadata] attr_accessor :metadata # Whether the metric records instantaneous values, changes to a value, etc. # Some combinations of `metric_kind` and `value_type` might not be supported. # Corresponds to the JSON property `metricKind` # @return [String] attr_accessor :metric_kind # Read-only. If present, then a time # series, which is identified partially by # a metric type and a MonitoredResourceDescriptor, that is associated # with this metric type can only be associated with one of the monitored # resource types listed here. # Corresponds to the JSON property `monitoredResourceTypes` # @return [Array<String>] attr_accessor :monitored_resource_types # The resource name of the metric descriptor. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The metric type, including its DNS name prefix. The type is not # URL-encoded. All user-defined metric types have the DNS name # `custom.googleapis.com` or `external.googleapis.com`. Metric types should # use a natural hierarchical grouping. For example: # "custom.googleapis.com/invoice/paid/amount" # "external.googleapis.com/prometheus/up" # "appengine.googleapis.com/http/server/response_latencies" # Corresponds to the JSON property `type` # @return [String] attr_accessor :type # The units in which the metric value is reported. It is only applicable # if the `value_type` is `INT64`, `DOUBLE`, or `DISTRIBUTION`. The `unit` # defines the representation of the stored metric values. # Different systems may scale the values to be more easily displayed (so a # value of `0.02KBy` _might_ be displayed as `20By`, and a value of # `3523KBy` _might_ be displayed as `3.5MBy`). However, if the `unit` is # `KBy`, then the value of the metric is always in thousands of bytes, no # matter how it may be displayed.. # If you want a custom metric to record the exact number of CPU-seconds used # by a job, you can create an `INT64 CUMULATIVE` metric whose `unit` is # `s`CPU`` (or equivalently `1s`CPU`` or just `s`). If the job uses 12,005 # CPU-seconds, then the value is written as `12005`. # Alternatively, if you want a custom metric to record data in a more # granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is # `ks`CPU``, and then write the value `12.005` (which is `12005/1000`), # or use `Kis`CPU`` and write `11.723` (which is `12005/1024`). # The supported units are a subset of [The Unified Code for Units of # Measure](http://unitsofmeasure.org/ucum.html) standard: # **Basic units (UNIT)** # * `bit` bit # * `By` byte # * `s` second # * `min` minute # * `h` hour # * `d` day # **Prefixes (PREFIX)** # * `k` kilo (10^3) # * `M` mega (10^6) # * `G` giga (10^9) # * `T` tera (10^12) # * `P` peta (10^15) # * `E` exa (10^18) # * `Z` zetta (10^21) # * `Y` yotta (10^24) # * `m` milli (10^-3) # * `u` micro (10^-6) # * `n` nano (10^-9) # * `p` pico (10^-12) # * `f` femto (10^-15) # * `a` atto (10^-18) # * `z` zepto (10^-21) # * `y` yocto (10^-24) # * `Ki` kibi (2^10) # * `Mi` mebi (2^20) # * `Gi` gibi (2^30) # * `Ti` tebi (2^40) # * `Pi` pebi (2^50) # **Grammar** # The grammar also includes these connectors: # * `/` division or ratio (as an infix operator). For examples, # `kBy/`email`` or `MiBy/10ms` (although you should almost never # have `/s` in a metric `unit`; rates should always be computed at # query time from the underlying cumulative or delta value). # * `.` multiplication or composition (as an infix operator). For # examples, `GBy.d` or `k`watt`.h`. # The grammar for a unit is as follows: # Expression = Component ` "." Component ` ` "/" Component ` ; # Component = ( [ PREFIX ] UNIT | "%" ) [ Annotation ] # | Annotation # | "1" # ; # Annotation = "`" NAME "`" ; # Notes: # * `Annotation` is just a comment if it follows a `UNIT`. If the annotation # is used alone, then the unit is equivalent to `1`. For examples, # ``request`/s == 1/s`, `By`transmitted`/s == By/s`. # * `NAME` is a sequence of non-blank printable ASCII characters not # containing ``` or ```. # * `1` represents a unitary [dimensionless # unit](https://en.wikipedia.org/wiki/Dimensionless_quantity) of 1, such # as in `1/s`. It is typically used when none of the basic units are # appropriate. For example, "new users per day" can be represented as # `1/d` or ``new-users`/d` (and a metric value `5` would mean "5 new # users). Alternatively, "thousands of page views per day" would be # represented as `1000/d` or `k1/d` or `k`page_views`/d` (and a metric # value of `5.3` would mean "5300 page views per day"). # * `%` represents dimensionless value of 1/100, and annotates values giving # a percentage (so the metric values are typically in the range of 0..100, # and a metric value `3` means "3 percent"). # * `10^2.%` indicates a metric contains a ratio, typically in the range # 0..1, that will be multiplied by 100 and displayed as a percentage # (so a metric value `0.03` means "3 percent"). # Corresponds to the JSON property `unit` # @return [String] attr_accessor :unit # Whether the measurement is an integer, a floating-point number, etc. # Some combinations of `metric_kind` and `value_type` might not be supported. # Corresponds to the JSON property `valueType` # @return [String] attr_accessor :value_type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @description = args[:description] if args.key?(:description) @display_name = args[:display_name] if args.key?(:display_name) @labels = args[:labels] if args.key?(:labels) @launch_stage = args[:launch_stage] if args.key?(:launch_stage) @metadata = args[:metadata] if args.key?(:metadata) @metric_kind = args[:metric_kind] if args.key?(:metric_kind) @monitored_resource_types = args[:monitored_resource_types] if args.key?(:monitored_resource_types) @name = args[:name] if args.key?(:name) @type = args[:type] if args.key?(:type) @unit = args[:unit] if args.key?(:unit) @value_type = args[:value_type] if args.key?(:value_type) end end # Additional annotations that can be used to guide the usage of a metric. class MetricDescriptorMetadata include Google::Apis::Core::Hashable # The delay of data points caused by ingestion. Data points older than this # age are guaranteed to be ingested and available to be read, excluding # data loss due to errors. # Corresponds to the JSON property `ingestDelay` # @return [String] attr_accessor :ingest_delay # Deprecated. Must use the MetricDescriptor.launch_stage instead. # Corresponds to the JSON property `launchStage` # @return [String] attr_accessor :launch_stage # The sampling period of metric data points. For metrics which are written # periodically, consecutive data points are stored at this time interval, # excluding data loss due to errors. Metrics with a higher granularity have # a smaller sampling period. # Corresponds to the JSON property `samplePeriod` # @return [String] attr_accessor :sample_period def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @ingest_delay = args[:ingest_delay] if args.key?(:ingest_delay) @launch_stage = args[:launch_stage] if args.key?(:launch_stage) @sample_period = args[:sample_period] if args.key?(:sample_period) end end # Bind API methods to metrics. Binding a method to a metric causes that # metric's configured quota behaviors to apply to the method call. class MetricRule include Google::Apis::Core::Hashable # Metrics to update when the selected methods are called, and the associated # cost applied to each metric. # The key of the map is the metric name, and the values are the amount # increased for the metric against which the quota limits are defined. # The value must not be negative. # Corresponds to the JSON property `metricCosts` # @return [Hash<String,Fixnum>] attr_accessor :metric_costs # Selects the methods to which this rule applies. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @metric_costs = args[:metric_costs] if args.key?(:metric_costs) @selector = args[:selector] if args.key?(:selector) end end # Declares an API Interface to be included in this interface. The including # interface must redeclare all the methods from the included interface, but # documentation and options are inherited as follows: # - If after comment and whitespace stripping, the documentation # string of the redeclared method is empty, it will be inherited # from the original method. # - Each annotation belonging to the service config (http, # visibility) which is not set in the redeclared method will be # inherited. # - If an http annotation is inherited, the path pattern will be # modified as follows. Any version prefix will be replaced by the # version of the including interface plus the root path if # specified. # Example of a simple mixin: # package google.acl.v1; # service AccessControl ` # // Get the underlying ACL object. # rpc GetAcl(GetAclRequest) returns (Acl) ` # option (google.api.http).get = "/v1/`resource=**`:getAcl"; # ` # ` # package google.storage.v2; # service Storage ` # // rpc GetAcl(GetAclRequest) returns (Acl); # // Get a data record. # rpc GetData(GetDataRequest) returns (Data) ` # option (google.api.http).get = "/v2/`resource=**`"; # ` # ` # Example of a mixin configuration: # apis: # - name: google.storage.v2.Storage # mixins: # - name: google.acl.v1.AccessControl # The mixin construct implies that all methods in `AccessControl` are # also declared with same name and request/response types in # `Storage`. A documentation generator or annotation processor will # see the effective `Storage.GetAcl` method after inherting # documentation and annotations as follows: # service Storage ` # // Get the underlying ACL object. # rpc GetAcl(GetAclRequest) returns (Acl) ` # option (google.api.http).get = "/v2/`resource=**`:getAcl"; # ` # ... # ` # Note how the version in the path pattern changed from `v1` to `v2`. # If the `root` field in the mixin is specified, it should be a # relative path under which inherited HTTP paths are placed. Example: # apis: # - name: google.storage.v2.Storage # mixins: # - name: google.acl.v1.AccessControl # root: acls # This implies the following inherited HTTP annotation: # service Storage ` # // Get the underlying ACL object. # rpc GetAcl(GetAclRequest) returns (Acl) ` # option (google.api.http).get = "/v2/acls/`resource=**`:getAcl"; # ` # ... # ` class Mixin include Google::Apis::Core::Hashable # The fully qualified name of the interface which is included. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # If non-empty specifies a path under which inherited HTTP paths # are rooted. # Corresponds to the JSON property `root` # @return [String] attr_accessor :root def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @name = args[:name] if args.key?(:name) @root = args[:root] if args.key?(:root) end end # An object that describes the schema of a MonitoredResource object using a # type name and a set of labels. For example, the monitored resource # descriptor for Google Compute Engine VM instances has a type of # `"gce_instance"` and specifies the use of the labels `"instance_id"` and # `"zone"` to identify particular VM instances. # Different APIs can support different monitored resource types. APIs generally # provide a `list` method that returns the monitored resource descriptors used # by the API. class MonitoredResourceDescriptor include Google::Apis::Core::Hashable # Optional. A detailed description of the monitored resource type that might # be used in documentation. # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # Optional. A concise name for the monitored resource type that might be # displayed in user interfaces. It should be a Title Cased Noun Phrase, # without any article or other determiners. For example, # `"Google Cloud SQL Database"`. # Corresponds to the JSON property `displayName` # @return [String] attr_accessor :display_name # Required. A set of labels used to describe instances of this monitored # resource type. For example, an individual Google Cloud SQL database is # identified by values for the labels `"database_id"` and `"zone"`. # Corresponds to the JSON property `labels` # @return [Array<Google::Apis::ServicenetworkingV1::LabelDescriptor>] attr_accessor :labels # Optional. The launch stage of the monitored resource definition. # Corresponds to the JSON property `launchStage` # @return [String] attr_accessor :launch_stage # Optional. The resource name of the monitored resource descriptor: # `"projects/`project_id`/monitoredResourceDescriptors/`type`"` where # `type` is the value of the `type` field in this object and # `project_id` is a project ID that provides API-specific context for # accessing the type. APIs that do not use project information can use the # resource name format `"monitoredResourceDescriptors/`type`"`. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Required. The monitored resource type. For example, the type # `"cloudsql_database"` represents databases in Google Cloud SQL. # The maximum length of this value is 256 characters. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @description = args[:description] if args.key?(:description) @display_name = args[:display_name] if args.key?(:display_name) @labels = args[:labels] if args.key?(:labels) @launch_stage = args[:launch_stage] if args.key?(:launch_stage) @name = args[:name] if args.key?(:name) @type = args[:type] if args.key?(:type) end end # Monitoring configuration of the service. # The example below shows how to configure monitored resources and metrics # for monitoring. In the example, a monitored resource and two metrics are # defined. The `library.googleapis.com/book/returned_count` metric is sent # to both producer and consumer projects, whereas the # `library.googleapis.com/book/overdue_count` metric is only sent to the # consumer project. # monitored_resources: # - type: library.googleapis.com/branch # labels: # - key: /city # description: The city where the library branch is located in. # - key: /name # description: The name of the branch. # metrics: # - name: library.googleapis.com/book/returned_count # metric_kind: DELTA # value_type: INT64 # labels: # - key: /customer_id # - name: library.googleapis.com/book/overdue_count # metric_kind: GAUGE # value_type: INT64 # labels: # - key: /customer_id # monitoring: # producer_destinations: # - monitored_resource: library.googleapis.com/branch # metrics: # - library.googleapis.com/book/returned_count # consumer_destinations: # - monitored_resource: library.googleapis.com/branch # metrics: # - library.googleapis.com/book/returned_count # - library.googleapis.com/book/overdue_count class Monitoring include Google::Apis::Core::Hashable # Monitoring configurations for sending metrics to the consumer project. # There can be multiple consumer destinations. A monitored resouce type may # appear in multiple monitoring destinations if different aggregations are # needed for different sets of metrics associated with that monitored # resource type. A monitored resource and metric pair may only be used once # in the Monitoring configuration. # Corresponds to the JSON property `consumerDestinations` # @return [Array<Google::Apis::ServicenetworkingV1::MonitoringDestination>] attr_accessor :consumer_destinations # Monitoring configurations for sending metrics to the producer project. # There can be multiple producer destinations. A monitored resouce type may # appear in multiple monitoring destinations if different aggregations are # needed for different sets of metrics associated with that monitored # resource type. A monitored resource and metric pair may only be used once # in the Monitoring configuration. # Corresponds to the JSON property `producerDestinations` # @return [Array<Google::Apis::ServicenetworkingV1::MonitoringDestination>] attr_accessor :producer_destinations def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @consumer_destinations = args[:consumer_destinations] if args.key?(:consumer_destinations) @producer_destinations = args[:producer_destinations] if args.key?(:producer_destinations) end end # Configuration of a specific monitoring destination (the producer project # or the consumer project). class MonitoringDestination include Google::Apis::Core::Hashable # Types of the metrics to report to this monitoring destination. # Each type must be defined in Service.metrics section. # Corresponds to the JSON property `metrics` # @return [Array<String>] attr_accessor :metrics # The monitored resource type. The type must be defined in # Service.monitored_resources section. # Corresponds to the JSON property `monitoredResource` # @return [String] attr_accessor :monitored_resource def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @metrics = args[:metrics] if args.key?(:metrics) @monitored_resource = args[:monitored_resource] if args.key?(:monitored_resource) end end # OAuth scopes are a way to define data and permissions on data. For example, # there are scopes defined for "Read-only access to Google Calendar" and # "Access to Cloud Platform". Users can consent to a scope for an application, # giving it permission to access that data on their behalf. # OAuth scope specifications should be fairly coarse grained; a user will need # to see and understand the text description of what your scope means. # In most cases: use one or at most two OAuth scopes for an entire family of # products. If your product has multiple APIs, you should probably be sharing # the OAuth scope across all of those APIs. # When you need finer grained OAuth consent screens: talk with your product # management about how developers will use them in practice. # Please note that even though each of the canonical scopes is enough for a # request to be accepted and passed to the backend, a request can still fail # due to the backend requiring additional scopes or permissions. class OAuthRequirements include Google::Apis::Core::Hashable # The list of publicly documented OAuth scopes that are allowed access. An # OAuth token containing any of these scopes will be accepted. # Example: # canonical_scopes: https://www.googleapis.com/auth/calendar, # https://www.googleapis.com/auth/calendar.read # Corresponds to the JSON property `canonicalScopes` # @return [String] attr_accessor :canonical_scopes def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @canonical_scopes = args[:canonical_scopes] if args.key?(:canonical_scopes) end end # This resource represents a long-running operation that is the result of a # network API call. class Operation include Google::Apis::Core::Hashable # If the value is `false`, it means the operation is still in progress. # If `true`, the operation is completed, and either `error` or `response` is # available. # Corresponds to the JSON property `done` # @return [Boolean] attr_accessor :done alias_method :done?, :done # The `Status` type defines a logical error model that is suitable for # different programming environments, including REST APIs and RPC APIs. It is # used by [gRPC](https://github.com/grpc). Each `Status` message contains # three pieces of data: error code, error message, and error details. # You can find out more about this error model and how to work with it in the # [API Design Guide](https://cloud.google.com/apis/design/errors). # Corresponds to the JSON property `error` # @return [Google::Apis::ServicenetworkingV1::Status] attr_accessor :error # Service-specific metadata associated with the operation. It typically # contains progress information and common metadata such as create time. # Some services might not provide such metadata. Any method that returns a # long-running operation should document the metadata type, if any. # Corresponds to the JSON property `metadata` # @return [Hash<String,Object>] attr_accessor :metadata # The server-assigned name, which is only unique within the same service that # originally returns it. If you use the default HTTP mapping, the # `name` should be a resource name ending with `operations/`unique_id``. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The normal response of the operation in case of success. If the original # method returns no data on success, such as `Delete`, the response is # `google.protobuf.Empty`. If the original method is standard # `Get`/`Create`/`Update`, the response should be the resource. For other # methods, the response should have the type `XxxResponse`, where `Xxx` # is the original method name. For example, if the original method name # is `TakeSnapshot()`, the inferred response type is # `TakeSnapshotResponse`. # Corresponds to the JSON property `response` # @return [Hash<String,Object>] attr_accessor :response def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @done = args[:done] if args.key?(:done) @error = args[:error] if args.key?(:error) @metadata = args[:metadata] if args.key?(:metadata) @name = args[:name] if args.key?(:name) @response = args[:response] if args.key?(:response) end end # A protocol buffer option, which can be attached to a message, field, # enumeration, etc. class Option include Google::Apis::Core::Hashable # The option's name. For protobuf built-in options (options defined in # descriptor.proto), this is the short name. For example, `"map_entry"`. # For custom options, it should be the fully-qualified name. For example, # `"google.api.http"`. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The option's value packed in an Any message. If the value is a primitive, # the corresponding wrapper type defined in google/protobuf/wrappers.proto # should be used. If the value is an enum, it should be stored as an int32 # value using the google.protobuf.Int32Value type. # Corresponds to the JSON property `value` # @return [Hash<String,Object>] attr_accessor :value def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @name = args[:name] if args.key?(:name) @value = args[:value] if args.key?(:value) end end # Represents a documentation page. A page can contain subpages to represent # nested documentation set structure. class Page include Google::Apis::Core::Hashable # The Markdown content of the page. You can use <code>&#40;== include `path` # ==&#41;</code> to include content from a Markdown file. # Corresponds to the JSON property `content` # @return [String] attr_accessor :content # The name of the page. It will be used as an identity of the page to # generate URI of the page, text of the link to this page in navigation, # etc. The full page name (start from the root page name to this page # concatenated with `.`) can be used as reference to the page in your # documentation. For example: # <pre><code>pages: # - name: Tutorial # content: &#40;== include tutorial.md ==&#41; # subpages: # - name: Java # content: &#40;== include tutorial_java.md ==&#41; # </code></pre> # You can reference `Java` page using Markdown reference link syntax: # `Java`. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Subpages of this page. The order of subpages specified here will be # honored in the generated docset. # Corresponds to the JSON property `subpages` # @return [Array<Google::Apis::ServicenetworkingV1::Page>] attr_accessor :subpages def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @content = args[:content] if args.key?(:content) @name = args[:name] if args.key?(:name) @subpages = args[:subpages] if args.key?(:subpages) end end # Quota configuration helps to achieve fairness and budgeting in service # usage. # The metric based quota configuration works this way: # - The service configuration defines a set of metrics. # - For API calls, the quota.metric_rules maps methods to metrics with # corresponding costs. # - The quota.limits defines limits on the metrics, which will be used for # quota checks at runtime. # An example quota configuration in yaml format: # quota: # limits: # - name: apiWriteQpsPerProject # metric: library.googleapis.com/write_calls # unit: "1/min/`project`" # rate limit for consumer projects # values: # STANDARD: 10000 # # The metric rules bind all methods to the read_calls metric, # # except for the UpdateBook and DeleteBook methods. These two methods # # are mapped to the write_calls metric, with the UpdateBook method # # consuming at twice rate as the DeleteBook method. # metric_rules: # - selector: "*" # metric_costs: # library.googleapis.com/read_calls: 1 # - selector: google.example.library.v1.LibraryService.UpdateBook # metric_costs: # library.googleapis.com/write_calls: 2 # - selector: google.example.library.v1.LibraryService.DeleteBook # metric_costs: # library.googleapis.com/write_calls: 1 # Corresponding Metric definition: # metrics: # - name: library.googleapis.com/read_calls # display_name: Read requests # metric_kind: DELTA # value_type: INT64 # - name: library.googleapis.com/write_calls # display_name: Write requests # metric_kind: DELTA # value_type: INT64 class Quota include Google::Apis::Core::Hashable # List of `QuotaLimit` definitions for the service. # Corresponds to the JSON property `limits` # @return [Array<Google::Apis::ServicenetworkingV1::QuotaLimit>] attr_accessor :limits # List of `MetricRule` definitions, each one mapping a selected method to one # or more metrics. # Corresponds to the JSON property `metricRules` # @return [Array<Google::Apis::ServicenetworkingV1::MetricRule>] attr_accessor :metric_rules def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @limits = args[:limits] if args.key?(:limits) @metric_rules = args[:metric_rules] if args.key?(:metric_rules) end end # `QuotaLimit` defines a specific limit that applies over a specified duration # for a limit type. There can be at most one limit for a duration and limit # type combination defined within a `QuotaGroup`. class QuotaLimit include Google::Apis::Core::Hashable # Default number of tokens that can be consumed during the specified # duration. This is the number of tokens assigned when a client # application developer activates the service for his/her project. # Specifying a value of 0 will block all requests. This can be used if you # are provisioning quota to selected consumers and blocking others. # Similarly, a value of -1 will indicate an unlimited quota. No other # negative values are allowed. # Used by group-based quotas only. # Corresponds to the JSON property `defaultLimit` # @return [Fixnum] attr_accessor :default_limit # Optional. User-visible, extended description for this quota limit. # Should be used only when more context is needed to understand this limit # than provided by the limit's display name (see: `display_name`). # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # User-visible display name for this limit. # Optional. If not set, the UI will provide a default display name based on # the quota configuration. This field can be used to override the default # display name generated from the configuration. # Corresponds to the JSON property `displayName` # @return [String] attr_accessor :display_name # Duration of this limit in textual notation. Must be "100s" or "1d". # Used by group-based quotas only. # Corresponds to the JSON property `duration` # @return [String] attr_accessor :duration # Free tier value displayed in the Developers Console for this limit. # The free tier is the number of tokens that will be subtracted from the # billed amount when billing is enabled. # This field can only be set on a limit with duration "1d", in a billable # group; it is invalid on any other limit. If this field is not set, it # defaults to 0, indicating that there is no free tier for this service. # Used by group-based quotas only. # Corresponds to the JSON property `freeTier` # @return [Fixnum] attr_accessor :free_tier # Maximum number of tokens that can be consumed during the specified # duration. Client application developers can override the default limit up # to this maximum. If specified, this value cannot be set to a value less # than the default limit. If not specified, it is set to the default limit. # To allow clients to apply overrides with no upper bound, set this to -1, # indicating unlimited maximum quota. # Used by group-based quotas only. # Corresponds to the JSON property `maxLimit` # @return [Fixnum] attr_accessor :max_limit # The name of the metric this quota limit applies to. The quota limits with # the same metric will be checked together during runtime. The metric must be # defined within the service config. # Corresponds to the JSON property `metric` # @return [String] attr_accessor :metric # Name of the quota limit. # The name must be provided, and it must be unique within the service. The # name can only include alphanumeric characters as well as '-'. # The maximum length of the limit name is 64 characters. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Specify the unit of the quota limit. It uses the same syntax as # Metric.unit. The supported unit kinds are determined by the quota # backend system. # Here are some examples: # * "1/min/`project`" for quota per minute per project. # Note: the order of unit components is insignificant. # The "1" at the beginning is required to follow the metric unit syntax. # Corresponds to the JSON property `unit` # @return [String] attr_accessor :unit # Tiered limit values. You must specify this as a key:value pair, with an # integer value that is the maximum number of requests allowed for the # specified unit. Currently only STANDARD is supported. # Corresponds to the JSON property `values` # @return [Hash<String,Fixnum>] attr_accessor :values def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @default_limit = args[:default_limit] if args.key?(:default_limit) @description = args[:description] if args.key?(:description) @display_name = args[:display_name] if args.key?(:display_name) @duration = args[:duration] if args.key?(:duration) @free_tier = args[:free_tier] if args.key?(:free_tier) @max_limit = args[:max_limit] if args.key?(:max_limit) @metric = args[:metric] if args.key?(:metric) @name = args[:name] if args.key?(:name) @unit = args[:unit] if args.key?(:unit) @values = args[:values] if args.key?(:values) end end # Represents a found unused range. class Range include Google::Apis::Core::Hashable # CIDR range in "10.x.x.x/y" format that is within the # allocated ranges and currently unused. # Corresponds to the JSON property `ipCidrRange` # @return [String] attr_accessor :ip_cidr_range # In the Shared VPC host project, the VPC network that's peered with the # consumer network. For example: # `projects/1234321/global/networks/host-network` # Corresponds to the JSON property `network` # @return [String] attr_accessor :network def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @ip_cidr_range = args[:ip_cidr_range] if args.key?(:ip_cidr_range) @network = args[:network] if args.key?(:network) end end # Represents a range reservation. class RangeReservation include Google::Apis::Core::Hashable # Required. The size of the desired subnet. Use usual CIDR range notation. For # example, # '30' to find unused x.x.x.x/30 CIDR range. The goal is to determine if one # of the allocated ranges has enough free space for a subnet of the requested # size. # Corresponds to the JSON property `ipPrefixLength` # @return [Fixnum] attr_accessor :ip_prefix_length # Optional. DO NOT USE - Under development. # The size of the desired secondary ranges for the subnet. Use usual CIDR # range notation. For example, '30' to find unused x.x.x.x/30 CIDR range. The # goal is to determine that the allocated ranges have enough free space for # all the requested secondary ranges. # Corresponds to the JSON property `secondaryRangeIpPrefixLengths` # @return [Array<Fixnum>] attr_accessor :secondary_range_ip_prefix_lengths def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @ip_prefix_length = args[:ip_prefix_length] if args.key?(:ip_prefix_length) @secondary_range_ip_prefix_lengths = args[:secondary_range_ip_prefix_lengths] if args.key?(:secondary_range_ip_prefix_lengths) end end # Request to search for an unused range within allocated ranges. class SearchRangeRequest include Google::Apis::Core::Hashable # Required. The prefix length of the IP range. Use usual CIDR range notation. # For # example, '30' to find unused x.x.x.x/30 CIDR range. Actual range will be # determined using allocated range for the consumer peered network and # returned in the result. # Corresponds to the JSON property `ipPrefixLength` # @return [Fixnum] attr_accessor :ip_prefix_length # Network name in the consumer project. This network must have been # already peered with a shared VPC network using CreateConnection # method. Must be in a form 'projects/`project`/global/networks/`network`'. # `project` is a project number, as in '12345' `network` is network name. # Corresponds to the JSON property `network` # @return [String] attr_accessor :network def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @ip_prefix_length = args[:ip_prefix_length] if args.key?(:ip_prefix_length) @network = args[:network] if args.key?(:network) end end # `Service` is the root object of Google service configuration schema. It # describes basic information about a service, such as the name and the # title, and delegates other aspects to sub-sections. Each sub-section is # either a proto message or a repeated proto message that configures a # specific aspect, such as auth. See each proto message definition for details. # Example: # type: google.api.Service # config_version: 3 # name: calendar.googleapis.com # title: Google Calendar API # apis: # - name: google.calendar.v3.Calendar # authentication: # providers: # - id: google_calendar_auth # jwks_uri: https://www.googleapis.com/oauth2/v1/certs # issuer: https://securetoken.google.com # rules: # - selector: "*" # requirements: # provider_id: google_calendar_auth class Service include Google::Apis::Core::Hashable # A list of API interfaces exported by this service. Only the `name` field # of the google.protobuf.Api needs to be provided by the configuration # author, as the remaining fields will be derived from the IDL during the # normalization process. It is an error to specify an API interface here # which cannot be resolved against the associated IDL files. # Corresponds to the JSON property `apis` # @return [Array<Google::Apis::ServicenetworkingV1::Api>] attr_accessor :apis # `Authentication` defines the authentication configuration for an API. # Example for an API targeted for external use: # name: calendar.googleapis.com # authentication: # providers: # - id: google_calendar_auth # jwks_uri: https://www.googleapis.com/oauth2/v1/certs # issuer: https://securetoken.google.com # rules: # - selector: "*" # requirements: # provider_id: google_calendar_auth # Corresponds to the JSON property `authentication` # @return [Google::Apis::ServicenetworkingV1::Authentication] attr_accessor :authentication # `Backend` defines the backend configuration for a service. # Corresponds to the JSON property `backend` # @return [Google::Apis::ServicenetworkingV1::Backend] attr_accessor :backend # Billing related configuration of the service. # The following example shows how to configure monitored resources and metrics # for billing: # monitored_resources: # - type: library.googleapis.com/branch # labels: # - key: /city # description: The city where the library branch is located in. # - key: /name # description: The name of the branch. # metrics: # - name: library.googleapis.com/book/borrowed_count # metric_kind: DELTA # value_type: INT64 # billing: # consumer_destinations: # - monitored_resource: library.googleapis.com/branch # metrics: # - library.googleapis.com/book/borrowed_count # Corresponds to the JSON property `billing` # @return [Google::Apis::ServicenetworkingV1::Billing] attr_accessor :billing # The semantic version of the service configuration. The config version # affects the interpretation of the service configuration. For example, # certain features are enabled by default for certain config versions. # The latest config version is `3`. # Corresponds to the JSON property `configVersion` # @return [Fixnum] attr_accessor :config_version # `Context` defines which contexts an API requests. # Example: # context: # rules: # - selector: "*" # requested: # - google.rpc.context.ProjectContext # - google.rpc.context.OriginContext # The above specifies that all methods in the API request # `google.rpc.context.ProjectContext` and # `google.rpc.context.OriginContext`. # Available context types are defined in package # `google.rpc.context`. # This also provides mechanism to whitelist any protobuf message extension that # can be sent in grpc metadata using “x-goog-ext-<extension_id>-bin” and # “x-goog-ext-<extension_id>-jspb” format. For example, list any service # specific protobuf types that can appear in grpc metadata as follows in your # yaml file: # Example: # context: # rules: # - selector: "google.example.library.v1.LibraryService.CreateBook" # allowed_request_extensions: # - google.foo.v1.NewExtension # allowed_response_extensions: # - google.foo.v1.NewExtension # You can also specify extension ID instead of fully qualified extension name # here. # Corresponds to the JSON property `context` # @return [Google::Apis::ServicenetworkingV1::Context] attr_accessor :context # Selects and configures the service controller used by the service. The # service controller handles features like abuse, quota, billing, logging, # monitoring, etc. # Corresponds to the JSON property `control` # @return [Google::Apis::ServicenetworkingV1::Control] attr_accessor :control # Customize service error responses. For example, list any service # specific protobuf types that can appear in error detail lists of # error responses. # Example: # custom_error: # types: # - google.foo.v1.CustomError # - google.foo.v1.AnotherError # Corresponds to the JSON property `customError` # @return [Google::Apis::ServicenetworkingV1::CustomError] attr_accessor :custom_error # `Documentation` provides the information for describing a service. # Example: # <pre><code>documentation: # summary: > # The Google Calendar API gives access # to most calendar features. # pages: # - name: Overview # content: &#40;== include google/foo/overview.md ==&#41; # - name: Tutorial # content: &#40;== include google/foo/tutorial.md ==&#41; # subpages; # - name: Java # content: &#40;== include google/foo/tutorial_java.md ==&#41; # rules: # - selector: google.calendar.Calendar.Get # description: > # ... # - selector: google.calendar.Calendar.Put # description: > # ... # </code></pre> # Documentation is provided in markdown syntax. In addition to # standard markdown features, definition lists, tables and fenced # code blocks are supported. Section headers can be provided and are # interpreted relative to the section nesting of the context where # a documentation fragment is embedded. # Documentation from the IDL is merged with documentation defined # via the config at normalization time, where documentation provided # by config rules overrides IDL provided. # A number of constructs specific to the API platform are supported # in documentation text. # In order to reference a proto element, the following # notation can be used: # <pre><code>&#91;fully.qualified.proto.name]&#91;]</code></pre> # To override the display text used for the link, this can be used: # <pre><code>&#91;display text]&#91;fully.qualified.proto.name]</code></pre> # Text can be excluded from doc using the following notation: # <pre><code>&#40;-- internal comment --&#41;</code></pre> # A few directives are available in documentation. Note that # directives must appear on a single line to be properly # identified. The `include` directive includes a markdown file from # an external source: # <pre><code>&#40;== include path/to/file ==&#41;</code></pre> # The `resource_for` directive marks a message to be the resource of # a collection in REST view. If it is not specified, tools attempt # to infer the resource from the operations in a collection: # <pre><code>&#40;== resource_for v1.shelves.books ==&#41;</code></pre> # The directive `suppress_warning` does not directly affect documentation # and is documented together with service config validation. # Corresponds to the JSON property `documentation` # @return [Google::Apis::ServicenetworkingV1::Documentation] attr_accessor :documentation # Configuration for network endpoints. If this is empty, then an endpoint # with the same name as the service is automatically generated to service all # defined APIs. # Corresponds to the JSON property `endpoints` # @return [Array<Google::Apis::ServicenetworkingV1::Endpoint>] attr_accessor :endpoints # A list of all enum types included in this API service. Enums # referenced directly or indirectly by the `apis` are automatically # included. Enums which are not referenced but shall be included # should be listed here by name. Example: # enums: # - name: google.someapi.v1.SomeEnum # Corresponds to the JSON property `enums` # @return [Array<Google::Apis::ServicenetworkingV1::Enum>] attr_accessor :enums # Defines the HTTP configuration for an API service. It contains a list of # HttpRule, each specifying the mapping of an RPC method # to one or more HTTP REST API methods. # Corresponds to the JSON property `http` # @return [Google::Apis::ServicenetworkingV1::Http] attr_accessor :http # A unique ID for a specific instance of this message, typically assigned # by the client for tracking purpose. Must be no longer than 63 characters # and only lower case letters, digits, '.', '_' and '-' are allowed. If # empty, the server may choose to generate one instead. # Corresponds to the JSON property `id` # @return [String] attr_accessor :id # Logging configuration of the service. # The following example shows how to configure logs to be sent to the # producer and consumer projects. In the example, the `activity_history` # log is sent to both the producer and consumer projects, whereas the # `purchase_history` log is only sent to the producer project. # monitored_resources: # - type: library.googleapis.com/branch # labels: # - key: /city # description: The city where the library branch is located in. # - key: /name # description: The name of the branch. # logs: # - name: activity_history # labels: # - key: /customer_id # - name: purchase_history # logging: # producer_destinations: # - monitored_resource: library.googleapis.com/branch # logs: # - activity_history # - purchase_history # consumer_destinations: # - monitored_resource: library.googleapis.com/branch # logs: # - activity_history # Corresponds to the JSON property `logging` # @return [Google::Apis::ServicenetworkingV1::Logging] attr_accessor :logging # Defines the logs used by this service. # Corresponds to the JSON property `logs` # @return [Array<Google::Apis::ServicenetworkingV1::LogDescriptor>] attr_accessor :logs # Defines the metrics used by this service. # Corresponds to the JSON property `metrics` # @return [Array<Google::Apis::ServicenetworkingV1::MetricDescriptor>] attr_accessor :metrics # Defines the monitored resources used by this service. This is required # by the Service.monitoring and Service.logging configurations. # Corresponds to the JSON property `monitoredResources` # @return [Array<Google::Apis::ServicenetworkingV1::MonitoredResourceDescriptor>] attr_accessor :monitored_resources # Monitoring configuration of the service. # The example below shows how to configure monitored resources and metrics # for monitoring. In the example, a monitored resource and two metrics are # defined. The `library.googleapis.com/book/returned_count` metric is sent # to both producer and consumer projects, whereas the # `library.googleapis.com/book/overdue_count` metric is only sent to the # consumer project. # monitored_resources: # - type: library.googleapis.com/branch # labels: # - key: /city # description: The city where the library branch is located in. # - key: /name # description: The name of the branch. # metrics: # - name: library.googleapis.com/book/returned_count # metric_kind: DELTA # value_type: INT64 # labels: # - key: /customer_id # - name: library.googleapis.com/book/overdue_count # metric_kind: GAUGE # value_type: INT64 # labels: # - key: /customer_id # monitoring: # producer_destinations: # - monitored_resource: library.googleapis.com/branch # metrics: # - library.googleapis.com/book/returned_count # consumer_destinations: # - monitored_resource: library.googleapis.com/branch # metrics: # - library.googleapis.com/book/returned_count # - library.googleapis.com/book/overdue_count # Corresponds to the JSON property `monitoring` # @return [Google::Apis::ServicenetworkingV1::Monitoring] attr_accessor :monitoring # The service name, which is a DNS-like logical identifier for the # service, such as `calendar.googleapis.com`. The service name # typically goes through DNS verification to make sure the owner # of the service also owns the DNS name. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The Google project that owns this service. # Corresponds to the JSON property `producerProjectId` # @return [String] attr_accessor :producer_project_id # Quota configuration helps to achieve fairness and budgeting in service # usage. # The metric based quota configuration works this way: # - The service configuration defines a set of metrics. # - For API calls, the quota.metric_rules maps methods to metrics with # corresponding costs. # - The quota.limits defines limits on the metrics, which will be used for # quota checks at runtime. # An example quota configuration in yaml format: # quota: # limits: # - name: apiWriteQpsPerProject # metric: library.googleapis.com/write_calls # unit: "1/min/`project`" # rate limit for consumer projects # values: # STANDARD: 10000 # # The metric rules bind all methods to the read_calls metric, # # except for the UpdateBook and DeleteBook methods. These two methods # # are mapped to the write_calls metric, with the UpdateBook method # # consuming at twice rate as the DeleteBook method. # metric_rules: # - selector: "*" # metric_costs: # library.googleapis.com/read_calls: 1 # - selector: google.example.library.v1.LibraryService.UpdateBook # metric_costs: # library.googleapis.com/write_calls: 2 # - selector: google.example.library.v1.LibraryService.DeleteBook # metric_costs: # library.googleapis.com/write_calls: 1 # Corresponding Metric definition: # metrics: # - name: library.googleapis.com/read_calls # display_name: Read requests # metric_kind: DELTA # value_type: INT64 # - name: library.googleapis.com/write_calls # display_name: Write requests # metric_kind: DELTA # value_type: INT64 # Corresponds to the JSON property `quota` # @return [Google::Apis::ServicenetworkingV1::Quota] attr_accessor :quota # Source information used to create a Service Config # Corresponds to the JSON property `sourceInfo` # @return [Google::Apis::ServicenetworkingV1::SourceInfo] attr_accessor :source_info # ### System parameter configuration # A system parameter is a special kind of parameter defined by the API # system, not by an individual API. It is typically mapped to an HTTP header # and/or a URL query parameter. This configuration specifies which methods # change the names of the system parameters. # Corresponds to the JSON property `systemParameters` # @return [Google::Apis::ServicenetworkingV1::SystemParameters] attr_accessor :system_parameters # A list of all proto message types included in this API service. # It serves similar purpose as [google.api.Service.types], except that # these types are not needed by user-defined APIs. Therefore, they will not # show up in the generated discovery doc. This field should only be used # to define system APIs in ESF. # Corresponds to the JSON property `systemTypes` # @return [Array<Google::Apis::ServicenetworkingV1::Type>] attr_accessor :system_types # The product title for this service. # Corresponds to the JSON property `title` # @return [String] attr_accessor :title # A list of all proto message types included in this API service. # Types referenced directly or indirectly by the `apis` are # automatically included. Messages which are not referenced but # shall be included, such as types used by the `google.protobuf.Any` type, # should be listed here by name. Example: # types: # - name: google.protobuf.Int32 # Corresponds to the JSON property `types` # @return [Array<Google::Apis::ServicenetworkingV1::Type>] attr_accessor :types # Configuration controlling usage of a service. # Corresponds to the JSON property `usage` # @return [Google::Apis::ServicenetworkingV1::Usage] attr_accessor :usage def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @apis = args[:apis] if args.key?(:apis) @authentication = args[:authentication] if args.key?(:authentication) @backend = args[:backend] if args.key?(:backend) @billing = args[:billing] if args.key?(:billing) @config_version = args[:config_version] if args.key?(:config_version) @context = args[:context] if args.key?(:context) @control = args[:control] if args.key?(:control) @custom_error = args[:custom_error] if args.key?(:custom_error) @documentation = args[:documentation] if args.key?(:documentation) @endpoints = args[:endpoints] if args.key?(:endpoints) @enums = args[:enums] if args.key?(:enums) @http = args[:http] if args.key?(:http) @id = args[:id] if args.key?(:id) @logging = args[:logging] if args.key?(:logging) @logs = args[:logs] if args.key?(:logs) @metrics = args[:metrics] if args.key?(:metrics) @monitored_resources = args[:monitored_resources] if args.key?(:monitored_resources) @monitoring = args[:monitoring] if args.key?(:monitoring) @name = args[:name] if args.key?(:name) @producer_project_id = args[:producer_project_id] if args.key?(:producer_project_id) @quota = args[:quota] if args.key?(:quota) @source_info = args[:source_info] if args.key?(:source_info) @system_parameters = args[:system_parameters] if args.key?(:system_parameters) @system_types = args[:system_types] if args.key?(:system_types) @title = args[:title] if args.key?(:title) @types = args[:types] if args.key?(:types) @usage = args[:usage] if args.key?(:usage) end end # The per-product per-project service identity for a service. # Use this field to configure per-product per-project service identity. # Example of a service identity configuration. # usage: # service_identity: # - service_account_parent: "projects/123456789" # display_name: "Cloud XXX Service Agent" # description: "Used as the identity of Cloud XXX to access resources" class ServiceIdentity include Google::Apis::Core::Hashable # Optional. A user-specified opaque description of the service account. # Must be less than or equal to 256 UTF-8 bytes. # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # Optional. A user-specified name for the service account. # Must be less than or equal to 100 UTF-8 bytes. # Corresponds to the JSON property `displayName` # @return [String] attr_accessor :display_name # A service account project that hosts the service accounts. # An example name would be: # `projects/123456789` # Corresponds to the JSON property `serviceAccountParent` # @return [String] attr_accessor :service_account_parent def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @description = args[:description] if args.key?(:description) @display_name = args[:display_name] if args.key?(:display_name) @service_account_parent = args[:service_account_parent] if args.key?(:service_account_parent) end end # `SourceContext` represents information about the source of a # protobuf element, like the file in which it is defined. class SourceContext include Google::Apis::Core::Hashable # The path-qualified name of the .proto file that contained the associated # protobuf element. For example: `"google/protobuf/source_context.proto"`. # Corresponds to the JSON property `fileName` # @return [String] attr_accessor :file_name def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @file_name = args[:file_name] if args.key?(:file_name) end end # Source information used to create a Service Config class SourceInfo include Google::Apis::Core::Hashable # All files used during config generation. # Corresponds to the JSON property `sourceFiles` # @return [Array<Hash<String,Object>>] attr_accessor :source_files def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @source_files = args[:source_files] if args.key?(:source_files) end end # The `Status` type defines a logical error model that is suitable for # different programming environments, including REST APIs and RPC APIs. It is # used by [gRPC](https://github.com/grpc). Each `Status` message contains # three pieces of data: error code, error message, and error details. # You can find out more about this error model and how to work with it in the # [API Design Guide](https://cloud.google.com/apis/design/errors). class Status include Google::Apis::Core::Hashable # The status code, which should be an enum value of google.rpc.Code. # Corresponds to the JSON property `code` # @return [Fixnum] attr_accessor :code # A list of messages that carry the error details. There is a common set of # message types for APIs to use. # Corresponds to the JSON property `details` # @return [Array<Hash<String,Object>>] attr_accessor :details # A developer-facing error message, which should be in English. Any # user-facing error message should be localized and sent in the # google.rpc.Status.details field, or localized by the client. # Corresponds to the JSON property `message` # @return [String] attr_accessor :message def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @code = args[:code] if args.key?(:code) @details = args[:details] if args.key?(:details) @message = args[:message] if args.key?(:message) end end # Represents a subnet that was created or discovered by a private access # management service. class Subnetwork include Google::Apis::Core::Hashable # Subnetwork CIDR range in `10.x.x.x/y` format. # Corresponds to the JSON property `ipCidrRange` # @return [String] attr_accessor :ip_cidr_range # Subnetwork name. # See https://cloud.google.com/compute/docs/vpc/ # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # In the Shared VPC host project, the VPC network that's peered with the # consumer network. For example: # `projects/1234321/global/networks/host-network` # Corresponds to the JSON property `network` # @return [String] attr_accessor :network # This is a discovered subnet that is not within the current consumer # allocated ranges. # Corresponds to the JSON property `outsideAllocation` # @return [Boolean] attr_accessor :outside_allocation alias_method :outside_allocation?, :outside_allocation def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @ip_cidr_range = args[:ip_cidr_range] if args.key?(:ip_cidr_range) @name = args[:name] if args.key?(:name) @network = args[:network] if args.key?(:network) @outside_allocation = args[:outside_allocation] if args.key?(:outside_allocation) end end # Define a parameter's name and location. The parameter may be passed as either # an HTTP header or a URL query parameter, and if both are passed the behavior # is implementation-dependent. class SystemParameter include Google::Apis::Core::Hashable # Define the HTTP header name to use for the parameter. It is case # insensitive. # Corresponds to the JSON property `httpHeader` # @return [String] attr_accessor :http_header # Define the name of the parameter, such as "api_key" . It is case sensitive. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Define the URL query parameter name to use for the parameter. It is case # sensitive. # Corresponds to the JSON property `urlQueryParameter` # @return [String] attr_accessor :url_query_parameter def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @http_header = args[:http_header] if args.key?(:http_header) @name = args[:name] if args.key?(:name) @url_query_parameter = args[:url_query_parameter] if args.key?(:url_query_parameter) end end # Define a system parameter rule mapping system parameter definitions to # methods. class SystemParameterRule include Google::Apis::Core::Hashable # Define parameters. Multiple names may be defined for a parameter. # For a given method call, only one of them should be used. If multiple # names are used the behavior is implementation-dependent. # If none of the specified names are present the behavior is # parameter-dependent. # Corresponds to the JSON property `parameters` # @return [Array<Google::Apis::ServicenetworkingV1::SystemParameter>] attr_accessor :parameters # Selects the methods to which this rule applies. Use '*' to indicate all # methods in all APIs. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @parameters = args[:parameters] if args.key?(:parameters) @selector = args[:selector] if args.key?(:selector) end end # ### System parameter configuration # A system parameter is a special kind of parameter defined by the API # system, not by an individual API. It is typically mapped to an HTTP header # and/or a URL query parameter. This configuration specifies which methods # change the names of the system parameters. class SystemParameters include Google::Apis::Core::Hashable # Define system parameters. # The parameters defined here will override the default parameters # implemented by the system. If this field is missing from the service # config, default system parameters will be used. Default system parameters # and names is implementation-dependent. # Example: define api key for all methods # system_parameters # rules: # - selector: "*" # parameters: # - name: api_key # url_query_parameter: api_key # Example: define 2 api key names for a specific method. # system_parameters # rules: # - selector: "/ListShelves" # parameters: # - name: api_key # http_header: Api-Key1 # - name: api_key # http_header: Api-Key2 # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::SystemParameterRule>] attr_accessor :rules def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @rules = args[:rules] if args.key?(:rules) end end # A protocol buffer message type. class Type include Google::Apis::Core::Hashable # The list of fields. # Corresponds to the JSON property `fields` # @return [Array<Google::Apis::ServicenetworkingV1::Field>] attr_accessor :fields # The fully qualified message name. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # The list of types appearing in `oneof` definitions in this type. # Corresponds to the JSON property `oneofs` # @return [Array<String>] attr_accessor :oneofs # The protocol buffer options. # Corresponds to the JSON property `options` # @return [Array<Google::Apis::ServicenetworkingV1::Option>] attr_accessor :options # `SourceContext` represents information about the source of a # protobuf element, like the file in which it is defined. # Corresponds to the JSON property `sourceContext` # @return [Google::Apis::ServicenetworkingV1::SourceContext] attr_accessor :source_context # The source syntax. # Corresponds to the JSON property `syntax` # @return [String] attr_accessor :syntax def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @fields = args[:fields] if args.key?(:fields) @name = args[:name] if args.key?(:name) @oneofs = args[:oneofs] if args.key?(:oneofs) @options = args[:options] if args.key?(:options) @source_context = args[:source_context] if args.key?(:source_context) @syntax = args[:syntax] if args.key?(:syntax) end end # Configuration controlling usage of a service. class Usage include Google::Apis::Core::Hashable # The full resource name of a channel used for sending notifications to the # service producer. # Google Service Management currently only supports # [Google Cloud Pub/Sub](https://cloud.google.com/pubsub) as a notification # channel. To use Google Cloud Pub/Sub as the channel, this must be the name # of a Cloud Pub/Sub topic that uses the Cloud Pub/Sub topic name format # documented in https://cloud.google.com/pubsub/docs/overview. # Corresponds to the JSON property `producerNotificationChannel` # @return [String] attr_accessor :producer_notification_channel # Requirements that must be satisfied before a consumer project can use the # service. Each requirement is of the form <service.name>/<requirement-id>; # for example 'serviceusage.googleapis.com/billing-enabled'. # Corresponds to the JSON property `requirements` # @return [Array<String>] attr_accessor :requirements # A list of usage rules that apply to individual API methods. # **NOTE:** All service configuration rules follow "last one wins" order. # Corresponds to the JSON property `rules` # @return [Array<Google::Apis::ServicenetworkingV1::UsageRule>] attr_accessor :rules # The per-product per-project service identity for a service. # Use this field to configure per-product per-project service identity. # Example of a service identity configuration. # usage: # service_identity: # - service_account_parent: "projects/123456789" # display_name: "Cloud XXX Service Agent" # description: "Used as the identity of Cloud XXX to access resources" # Corresponds to the JSON property `serviceIdentity` # @return [Google::Apis::ServicenetworkingV1::ServiceIdentity] attr_accessor :service_identity def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @producer_notification_channel = args[:producer_notification_channel] if args.key?(:producer_notification_channel) @requirements = args[:requirements] if args.key?(:requirements) @rules = args[:rules] if args.key?(:rules) @service_identity = args[:service_identity] if args.key?(:service_identity) end end # Usage configuration rules for the service. # NOTE: Under development. # Use this rule to configure unregistered calls for the service. Unregistered # calls are calls that do not contain consumer project identity. # (Example: calls that do not contain an API key). # By default, API methods do not allow unregistered calls, and each method call # must be identified by a consumer project identity. Use this rule to # allow/disallow unregistered calls. # Example of an API that wants to allow unregistered calls for entire service. # usage: # rules: # - selector: "*" # allow_unregistered_calls: true # Example of a method that wants to allow unregistered calls. # usage: # rules: # - selector: "google.example.library.v1.LibraryService.CreateBook" # allow_unregistered_calls: true class UsageRule include Google::Apis::Core::Hashable # If true, the selected method allows unregistered calls, e.g. calls # that don't identify any user or application. # Corresponds to the JSON property `allowUnregisteredCalls` # @return [Boolean] attr_accessor :allow_unregistered_calls alias_method :allow_unregistered_calls?, :allow_unregistered_calls # Selects the methods to which this rule applies. Use '*' to indicate all # methods in all APIs. # Refer to selector for syntax details. # Corresponds to the JSON property `selector` # @return [String] attr_accessor :selector # If true, the selected method should skip service control and the control # plane features, such as quota and billing, will not be available. # This flag is used by Google Cloud Endpoints to bypass checks for internal # methods, such as service health check methods. # Corresponds to the JSON property `skipServiceControl` # @return [Boolean] attr_accessor :skip_service_control alias_method :skip_service_control?, :skip_service_control def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @allow_unregistered_calls = args[:allow_unregistered_calls] if args.key?(:allow_unregistered_calls) @selector = args[:selector] if args.key?(:selector) @skip_service_control = args[:skip_service_control] if args.key?(:skip_service_control) end end # class ValidateConsumerConfigRequest include Google::Apis::Core::Hashable # Required. The network that the consumer is using to connect with services. # Must be in # the form of projects/`project`/global/networks/`network` `project` is a # project number, as in '12345' `network` is network name. # Corresponds to the JSON property `consumerNetwork` # @return [String] attr_accessor :consumer_network # Represents a consumer project. # Corresponds to the JSON property `consumerProject` # @return [Google::Apis::ServicenetworkingV1::ConsumerProject] attr_accessor :consumer_project # Represents a range reservation. # Corresponds to the JSON property `rangeReservation` # @return [Google::Apis::ServicenetworkingV1::RangeReservation] attr_accessor :range_reservation # The validations will be performed in the order listed in the # ValidationError enum. The first failure will return. If a validation is not # requested, then the next one will be performed. # SERVICE_NETWORKING_NOT_ENABLED and NETWORK_NOT_PEERED checks are performed # for all requests where validation is requested. NETWORK_NOT_FOUND and # NETWORK_DISCONNECTED checks are done for requests that have # validate_network set to true. # Corresponds to the JSON property `validateNetwork` # @return [Boolean] attr_accessor :validate_network alias_method :validate_network?, :validate_network def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @consumer_network = args[:consumer_network] if args.key?(:consumer_network) @consumer_project = args[:consumer_project] if args.key?(:consumer_project) @range_reservation = args[:range_reservation] if args.key?(:range_reservation) @validate_network = args[:validate_network] if args.key?(:validate_network) end end # class ValidateConsumerConfigResponse include Google::Apis::Core::Hashable # # Corresponds to the JSON property `isValid` # @return [Boolean] attr_accessor :is_valid alias_method :is_valid?, :is_valid # # Corresponds to the JSON property `validationError` # @return [String] attr_accessor :validation_error def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @is_valid = args[:is_valid] if args.key?(:is_valid) @validation_error = args[:validation_error] if args.key?(:validation_error) end end end end end
43.249178
136
0.628132
1adca90de21221dfe1e641eef3d70d53e0daeaa3
7,763
# This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../config/environment', __dir__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? require 'rails_helper' require 'rspec/rails' require 'webmock/rspec' require 'capybara/rspec' require 'capybara/rails' require 'capybara-screenshot/rspec' require 'sucker_punch/testing/inline' require 'paper_trail/frameworks/rspec' require 'database_cleaner' WebMock.disable_net_connect!(allow_localhost: true) # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end # in _spec.rb will both be required and run as specs, causing the specs to be # run twice. It is recommended that you do not name files matching this glob to # end with _spec.rb. You can configure this pattern with the --pattern # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. # # The following line is provided for convenience purposes. It has the downside # of increasing the boot-up time by auto-requiring all files in the support # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } # Checks for pending migration and applies them before tests are run. # If you are not using ActiveRecord, you can remove this line. ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| config.render_views # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. config.use_transactional_fixtures = false # RSpec Rails can automatically mix in different behaviours to your tests # based on their file location, for example enabling you to call `get` and # `post` in specs under `spec/controllers`. # # You can disable this behaviour by removing the line below, and instead # explicitly tag your specs with their type, e.g.: # # RSpec.describe UsersController, :type => :controller do # # ... # end # # The different available types are documented in the features, such as in # https://relishapp.com/rspec/rspec-rails/docs config.infer_spec_type_from_file_location! # Filter lines from Rails gems in backtraces. config.filter_rails_from_backtrace! # arbitrary gems may also be filtered via: # config.filter_gems_from_backtrace("gem name") config.infer_base_class_for_anonymous_controllers = false config.order = "random" config.include Warden::Test::Helpers config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view config.include Devise::Test::IntegrationHelpers, type: :feature config.include FactoryBot::Syntax::Methods config.include ActiveSupport::Testing::TimeHelpers config.include ActiveJob::TestHelper config.include Shoulda::Matchers::ActiveModel, type: :form config.include Shoulda::Matchers::ActiveModel, type: :concern config.include Shoulda::Matchers::ActiveRecord, type: :concern config.infer_spec_type_from_file_location! # DatabaseCleaner config.before(:suite) do # Clean the database before specs, clean with truncation DatabaseCleaner.clean_with(:truncation) end config.before(:each) do # Make default strategy transaction. Transaction is faster than truncation. DatabaseCleaner.strategy = :transaction end config.before(:each) do DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end config.before(:each) do cal_response_json = File.read(File.expand_path("../webmocks/calendar_response.json", __FILE__)) cal_add_response_json = File.read(File.expand_path("../webmocks/add_calendar.json", __FILE__)) get_cal_response_json = File.read(File.expand_path("../webmocks/get_calendar.json", __FILE__)) # get calendar stub_request(:get, "https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest") .with(headers: {'Accept'=>'*/*'}) .to_return(status: 200, body: cal_response_json, headers: { 'Content-location' => 'https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest', 'Server' => 'GSE', 'Content-type' => 'application/json', 'charset' => 'UTF-8' }) # add to calendar stub_request(:post, "https://www.googleapis.com/calendar/v3/calendars/primary/events?sendNotifications=true") .with(headers: {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip', 'Authorization'=>'Bearer 123456', 'Cache-Control'=>'no-store', 'Content-Type'=>'application/json'}) .to_return(status: 200, body: cal_add_response_json, headers: { 'Server' => 'GSE', 'Content-type' => 'application/json' }) stub_request(:post, "https://www.googleapis.com/calendar/v3/calendars//events?sendNotifications=true") .to_return(status: 200, body: cal_add_response_json, headers: { 'Server' => 'GSE', 'Content-type' => 'application/json' }) # Event calender stub_request(:post, "https://www.googleapis.com/calendar/v3/calendars/[email protected]/events?sendNotifications=true") .to_return(status: 403, body: JSON.dump({ "error":{ "errors":[{ "domain":"calendar", "reason":"requiredAccessLevel", "message":"You need to have writer access to this calendar."}], "code":403,"message":"You need to have writer access to this calendar."}})) # delete calendar stub_request(:delete, "https://www.googleapis.com/calendar/v3/calendars/primary/events/?sendNotifications=true"). with(:headers => {'Accept'=>'*/*', 'Authorization'=>'Bearer 123456'}) .to_return(:status => 200, :body => "", :headers => {}) # get/read calendar stub_request(:get, "https://www.googleapis.com/calendar/v3/calendars/primary/events/") .with(headers: {'Accept'=>'*/*', 'Authorization'=>'Bearer 123456'}) .to_return(status: 200, body: get_cal_response_json, headers: { 'Server' => 'GSE', 'Content-type' => 'application/json' }) # put calendar stub_request(:put, "https://www.googleapis.com/calendar/v3/calendars/primary/events/?sendNotifications=true") .with(headers: {'Accept'=>'*/*', 'Authorization'=>'Bearer 123456'}) .to_return(status: 200, body: "", headers: {}) # slack notification stub_request(:post, "https://slack.com/api/chat.postMessage") .to_return(status: 200, body: '{"ok": true}', headers: {}) stub_request(:post, "https://slack.com/api/users.list") .to_return(status: 200, body: '{"ok": true}', headers: {}) # clear action mailer ActionMailer::Base.deliveries = [] end end Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_framework :rspec with.library :rails end end def login_as(user) OmniAuth.config.test_mode = true OmniAuth.config.add_mock(:google_oauth2, { uid: user.uid, credentials: { token: "token", refresh_token: "refresh_token", expired_at: Time.now + 7.days } }) visit("/users/auth/google_oauth2") OmniAuth.config.test_mode = false end
39.810256
133
0.704109
62c761ec9aec35f0a0e7353567b306246ec10742
3,706
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2020_04_25_103622) do create_table "article_categories", force: :cascade do |t| t.integer "article_id" t.integer "category_id" end create_table "articles", force: :cascade do |t| t.string "title" t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "user_id" end create_table "categories", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "group_memberships", force: :cascade do |t| t.string "member_type", null: false t.integer "member_id", null: false t.string "group_type" t.integer "group_id" t.string "group_name" t.string "membership_type" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["group_name"], name: "index_group_memberships_on_group_name" t.index ["group_type", "group_id"], name: "index_group_memberships_on_group_type_and_group_id" t.index ["member_type", "member_id"], name: "index_group_memberships_on_member_type_and_member_id" end create_table "groups", force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "room_id" end create_table "investor_categories", force: :cascade do |t| t.integer "investor_id" t.integer "category_id" end create_table "investors", force: :cascade do |t| t.string "password_digest" t.integer "user_id" t.integer "experience" end create_table "member_categories", force: :cascade do |t| t.integer "member_id" t.integer "category_id" end create_table "members", force: :cascade do |t| t.string "ex_startup_name" t.string "password_digest" t.integer "experience" t.integer "user_id" end create_table "mentor_categories", force: :cascade do |t| t.integer "mentor_id" t.integer "category_id" end create_table "mentors", force: :cascade do |t| t.string "password_digest" t.integer "experience" t.integer "user_id" end create_table "messages", force: :cascade do |t| t.integer "room_id" t.integer "user_id" t.text "message" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["room_id"], name: "index_messages_on_room_id" t.index ["user_id"], name: "index_messages_on_user_id" end create_table "rooms", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "group_id" t.index ["name"], name: "index_rooms_on_name", unique: true end create_table "users", force: :cascade do |t| t.string "fname" t.string "lname" t.datetime "dob" t.decimal "phone" t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "password_digest" end end
31.40678
102
0.705613
1caf2d4b567b7b8c873328f39d18e93c07b43960
29,035
## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Taskrouter < Domain class V1 < Version class WorkspaceList < ListResource ## # Initialize the WorkspaceList # @param [Version] version Version that contains the resource # @return [WorkspaceList] WorkspaceList def initialize(version) super(version) # Path Solution @solution = {} @uri = "/Workspaces" end ## # Lists WorkspaceInstance records from the API as a list. # Unlike stream(), this operation is eager and will load `limit` records into # memory before returning. # @param [String] friendly_name Filter by a workspace's friendly name. This is a # human readable description of this Workspace (for example "Customer Support" or # "2014 Election Campaign") # @param [Integer] limit Upper limit for the number of records to return. stream() # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when # not set will use the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the limit with the most # efficient page size, i.e. min(limit, 1000) # @return [Array] Array of up to limit results def list(friendly_name: :unset, limit: nil, page_size: nil) self.stream(friendly_name: friendly_name, limit: limit, page_size: page_size).entries end ## # Streams WorkspaceInstance records from the API as an Enumerable. # This operation lazily loads records as efficiently as possible until the limit # is reached. # @param [String] friendly_name Filter by a workspace's friendly name. This is a # human readable description of this Workspace (for example "Customer Support" or # "2014 Election Campaign") # @param [Integer] limit Upper limit for the number of records to return. stream() # guarantees to never return more than limit. Default is no limit. # @param [Integer] page_size Number of records to fetch per request, when # not set will use the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the limit with the most # efficient page size, i.e. min(limit, 1000) # @return [Enumerable] Enumerable that will yield up to limit results def stream(friendly_name: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page(friendly_name: friendly_name, page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end ## # When passed a block, yields WorkspaceInstance records from the API. # This operation lazily loads records as efficiently as possible until the limit # is reached. def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end ## # Retrieve a single page of WorkspaceInstance records from the API. # Request is executed immediately. # @param [String] friendly_name Filter by a workspace's friendly name. This is a # human readable description of this Workspace (for example "Customer Support" or # "2014 Election Campaign") # @param [String] page_token PageToken provided by the API # @param [Integer] page_number Page Number, this value is simply for client state # @param [Integer] page_size Number of records to return, defaults to 50 # @return [Page] Page of WorkspaceInstance def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) params = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) response = @version.page( 'GET', @uri, params ) WorkspacePage.new(@version, response, @solution) end ## # Retrieve a single page of WorkspaceInstance records from the API. # Request is executed immediately. # @param [String] target_url API-generated URL for the requested results page # @return [Page] Page of WorkspaceInstance def get_page(target_url) response = @version.domain.request( 'GET', target_url ) WorkspacePage.new(@version, response, @solution) end ## # Retrieve a single page of WorkspaceInstance records from the API. # Request is executed immediately. # @param [String] friendly_name Human readable description of this workspace (for # example "Customer Support" or "2014 Election Campaign") # @param [String] event_callback_url If provided, the Workspace will publish # events to this URL. You can use this to gather data for reporting. See Workspace # Events for more information. # @param [String] events_filter Use this parameter to receive webhooks on # EventCallbackUrl for specific events on a workspace. For example if # 'EventsFilter=task.created,task.canceled,worker.activity.update', then # TaskRouter will webhook to EventCallbackUrl only when a task is created, # canceled or a worker activity is updated. # @param [Boolean] multi_task_enabled Multi tasking allows workers to handle # multiple tasks simultaneously. When enabled (MultiTaskEnabled=true), each worker # will be eligible to receive parallel reservations up to the per-channel maximums # defined in the Workers section. Default is disabled (MultiTaskEnabled=false), # where each worker will only receive a new reservation when the previous task is # completed. Learn more by visiting [Multitasking][/docs/taskrouter/multitasking]. # @param [String] template One of the available template names. Will pre-configure # this Workspace with the Workflow and Activities specified in the template. # "NONE" will create a Workspace with a set of default activities and nothing # else. "FIFO" will configure TaskRouter with a set of default activities and a # single task queue for first-in, first-out distribution, useful if you want to # see a simple TaskRouter configuration when getting started. Defaults to "NONE". # @param [workspace.QueueOrder] prioritize_queue_order Use this parameter to # configure whether to prioritize LIFO or FIFO when workers are receiving Tasks # from combination of LIFO and FIFO TaskQueues. Default is FIFO. [Click # here][/docs/taskrouter/queue-ordering-last-first-out-lifo] to learn more about # LIFO and the use of the parameter. # @return [WorkspaceInstance] Newly created WorkspaceInstance def create(friendly_name: nil, event_callback_url: :unset, events_filter: :unset, multi_task_enabled: :unset, template: :unset, prioritize_queue_order: :unset) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'EventCallbackUrl' => event_callback_url, 'EventsFilter' => events_filter, 'MultiTaskEnabled' => multi_task_enabled, 'Template' => template, 'PrioritizeQueueOrder' => prioritize_queue_order, }) payload = @version.create( 'POST', @uri, data: data ) WorkspaceInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '#<Twilio.Taskrouter.V1.WorkspaceList>' end end class WorkspacePage < Page ## # Initialize the WorkspacePage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [WorkspacePage] WorkspacePage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of WorkspaceInstance # @param [Hash] payload Payload response from the API # @return [WorkspaceInstance] WorkspaceInstance def get_instance(payload) WorkspaceInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '<Twilio.Taskrouter.V1.WorkspacePage>' end end class WorkspaceContext < InstanceContext ## # Initialize the WorkspaceContext # @param [Version] version Version that contains the resource # @param [String] sid The sid # @return [WorkspaceContext] WorkspaceContext def initialize(version, sid) super(version) # Path Solution @solution = {sid: sid, } @uri = "/Workspaces/#{@solution[:sid]}" # Dependents @activities = nil @events = nil @tasks = nil @task_queues = nil @workers = nil @workflows = nil @statistics = nil @real_time_statistics = nil @cumulative_statistics = nil @task_channels = nil end ## # Fetch a WorkspaceInstance # @return [WorkspaceInstance] Fetched WorkspaceInstance def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) WorkspaceInstance.new(@version, payload, sid: @solution[:sid], ) end ## # Update the WorkspaceInstance # @param [String] default_activity_sid The ID of the Activity that will be used # when new Workers are created in this Workspace. # @param [String] event_callback_url The Workspace will publish events to this # URL. You can use this to gather data for reporting. See # [Events][/docs/taskrouter/api/events] for more information. # @param [String] events_filter Use this parameter to receive webhooks on # EventCallbackUrl for specific events on a workspace. For example if # 'EventsFilter=task.created,task.canceled,worker.activity.update', then # TaskRouter will webhook to EventCallbackUrl only when a task is created, # canceled or a worker activity is updated. # @param [String] friendly_name Human readable description of this workspace (for # example "Sales Call Center" or "Customer Support Team") # @param [Boolean] multi_task_enabled Enable or Disable Multitasking by passing # either *true* or *False* with the POST request. Learn more by visiting # [Multitasking][/docs/taskrouter/multitasking]. # @param [String] timeout_activity_sid The ID of the Activity that will be # assigned to a Worker when a Task reservation times out without a response. # @param [workspace.QueueOrder] prioritize_queue_order Use this parameter to # configure whether to prioritize LIFO or FIFO when workers are receiving Tasks # from combination of LIFO and FIFO TaskQueues. Default is FIFO. [Click # here][/docs/taskrouter/queue-ordering-last-first-out-lifo] to learn more about # LIFO and the use of the parameter. # @return [WorkspaceInstance] Updated WorkspaceInstance def update(default_activity_sid: :unset, event_callback_url: :unset, events_filter: :unset, friendly_name: :unset, multi_task_enabled: :unset, timeout_activity_sid: :unset, prioritize_queue_order: :unset) data = Twilio::Values.of({ 'DefaultActivitySid' => default_activity_sid, 'EventCallbackUrl' => event_callback_url, 'EventsFilter' => events_filter, 'FriendlyName' => friendly_name, 'MultiTaskEnabled' => multi_task_enabled, 'TimeoutActivitySid' => timeout_activity_sid, 'PrioritizeQueueOrder' => prioritize_queue_order, }) payload = @version.update( 'POST', @uri, data: data, ) WorkspaceInstance.new(@version, payload, sid: @solution[:sid], ) end ## # Deletes the WorkspaceInstance # @return [Boolean] true if delete succeeds, true otherwise def delete @version.delete('delete', @uri) end ## # Access the activities # @return [ActivityList] # @return [ActivityContext] if sid was passed. def activities(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ActivityContext.new(@version, @solution[:sid], sid, ) end unless @activities @activities = ActivityList.new(@version, workspace_sid: @solution[:sid], ) end @activities end ## # Access the events # @return [EventList] # @return [EventContext] if sid was passed. def events(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return EventContext.new(@version, @solution[:sid], sid, ) end unless @events @events = EventList.new(@version, workspace_sid: @solution[:sid], ) end @events end ## # Access the tasks # @return [TaskList] # @return [TaskContext] if sid was passed. def tasks(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return TaskContext.new(@version, @solution[:sid], sid, ) end unless @tasks @tasks = TaskList.new(@version, workspace_sid: @solution[:sid], ) end @tasks end ## # Access the task_queues # @return [TaskQueueList] # @return [TaskQueueContext] if sid was passed. def task_queues(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return TaskQueueContext.new(@version, @solution[:sid], sid, ) end unless @task_queues @task_queues = TaskQueueList.new(@version, workspace_sid: @solution[:sid], ) end @task_queues end ## # Access the workers # @return [WorkerList] # @return [WorkerContext] if sid was passed. def workers(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return WorkerContext.new(@version, @solution[:sid], sid, ) end unless @workers @workers = WorkerList.new(@version, workspace_sid: @solution[:sid], ) end @workers end ## # Access the workflows # @return [WorkflowList] # @return [WorkflowContext] if sid was passed. def workflows(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return WorkflowContext.new(@version, @solution[:sid], sid, ) end unless @workflows @workflows = WorkflowList.new(@version, workspace_sid: @solution[:sid], ) end @workflows end ## # Access the statistics # @return [WorkspaceStatisticsList] # @return [WorkspaceStatisticsContext] def statistics WorkspaceStatisticsContext.new(@version, @solution[:sid], ) end ## # Access the real_time_statistics # @return [WorkspaceRealTimeStatisticsList] # @return [WorkspaceRealTimeStatisticsContext] def real_time_statistics WorkspaceRealTimeStatisticsContext.new(@version, @solution[:sid], ) end ## # Access the cumulative_statistics # @return [WorkspaceCumulativeStatisticsList] # @return [WorkspaceCumulativeStatisticsContext] def cumulative_statistics WorkspaceCumulativeStatisticsContext.new(@version, @solution[:sid], ) end ## # Access the task_channels # @return [TaskChannelList] # @return [TaskChannelContext] if sid was passed. def task_channels(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return TaskChannelContext.new(@version, @solution[:sid], sid, ) end unless @task_channels @task_channels = TaskChannelList.new(@version, workspace_sid: @solution[:sid], ) end @task_channels end ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.WorkspaceContext #{context}>" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.WorkspaceContext #{context}>" end end class WorkspaceInstance < InstanceResource ## # Initialize the WorkspaceInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] sid The sid # @return [WorkspaceInstance] WorkspaceInstance def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'default_activity_name' => payload['default_activity_name'], 'default_activity_sid' => payload['default_activity_sid'], 'event_callback_url' => payload['event_callback_url'], 'events_filter' => payload['events_filter'], 'friendly_name' => payload['friendly_name'], 'multi_task_enabled' => payload['multi_task_enabled'], 'sid' => payload['sid'], 'timeout_activity_name' => payload['timeout_activity_name'], 'timeout_activity_sid' => payload['timeout_activity_sid'], 'prioritize_queue_order' => payload['prioritize_queue_order'], 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = {'sid' => sid || @properties['sid'], } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [WorkspaceContext] WorkspaceContext for this WorkspaceInstance def context unless @instance_context @instance_context = WorkspaceContext.new(@version, @params['sid'], ) end @instance_context end ## # @return [String] The ID of the account that owns this Workflow def account_sid @properties['account_sid'] end ## # @return [Time] The time the Workspace was created, given as GMT in ISO 8601 format. def date_created @properties['date_created'] end ## # @return [Time] The time the Workspace was last updated, given as GMT in ISO 8601 format. def date_updated @properties['date_updated'] end ## # @return [String] The human readable name of the default activity. def default_activity_name @properties['default_activity_name'] end ## # @return [String] The ID of the Activity that will be used when new Workers are created in this Workspace. def default_activity_sid @properties['default_activity_sid'] end ## # @return [String] If provided, the Workspace will publish events to this URL. def event_callback_url @properties['event_callback_url'] end ## # @return [String] Use this parameter to receive webhooks on EventCallbackUrl for specific events on a workspace. def events_filter @properties['events_filter'] end ## # @return [String] Filter by a workspace's friendly name. def friendly_name @properties['friendly_name'] end ## # @return [Boolean] Multi tasking allows workers to handle multiple tasks simultaneously. def multi_task_enabled @properties['multi_task_enabled'] end ## # @return [String] The unique ID of the Workspace def sid @properties['sid'] end ## # @return [String] The human readable name of the timeout activity. def timeout_activity_name @properties['timeout_activity_name'] end ## # @return [String] The ID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. def timeout_activity_sid @properties['timeout_activity_sid'] end ## # @return [workspace.QueueOrder] Use this parameter to configure whether to prioritize LIFO or FIFO when workers are receiving Tasks from combination of LIFO and FIFO TaskQueues. def prioritize_queue_order @properties['prioritize_queue_order'] end ## # @return [String] The url def url @properties['url'] end ## # @return [String] The links def links @properties['links'] end ## # Fetch a WorkspaceInstance # @return [WorkspaceInstance] Fetched WorkspaceInstance def fetch context.fetch end ## # Update the WorkspaceInstance # @param [String] default_activity_sid The ID of the Activity that will be used # when new Workers are created in this Workspace. # @param [String] event_callback_url The Workspace will publish events to this # URL. You can use this to gather data for reporting. See # [Events][/docs/taskrouter/api/events] for more information. # @param [String] events_filter Use this parameter to receive webhooks on # EventCallbackUrl for specific events on a workspace. For example if # 'EventsFilter=task.created,task.canceled,worker.activity.update', then # TaskRouter will webhook to EventCallbackUrl only when a task is created, # canceled or a worker activity is updated. # @param [String] friendly_name Human readable description of this workspace (for # example "Sales Call Center" or "Customer Support Team") # @param [Boolean] multi_task_enabled Enable or Disable Multitasking by passing # either *true* or *False* with the POST request. Learn more by visiting # [Multitasking][/docs/taskrouter/multitasking]. # @param [String] timeout_activity_sid The ID of the Activity that will be # assigned to a Worker when a Task reservation times out without a response. # @param [workspace.QueueOrder] prioritize_queue_order Use this parameter to # configure whether to prioritize LIFO or FIFO when workers are receiving Tasks # from combination of LIFO and FIFO TaskQueues. Default is FIFO. [Click # here][/docs/taskrouter/queue-ordering-last-first-out-lifo] to learn more about # LIFO and the use of the parameter. # @return [WorkspaceInstance] Updated WorkspaceInstance def update(default_activity_sid: :unset, event_callback_url: :unset, events_filter: :unset, friendly_name: :unset, multi_task_enabled: :unset, timeout_activity_sid: :unset, prioritize_queue_order: :unset) context.update( default_activity_sid: default_activity_sid, event_callback_url: event_callback_url, events_filter: events_filter, friendly_name: friendly_name, multi_task_enabled: multi_task_enabled, timeout_activity_sid: timeout_activity_sid, prioritize_queue_order: prioritize_queue_order, ) end ## # Deletes the WorkspaceInstance # @return [Boolean] true if delete succeeds, true otherwise def delete context.delete end ## # Access the activities # @return [activities] activities def activities context.activities end ## # Access the events # @return [events] events def events context.events end ## # Access the tasks # @return [tasks] tasks def tasks context.tasks end ## # Access the task_queues # @return [task_queues] task_queues def task_queues context.task_queues end ## # Access the workers # @return [workers] workers def workers context.workers end ## # Access the workflows # @return [workflows] workflows def workflows context.workflows end ## # Access the statistics # @return [statistics] statistics def statistics context.statistics end ## # Access the real_time_statistics # @return [real_time_statistics] real_time_statistics def real_time_statistics context.real_time_statistics end ## # Access the cumulative_statistics # @return [cumulative_statistics] cumulative_statistics def cumulative_statistics context.cumulative_statistics end ## # Access the task_channels # @return [task_channels] task_channels def task_channels context.task_channels end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.WorkspaceInstance #{values}>" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.WorkspaceInstance #{values}>" end end end end end end
39.503401
214
0.580541
91626080a6cf883a513b2be149263be4fdbcb4e9
948
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require "csv" require "mechanize" require "nokogiri" require "open-uri" agent = Mechanize.new{ |agent| agent.history.max_size=0 } agent.user_agent = 'Mozilla/5.0' data = [] CSV.open("teams.csv").each do |team| team_name = team[0] if not(team[1]=="html") next end p team_name url = team[2] #page = agent.get(url) begin page = Nokogiri::HTML(open(url)) # page = agent.get(url) rescue print "Error: Retrying\n" retry end page.css("table").each_with_index do |table,i| #if not([1,2,3,4,5].include?(i)) # next #end out = CSV.open("table_#{i}.csv","a") table.css("tr").each do |row| r = [team_name] row.xpath("td").each do |d| l = d.text.delete("^\u{0000}-\u{007F}") r << l.strip end if not((r[1] =~ /^-*$/) or (r[1] == "Player")) then out << r end end out.close end end
16.344828
62
0.550633
915049fa5658f5f6f22af34c2fa74895e59216b7
405
cask :v1 => 'balsamiq-mockups' do version '3.2.4' sha256 '1980c14936c4afe1afe4f1406465903e622fdf73d5cd9f6349480d6f551f3275' url "https://builds.balsamiq.com/mockups-desktop/Balsamiq_Mockups_#{version}.dmg" name 'Balsamiq Mockups' homepage 'https://balsamiq.com/' license :commercial app "Balsamiq Mockups #{version.to_i}.app" zap :delete => '~/Library/Preferences/BalsamiqMockups3' end
28.928571
83
0.758025
ab7fa33325ec00fae580e4347deb5cc5d4a8e5f4
381
require_relative '../../lib/markdowner' class PlainOverrideController < ApplicationController layout 'plain' def show @plain_override = PlainOverride.find_by_path(params[:path]) raise ActionController::RoutingError.new('Not Found') unless @plain_override @page_title = @plain_override.title params[:path] = nil # search widget grabs ALL parameters. end end
29.307692
80
0.753281
189fee98aa020d1538c54b9bd5b0f5f13981376e
1,845
# frozen_string_literal: true class Admin::AppearancesController < Admin::ApplicationController before_action :set_appearance, except: :create def show end def preview_sign_in render 'preview_sign_in', layout: 'devise' end def create @appearance = Appearance.new(appearance_params) if @appearance.save redirect_to admin_appearances_path, notice: 'Appearance was successfully created.' else render action: 'show' end end def update if @appearance.update(appearance_params) redirect_to admin_appearances_path, notice: 'Appearance was successfully updated.' else render action: 'show' end end def logo @appearance.remove_logo! @appearance.save redirect_to admin_appearances_path, notice: 'Logo was successfully removed.' end def header_logos @appearance.remove_header_logo! @appearance.save redirect_to admin_appearances_path, notice: 'Header logo was successfully removed.' end def favicon @appearance.remove_favicon! @appearance.save redirect_to admin_appearances_path, notice: 'Favicon was successfully removed.' end private # Use callbacks to share common setup or constraints between actions. def set_appearance @appearance = Appearance.current || Appearance.new end # Only allow a trusted parameter "white list" through. def appearance_params params.require(:appearance).permit(allowed_appearance_params) end def allowed_appearance_params %i[ title description logo logo_cache header_logo header_logo_cache favicon favicon_cache new_project_guidelines updated_by header_message footer_message message_background_color message_font_color email_header_and_footer_enabled ] end end
21.705882
88
0.724661
f8292ed2a54a00d9931b45e5476e996ba4845ca0
343
ENV['RAILS_ENV'] = 'test' require File.expand_path('../dummy/config/environment.rb', __FILE__) require 'rspec/rails' Dir['spec/support/**/*.rb'].each{ |f| require f } RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus end
24.5
68
0.760933
87493d242b86aa97516442e862049df0f6d15ff7
1,119
require 'chapter/search_reference' class Chapter include Her::Model attributes :chapter_note_id, :headings_from, :headings_to, :section_id has_one :chapter_note, name: '_chapter_note', data_key: '_chapter_note_id', path: '/chapter_note' has_many :headings has_many :search_references, class_name: 'Chapter::SearchReference' has_one :section def has_chapter_note? chapter_note_id.present? end def short_code goods_nomenclature_item_id.first(2) end def headings_range if headings_from == headings_to headings_from else "#{headings_from} to #{headings_to}" end end def headings_from=(headings_from) attributes[:headings_from] = headings_from.last(2).to_i end def headings_to=(headings_to) attributes[:headings_to] = headings_to.last(2).to_i end def id short_code end def reference_title "Chapter (#{short_code})" end def to_param short_code.to_s end def to_s goods_nomenclature_item_id end def request_path(opts = {}) self.class.build_request_path("/chapters/#{to_param}", attributes.dup) end end
19.631579
99
0.723861
1c40fae799cbb5d4efaebadee74c2407646279ce
318
require "test_helper" class Inline::ErbTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Inline::Erb::VERSION end def test_render_context tpl = Inline::Erb.render('tpl_test', name: 'john') assert_match tpl.strip(), 'Hi, john' end end __END__ @@ tpl_test Hi, <%= name %>
16.736842
54
0.698113
917dd6a14655e7d59723f20e31f9e11eabb046d2
186
class CreateCompaniesSkills < ActiveRecord::Migration[5.1] def change create_table :companies_skills do |t| t.references :company t.references :skill end end end
20.666667
58
0.709677
e90b38841defdd2028081508865e5a58fe7beb66
836
Pod::Spec.new do |spec| spec.name = "ResultBuilderKit" spec.version = "1.2.0" spec.summary = "A set of result-builders" spec.description = <<-DESC This library provides a set of result-builders DESC spec.homepage = "https://github.com/muukii/ResultBuilderKit" spec.license = "MIT" spec.author = { "Muukii" => "[email protected]" } spec.social_media_url = "https://twitter.com/muukii_app" spec.ios.deployment_target = "12.0" # spec.osx.deployment_target = "10.7" # spec.watchos.deployment_target = "2.0" # spec.tvos.deployment_target = "9.0" spec.source = { :git => "https://github.com/muukii/ResultBuilderKit.git", :tag => "#{spec.version}" } spec.source_files = "Sources/ResultBuilderKit/**/*.swift" spec.requires_arc = true spec.swift_versions = ["5.3", "5.4", "5.5"] end
33.44
103
0.663876
d5635849a69367380478970d2d11f5c6131d244f
1,043
Pod::Spec.new do |s| s.name = "WTUserCenterModel" s.version = "0.0.5" s.summary = "WTUserCenterModel个人中心模块" s.homepage = "https://github.com/aliang666/WTUserCenterModel" s.license = "MIT" s.author = { "jienliang000" => "[email protected]" } s.platform = :ios s.platform = :ios, "8.0" s.requires_arc = true s.source = { :git => "https://github.com/aliang666/WTUserCenterModel.git", :tag => "#{s.version}" } s.source_files = "WTUserCenterModel/*.{h,m}" s.subspec 'Abount' do |ss| ss.source_files = 'WTUserCenterModel/Abount/**/*.{h,m,c,mm}' end s.subspec 'Language' do |ss| ss.source_files = 'WTUserCenterModel/Language/**/*.{h,m,c,mm}' end s.subspec 'UserInfo' do |ss| ss.source_files = 'WTUserCenterModel/UserInfo/**/*.{h,m,c,mm}' end s.subspec 'Func' do |ss| ss.source_files = 'WTUserCenterModel/Func/**/*.{h,m,c,mm}' end s.subspec 'Cell' do |ss| ss.source_files = 'WTUserCenterModel/Cell/**/*.{h,m,c,mm}' end end
27.447368
107
0.604986
e27872ca28f8b5877a7380114a61cd6405af6294
1,114
class Termrec < Formula desc "Record videos of terminal output" homepage "https://angband.pl/termrec.html" url "https://github.com/kilobyte/termrec/archive/v0.19.tar.gz" sha256 "0550c12266ac524a8afb764890c420c917270b0a876013592f608ed786ca91dc" license "LGPL-3.0" head "https://github.com/kilobyte/termrec.git" bottle do sha256 cellar: :any, catalina: "1d93149ec34c0bf531da76b0137390ed1f05bf2e35e806f1fe875fe6648c4c2b" sha256 cellar: :any, mojave: "e3f9f241763a05de367da2ee91727674e18a126a99480a750b901a21bdad0ffb" sha256 cellar: :any, high_sierra: "d6cb43ed14ec0531824bd4eb55ddc625b5711c28b274ce78eb815501e5f3ebf2" end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "xz" def install system "./autogen.sh" system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}" system "make", "install" end test do system "#{bin}/termrec", "--help" end end
33.757576
104
0.684919
39b25b2aa7e4ae73d61b7f5911713c392b398359
3,184
# Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::Network::Mgmt::V2020_05_01 module Models # # Rewrite rule set of an application gateway. # class ApplicationGatewayRewriteRuleSet < SubResource include MsRestAzure # @return [Array<ApplicationGatewayRewriteRule>] Rewrite rules in the # rewrite rule set. attr_accessor :rewrite_rules # @return [ProvisioningState] The provisioning state of the rewrite rule # set resource. Possible values include: 'Succeeded', 'Updating', # 'Deleting', 'Failed' attr_accessor :provisioning_state # @return [String] Name of the rewrite rule set that is unique within an # Application Gateway. attr_accessor :name # @return [String] A unique read-only string that changes whenever the # resource is updated. attr_accessor :etag # # Mapper for ApplicationGatewayRewriteRuleSet class as Ruby Hash. # This will be used for serialization/deserialization. # def self.mapper() { client_side_validation: true, required: false, serialized_name: 'ApplicationGatewayRewriteRuleSet', type: { name: 'Composite', class_name: 'ApplicationGatewayRewriteRuleSet', model_properties: { id: { client_side_validation: true, required: false, serialized_name: 'id', type: { name: 'String' } }, rewrite_rules: { client_side_validation: true, required: false, serialized_name: 'properties.rewriteRules', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'ApplicationGatewayRewriteRuleElementType', type: { name: 'Composite', class_name: 'ApplicationGatewayRewriteRule' } } } }, provisioning_state: { client_side_validation: true, required: false, read_only: true, serialized_name: 'properties.provisioningState', type: { name: 'String' } }, name: { client_side_validation: true, required: false, serialized_name: 'name', type: { name: 'String' } }, etag: { client_side_validation: true, required: false, read_only: true, serialized_name: 'etag', type: { name: 'String' } } } } } end end end end
30.912621
82
0.502827
01a7ef7e0b64b682f5303045569e1b98bbf911fe
493
# Feature: User index page # As a user # I want to see a list of users # So I can see who has registered feature 'User index page', :devise do # Scenario: User listed on index page # Given I am signed in # When I visit the user index page # Then I see my own email address scenario 'user sees own email address' do user = FactoryGirl.create(:user, :admin) login_as(user, scope: :user) visit users_path expect(page).to have_content user.email end end
24.65
44
0.681542
26d94f2e93feb627d97065d60e0a5c85e4abc8bd
55,483
# This file was automatically generated, any manual changes will be lost the # next time this file is generated. # # Platform: rbx 2.2.3.n364 RubyLint.registry.register('Errno') do |defs| defs.define_constant('Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) klass.define_method('handle') do |method| method.define_optional_argument('additional') end end defs.define_constant('Errno::E2BIG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::E2BIG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::E2BIG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EACCES') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EACCES::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EACCES::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EADDRINUSE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EADDRINUSE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EADDRINUSE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EADDRNOTAVAIL') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EADDRNOTAVAIL::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EADDRNOTAVAIL::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EADV') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EADV::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EADV::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EAFNOSUPPORT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EAFNOSUPPORT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EAFNOSUPPORT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EAGAIN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EAGAIN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EAGAIN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EALREADY') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EALREADY::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EALREADY::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBADE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADF') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBADF::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADF::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADFD') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBADFD::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADFD::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADMSG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBADMSG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADMSG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADR') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBADR::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADR::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADRQC') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBADRQC::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADRQC::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADSLT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBADSLT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBADSLT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBFONT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBFONT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBFONT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBUSY') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EBUSY::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EBUSY::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECANCELED') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ECANCELED::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECANCELED::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECHILD') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ECHILD::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECHILD::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECHRNG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ECHRNG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECHRNG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECOMM') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ECOMM::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECOMM::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECONNABORTED') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ECONNABORTED::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECONNABORTED::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECONNREFUSED') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ECONNREFUSED::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECONNREFUSED::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECONNRESET') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ECONNRESET::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ECONNRESET::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDEADLK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EDEADLK::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDEADLK::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDEADLOCK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EDESTADDRREQ') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EDESTADDRREQ::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDESTADDRREQ::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDOTDOT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EDOTDOT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDOTDOT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDQUOT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EDQUOT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EDQUOT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EEXIST') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EEXIST::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EEXIST::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EFAULT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EFAULT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EFAULT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EFBIG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EFBIG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EFBIG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EHOSTDOWN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EHOSTDOWN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EHOSTDOWN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EHOSTUNREACH') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EHOSTUNREACH::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EHOSTUNREACH::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EIDRM') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EIDRM::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EIDRM::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EILSEQ') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EILSEQ::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EILSEQ::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EINPROGRESS') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EINPROGRESS::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EINPROGRESS::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EINTR') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EINTR::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EINTR::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EINVAL') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EINVAL::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EINVAL::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EIO') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EIO::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EIO::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EISCONN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EISCONN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EISCONN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EISDIR') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EISDIR::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EISDIR::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EISNAM') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EISNAM::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EISNAM::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EKEYEXPIRED') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EKEYEXPIRED::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EKEYEXPIRED::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EKEYREJECTED') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EKEYREJECTED::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EKEYREJECTED::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EKEYREVOKED') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EKEYREVOKED::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EKEYREVOKED::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL2HLT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EL2HLT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL2HLT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL2NSYNC') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EL2NSYNC::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL2NSYNC::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL3HLT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EL3HLT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL3HLT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL3RST') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EL3RST::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EL3RST::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBACC') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ELIBACC::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBACC::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBBAD') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ELIBBAD::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBBAD::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBEXEC') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ELIBEXEC::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBEXEC::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBMAX') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ELIBMAX::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBMAX::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBSCN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ELIBSCN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELIBSCN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELNRNG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ELNRNG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELNRNG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELOOP') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ELOOP::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ELOOP::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMEDIUMTYPE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EMEDIUMTYPE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMEDIUMTYPE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMFILE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EMFILE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMFILE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMLINK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EMLINK::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMLINK::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMSGSIZE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EMSGSIZE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMSGSIZE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMULTIHOP') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EMULTIHOP::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EMULTIHOP::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENAMETOOLONG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENAMETOOLONG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENAMETOOLONG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENAVAIL') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENAVAIL::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENAVAIL::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENETDOWN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENETDOWN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENETDOWN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENETRESET') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENETRESET::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENETRESET::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENETUNREACH') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENETUNREACH::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENETUNREACH::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENFILE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENFILE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENFILE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOANO') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOANO::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOANO::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOBUFS') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOBUFS::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOBUFS::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOCSI') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOCSI::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOCSI::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENODATA') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENODATA::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENODATA::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENODEV') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENODEV::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENODEV::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOENT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOENT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOENT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOEXEC') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOEXEC::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOEXEC::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOKEY') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOKEY::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOKEY::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOLCK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOLCK::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOLCK::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOLINK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOLINK::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOLINK::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOMEDIUM') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOMEDIUM::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOMEDIUM::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOMEM') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOMEM::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOMEM::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOMSG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOMSG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOMSG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENONET') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENONET::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENONET::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOPKG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOPKG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOPKG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOPROTOOPT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOPROTOOPT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOPROTOOPT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSPC') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOSPC::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSPC::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSR') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOSR::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSR::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSTR') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOSTR::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSTR::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSYS') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOSYS::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOSYS::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTBLK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTBLK::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTBLK::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTCONN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTCONN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTCONN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTDIR') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTDIR::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTDIR::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTEMPTY') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTEMPTY::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTEMPTY::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTNAM') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTNAM::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTNAM::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTRECOVERABLE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTRECOVERABLE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTRECOVERABLE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTSOCK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTSOCK::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTSOCK::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTTY') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTTY::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTTY::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTUNIQ') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENOTUNIQ::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENOTUNIQ::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENXIO') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ENXIO::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ENXIO::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EOPNOTSUPP') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EOPNOTSUPP::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EOPNOTSUPP::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EOVERFLOW') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EOVERFLOW::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EOVERFLOW::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EOWNERDEAD') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EOWNERDEAD::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EOWNERDEAD::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPERM') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EPERM::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPERM::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPFNOSUPPORT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EPFNOSUPPORT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPFNOSUPPORT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPIPE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EPIPE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPIPE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPROTO') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EPROTO::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPROTO::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPROTONOSUPPORT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EPROTONOSUPPORT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPROTONOSUPPORT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPROTOTYPE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EPROTOTYPE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EPROTOTYPE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ERANGE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ERANGE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ERANGE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EREMCHG') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EREMCHG::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EREMCHG::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EREMOTE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EREMOTE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EREMOTE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EREMOTEIO') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EREMOTEIO::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EREMOTEIO::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ERESTART') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ERESTART::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ERESTART::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ERFKILL') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ERFKILL::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ERFKILL::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EROFS') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EROFS::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EROFS::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESHUTDOWN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ESHUTDOWN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESHUTDOWN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESOCKTNOSUPPORT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ESOCKTNOSUPPORT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESOCKTNOSUPPORT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESPIPE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ESPIPE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESPIPE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESRCH') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ESRCH::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESRCH::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESRMNT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ESRMNT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESRMNT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESTALE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ESTALE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESTALE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESTRPIPE') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ESTRPIPE::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ESTRPIPE::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETIME') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ETIME::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETIME::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETIMEDOUT') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ETIMEDOUT::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETIMEDOUT::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETOOMANYREFS') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ETOOMANYREFS::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETOOMANYREFS::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETXTBSY') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::ETXTBSY::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::ETXTBSY::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EUCLEAN') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EUCLEAN::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EUCLEAN::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EUNATCH') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EUNATCH::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EUNATCH::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EUSERS') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EUSERS::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EUSERS::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EWOULDBLOCK') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EXDEV') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EXDEV::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EXDEV::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EXFULL') do |klass| klass.inherits(defs.constant_proxy('SystemCallError', RubyLint.registry)) end defs.define_constant('Errno::EXFULL::Errno') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::EXFULL::Strerror') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end defs.define_constant('Errno::FFI') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) klass.define_method('add_typedef') do |method| method.define_argument('current') method.define_argument('add') end klass.define_method('config') do |method| method.define_argument('name') end klass.define_method('config_hash') do |method| method.define_argument('name') end klass.define_method('errno') klass.define_method('find_type') do |method| method.define_argument('name') end klass.define_method('generate_function') do |method| method.define_argument('ptr') method.define_argument('name') method.define_argument('args') method.define_argument('ret') end klass.define_method('generate_trampoline') do |method| method.define_argument('obj') method.define_argument('name') method.define_argument('args') method.define_argument('ret') end klass.define_method('size_to_type') do |method| method.define_argument('size') end klass.define_method('type_size') do |method| method.define_argument('type') end end defs.define_constant('Errno::Mapping') do |klass| klass.inherits(defs.constant_proxy('Object', RubyLint.registry)) end end
27.603483
77
0.735739
ffd5cbcefbe64bc6a5c21f1156fd19a27a42c65a
373
require 'net/http' require 'json' require 'active_support' # required require 'active_support/core_ext/hash/conversions' # for Hash.from_xml require 'active_support/core_ext/string/inflections' # for demodulize require 'yt/annotations/for' module Yt module Annotations # Auto-load For to have the easy syntax Yt::Annotations.for(video_id). extend For end end
24.866667
74
0.774799
b95fbacebfab7ad7a77214fcef3022392578ceca
6,007
class PortfolioMaker::CommandLineInterface attr_accessor :user_portfolio def run capital = 0 loop do puts "How much would you like to deposit into your account?" capital = gets.chomp break if ((capital.to_i > 0) && capital.scan(/\D/).empty?) puts "Please enter correct value" end @user_portfolio = Portfolio.new(capital.to_i) main_menu end def user_portfolio @user_portfolio end def main_menu main_menu_loop_bool = true loop do puts "Select one of the following options by entering one of the below option number in your ternminal:" puts "1. Manually enter stock ticker" puts "2. Top 10 most active stocks" puts "3. My portfolio" puts "4. Quit" input = menu_input(4) case input when 1 stock_find when 2 most_active when 3 portfolio_menu when 4 main_menu_loop_bool = false end break if !(main_menu_loop_bool) end abort("Thank you for using this portfolio interface!") end def stock_find stock_info = {} #binding.pry loop do puts "Please enter stock ticker" ticker = gets.chomp if (!Stock.find_stock_with_ticker(ticker)) stock_info = Scraper.scrape_stock_page("https://finance.yahoo.com/quote/" + ticker) else stock_info = Stock.find_stock_with_ticker(ticker).make_hash_from_stock end break if (stock_info != nil) puts "Please enter a proper stock ticker (No ETFs, Crypto, Indexes etc.)" end puts "Name: #{stock_info[:name]}, Price: $#{stock_info[:price]}, market cap: $#{stock_info[:market_cap]}" puts "Select one of the following options by entering one of the below option number in your ternminal:" puts "1. Add stock to portfolio or buy more" puts "2. Return to main menu" input = menu_input(2) #binding.pry case input when 1 amount = 0 loop do puts "Select what amount would you like to buy?\n current cash = $#{user_portfolio.cash}" amount = gets.chomp break if (!(amount.to_i > user_portfolio.cash || amount.to_i <= 0) && amount.scan(/\D/).empty?) puts "Please enter valid amount within availible cash" end #binding.pry user_portfolio.create_or_buy_more(stock_info, amount.to_i) #binding.pry puts "Bought #{amount.to_i / stock_info[:price].gsub(/[\s,]/ ,"").to_f} shares of #{stock_info[:name]}" when 2 end end def most_active puts "Printing top 10 trending stocks" Scraper.scrap_trending_stocks_page end def portfolio_menu portfolio_loop_bool = true loop do puts "Manage your portfolio by entering one of the below option number in your ternminal:" puts "1. View my portfolio" puts "2. Sell stock" puts "3. Add funds" puts "4. Withdraw funds" puts "5. Return to main menu" input = menu_input(5) case input when 1 user_portfolio.display when 2 if(user_portfolio.stocks.empty?) puts "Porfolio is empty" else ticker = "" amount = 0 loop do break if (Stock.find_stock_with_ticker(ticker)) puts "Enter ticker for stock you want to sell or enter ""cancel"" to return to portfolio menu" puts "Tickers:" Stock.display_tickers ticker = gets.chomp break if ((Stock.find_stock_with_ticker(ticker)) || ticker == "cancel") puts "Please enter a valid ticker" end if !(ticker == "cancel") loop do #binding.pry puts "How much would you like to sell of $#{Stock.find_stock_with_ticker(ticker).update_stock_price} of the stock or enter ""cancel"" to return to portfolio menu" amount = gets.chomp break if ((!(amount.to_i <= 0 || amount.to_i > Stock.find_stock_with_ticker(ticker).equity.to_f) && amount.scan(/\D/).empty?) || amount == "cancel") puts "Please input correct value" end user_portfolio.sell_stock(ticker, amount.to_i) if !(amount == "cancel" ) puts "Sold $#{amount} of #{ticker}" if !(amount == "cancel") end end when 3 amount = "" loop do puts "How much would you like to deposit or enter ""cancel"" to return to portfolio menu" amount = gets.chomp break if ((!(amount.to_i <= 0) && amount.scan(/\D/).empty?) || amount == "cancel") puts "Please input correct value" end user_portfolio.deposit(amount.to_i) if !(amount == "cancel") when 4 loop do puts "How much would you like to withdraw or enter ""cancel"" to return to portfolio menu \n current cash = $#{user_portfolio.cash}" amount = gets.chomp break if ((!(amount.to_i <= 0 || amount.to_i > user_portfolio.cash) && amount.scan(/\D/).empty?) || amount == "cancel") puts "Please input correct value" end user_portfolio.withdraw(amount.to_i) if !(amount == "cancel") when 5 portfolio_loop_bool = false end break if !(portfolio_loop_bool) end end def menu_input(max) input = "" loop do input = gets.chomp break if (input.to_i.between?(1,max) && input.scan(/\D/).empty?) puts "Please enter an integer number between than 1 and #{max}:" end return input.to_i end end
30.492386
181
0.562677
e841c970ddfb934436aa69264fb1de0c0b8af0bd
266
require File.expand_path('../spec_helper', __FILE__) require File.expand_path('../../lib/phone_number_processor', __FILE__) require 'twilio-ruby' require 'vcr' VCR.configure do |c| c.cassette_library_dir = 'spec/fixtures/vcr_cassettes' c.hook_into :webmock end
26.6
70
0.766917
e98b24a7d2847011b896a1413acc76b7dde69558
2,179
# frozen_string_literal: true 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 and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false # Default from address for email config.action_mailer.default_options = { from: '[email protected]' } # We will assume that we are running on localhost config.action_mailer.default_url_options = { host: 'localhost:3000' } # Use the threaded background job adapter for some asynchrony config.active_job.queue_adapter = :background_thread # 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 # 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 = false # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. config.assets.digest = true # Adds additional error checking when serving assets at runtime. # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. config.assets.raise_runtime_errors = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true # Enable Bullet to monitor our queries config.after_initialize do Bullet.add_footer = true end end # Pretty-print our HTML in development mode. Slim::Engine.options[:pretty] = true
36.316667
85
0.771914
031e84280885a79badcbdb5d395ac39022097e66
140
require 'rails_helper' RSpec.describe "top/index.html.erb", :type => :view do pending "add some examples to (or delete) #{__FILE__}" end
23.333333
56
0.714286
7ac1e3395489ea72444624f12cfeee8ed4db25ef
2,413
RSpec.describe MiqApache::Control do it "should run_apache_cmd with start when calling start" do expect(MiqApache::Control).to receive(:run_apache_cmd).with('start') MiqApache::Control.start end it "should run_apache_cmd with graceful-stop and start when calling restart with graceful true" do expect(MiqApache::Control).to receive(:run_apache_cmd).with('stop') expect(MiqApache::Control).to receive(:run_apache_cmd).with('start') MiqApache::Control.restart end it "should run_apache_cmd with graceful-stop when calling stop with graceful true" do expect(MiqApache::Control).to receive(:run_apache_cmd).with('stop') MiqApache::Control.stop end it "should make the apache control log's directory if missing when calling run_apache_cmd" do allow(File).to receive(:exist?).and_return(false) expect(Dir).to receive(:mkdir).with(File.dirname(MiqApache::Control::APACHE_CONTROL_LOG)) allow(MiqUtil).to receive(:runcmd) MiqApache::Control.start end it "should not make the apache control log's directory if it exists when calling run_apache_cmd" do allow(File).to receive(:exist?).and_return(true) expect(Dir).to receive(:mkdir).with(File.dirname(MiqApache::Control::APACHE_CONTROL_LOG)).never allow(MiqUtil).to receive(:runcmd) MiqApache::Control.start end it "should build cmdline when calling run_apache_cmd with start" do cmd = "start" allow(File).to receive(:exist?).and_return(true) $log = Logger.new(STDOUT) unless $log allow($log).to receive(:debug?).and_return(false) expect(MiqUtil).to receive(:runcmd).with("apachectl #{cmd}") MiqApache::Control.start end it "should build cmdline when calling run_apache_cmd with start in debug mode if $log is debug" do cmd = "start" allow(File).to receive(:exist?).and_return(true) $log = Logger.new(STDOUT) unless $log allow($log).to receive(:debug?).and_return(true) expect(MiqUtil).to receive(:runcmd).with("apachectl #{cmd}") MiqApache::Control.start end it "should log a warning when calling run_apache_cmd with start that raises an error" do allow(File).to receive(:exist?).and_return(true) $log = Logger.new(STDOUT) unless $log allow($log).to receive(:debug?).and_return(false) allow(MiqUtil).to receive(:runcmd).and_raise("warn") expect($log).to receive(:warn) MiqApache::Control.start end end
40.898305
101
0.726896
acea2a4c859603b5fea5e6a276a11442cda3b92b
2,759
# This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! require 'sucker_punch/testing/inline' # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end # in _spec.rb will both be required and run as specs, causing the specs to be # run twice. It is recommended that you do not name files matching this glob to # end with _spec.rb. You can configure this pattern with the --pattern # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. # # The following line is provided for convenience purposes. It has the downside # of increasing the boot-up time by auto-requiring all files in the support # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } # Checks for pending migrations and applies them before tests are run. # If you are not using ActiveRecord, you can remove this line. ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. config.use_transactional_fixtures = true # RSpec Rails can automatically mix in different behaviours to your tests # based on their file location, for example enabling you to call `get` and # `post` in specs under `spec/controllers`. # # You can disable this behaviour by removing the line below, and instead # explicitly tag your specs with their type, e.g.: # # RSpec.describe UsersController, :type => :controller do # # ... # end # # The different available types are documented in the features, such as in # https://relishapp.com/rspec/rspec-rails/docs config.infer_spec_type_from_file_location! # Filter lines from Rails gems in backtraces. config.filter_rails_from_backtrace! # arbitrary gems may also be filtered via: # config.filter_gems_from_backtrace("gem name") # Rspec helpers. config.include Helpers end
43.793651
86
0.750997
ffb2ff1c9d150fe3a7efb425850515ef2e666bbe
449
module Badger def Badger.badge text, badge_url, target_url badge_url = "%s.%s" % [ badge_url, Config.instance.config['badge_type'] ] unless ['Repo Size', 'Dependency CI'].include? text badge_style = Config.instance.config['badge_style'] badge_url = "%s?style=%s" % [ badge_url, badge_style ] if badge_style "[![%s](%s)](%s)" % [ text, badge_url, target_url ] end end
21.380952
57
0.576837
e9c8fc25756b0603b193c477212f6ce2095f72d0
345
class AwsSnsMessage::Base < ApplicationRecord self.table_name = :aws_sns_messages belongs_to :recording, optional: true include EventPublisher validates :type, presence: true validates :aws_sns_message_id, presence: true, uniqueness: true def payload_message payload["Message"] end end
18.157895
45
0.686957
08d69ecfde96a286611c9e67050ccf6588fca5f0
1,094
=begin #Accounting API #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 2.1.3 Contact: [email protected] Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.0 =end require 'spec_helper' require 'json' require 'date' # Unit tests for WorkflowMaxRuby::Accounting::ReportWithRows # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe 'ReportWithRows' do before do # run before each test @instance = WorkflowMaxRuby::Accounting::ReportWithRows.new end after do # run after each test end describe 'test an instance of ReportWithRows' do it 'should create an instance of ReportWithRows' do expect(@instance).to be_instance_of(WorkflowMaxRuby::Accounting::ReportWithRows) end end describe 'test attribute "reports"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end
26.047619
107
0.754113
21fa9e50434cf2ebf0a3485bb5fdc90ec1de4f6b
341
module SessionsHelper def sign_in(user) cookies.permanent[:auth_token] = user.id end def current_user @current_user ||= User.find_by(id: cookies[:auth_token]) if cookies[:auth_token] end def user_signed_in? current_user.present? end def sign_out_user cookies.delete(:auth_token) if user_signed_in? end end
18.944444
84
0.727273
5db94784cbc2ee929ce74cd793afb13d4bcc4c80
720
# # Cookbook Name:: hadoop # Recipe:: oozie_client # # Copyright © 2013-2014 Cask Data, 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. # include_recipe 'hadoop::repo' package 'oozie-client' do action :install end
28.8
74
0.75
3812dda6ba082a3b6de092eb3175bfaa82da65b3
1,373
# frozen_string_literal: true # rubocop:disable Gitlab/ModuleWithInstanceVariables module EE module Admin module UsersController extend ::Gitlab::Utils::Override def reset_runners_minutes user if ClearNamespaceSharedRunnersMinutesService.new(@user.namespace).execute redirect_to [:admin, @user], notice: _('User pipeline minutes were successfully reset.') else flash.now[:error] = _('There was an error resetting user pipeline minutes.') render "edit" end end private override :users_with_included_associations def users_with_included_associations(users) super.includes(:oncall_schedules) # rubocop: disable CodeReuse/ActiveRecord end override :log_impersonation_event def log_impersonation_event super log_audit_event end def log_audit_event EE::AuditEvents::ImpersonationAuditEventService.new(current_user, request.remote_ip, 'Started Impersonation') .for_user(full_path: user.username, entity_id: user.id).security_event end def allowed_user_params super + [ namespace_attributes: [ :id, :shared_runners_minutes_limit, gitlab_subscription_attributes: [:hosted_plan_id] ] ] end end end end
26.921569
117
0.666424
037e96335fd901d5c82b88d76da9cb4ae8898e74
1,424
module TPPlus module Motion module Utilities extend self def is_digit_or_letter?(char, expected) if char.to_s.match?(/[FUTfutNBDnbd]/) return expected == :char elsif char.to_s.match?(/[-?\d+]/) return expected == :number else return false end end def merge_components(comp_list1, comp_list2) #if set pose components are not the same size as the default components #merge the absent components with default components comp_list_merge = comp_list1.clone if comp_list1.length < comp_list2.length comp_list_merge = (comp_list1 << comp_list2[comp_list1.length..-1]).flatten end comp_list_merge end def merge_components_back(comp_list1, comp_list2) #if set pose components are not the same size as the default components #merge the absent components with default components comp_list_merge = comp_list1.clone if comp_list1.length < comp_list2.length comp_list_merge = (comp_list2[0..comp_list1.length-1] << comp_list1).flatten end comp_list_merge end end end end
37.473684
96
0.543539
622bb91e5466a4cfc8b45b8adbb58c906cf54f4b
3,323
module Brakeman class TemplateParser include Brakeman::Util attr_reader :tracker KNOWN_TEMPLATE_EXTENSIONS = /.*\.(erb|haml|rhtml|slim)$/ TemplateFile = Struct.new(:path, :ast, :name, :type) def initialize tracker, file_parser @tracker = tracker @file_parser = file_parser @file_parser.file_list[:templates] ||= [] end def parse_template path, text type = path.match(KNOWN_TEMPLATE_EXTENSIONS)[1].to_sym type = :erb if type == :rhtml name = template_path_to_name path Brakeman.debug "Parsing #{path}" begin src = case type when :erb type = :erubis if erubis? parse_erb path, text when :haml parse_haml path, text when :slim parse_slim path, text else tracker.error "Unknown template type in #{path}" nil end if src and ast = @file_parser.parse_ruby(src, path) @file_parser.file_list[:templates] << TemplateFile.new(path, ast, name, type) end rescue Racc::ParseError => e tracker.error e, "Could not parse #{path}" rescue StandardError, LoadError => e tracker.error e.exception(e.message + "\nWhile processing #{path}"), e.backtrace end nil end def parse_erb path, text if tracker.config.escape_html? if tracker.options[:rails3] require 'brakeman/parsers/rails3_erubis' Brakeman::Rails3Erubis.new(text, :filename => path).src else require 'brakeman/parsers/rails2_xss_plugin_erubis' Brakeman::Rails2XSSPluginErubis.new(text, :filename => path).src end elsif tracker.config.erubis? require 'brakeman/parsers/rails2_erubis' Brakeman::ScannerErubis.new(text, :filename => path).src else require 'erb' src = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ ERB.new(text, trim_mode: '-').src else ERB.new(text, nil, '-').src end src.sub!(/^#.*\n/, '') if Brakeman::Scanner::RUBY_1_9 src end end def erubis? tracker.config.escape_html? or tracker.config.erubis? end def parse_haml path, text Brakeman.load_brakeman_dependency 'haml' require_relative 'haml_embedded' Haml::Engine.new(text, :filename => path, :escape_html => tracker.config.escape_html?).precompiled.gsub(/([^\\])\\n/, '\1') rescue Haml::Error => e tracker.error e, ["While compiling HAML in #{path}"] << e.backtrace nil end def parse_slim path, text Brakeman.load_brakeman_dependency 'slim' require_relative 'slim_embedded' Slim::Template.new(path, :disable_capture => true, :generator => Temple::Generators::RailsOutputBuffer) { text }.precompiled_template end def self.parse_inline_erb tracker, text fp = Brakeman::FileParser.new(tracker, nil) tp = self.new(tracker, fp) src = tp.parse_erb '_inline_', text type = tp.erubis? ? :erubis : :erb return type, fp.parse_ruby(src, "_inline_") end end end
31.056075
107
0.59043
26ded4c592bf23ddc8f10d6ea0b41e300a098254
225
class CreateCats < ActiveRecord::Migration[5.2] def change create_table :cats do |t| t.string :name t.string :color t.boolean :kid_friendly t.integer :age t.timestamps() end end end
17.307692
47
0.622222
91741bd1266ef69c7de83f12ddd5d4c71d247b3a
2,545
class Pyqt < Formula desc "Python bindings for v5 of Qt" homepage "https://www.riverbankcomputing.com/software/pyqt/download5" url "https://files.pythonhosted.org/packages/28/6c/640e3f5c734c296a7193079a86842a789edb7988dca39eab44579088a1d1/PyQt5-5.15.2.tar.gz" sha256 "372b08dc9321d1201e4690182697c5e7ffb2e0770e6b4a45519025134b12e4fc" license "GPL-3.0-only" livecheck do url :stable end bottle do cellar :any sha256 "167b4359448c02c360fb319a370ae27a002c2ad00430eb0ecf81b22f04714286" => :big_sur sha256 "81c8c29e4a74e31ab9cfe8bcce524c991941f69861ab61fba073a42e24707218" => :catalina sha256 "25cb031596225a40027d02948692044d153a8f7d1e28102fb2b13db4146c7635" => :mojave sha256 "27cfe29bfb96db2ec78affeea960100ca32b816b45acf9993da291dd292806f6" => :x86_64_linux end depends_on "[email protected]" depends_on "qt" depends_on "sip" resource "PyQt5-sip" do url "https://files.pythonhosted.org/packages/73/8c/c662b7ebc4b2407d8679da68e11c2a2eb275f5f2242a92610f6e5024c1f2/PyQt5_sip-12.8.1.tar.gz" sha256 "30e944db9abee9cc757aea16906d4198129558533eb7fadbe48c5da2bd18e0bd" end def install version = Language::Python.major_minor_version Formula["[email protected]"].opt_bin/"python3" args = ["--confirm-license", "--bindir=#{bin}", "--destdir=#{lib}/python#{version}/site-packages", "--stubsdir=#{lib}/python#{version}/site-packages/PyQt5", "--sipdir=#{share}/sip/Qt5", # sip.h could not be found automatically "--sip-incdir=#{Formula["sip"].opt_include}", "--qmake=#{Formula["qt"].bin}/qmake", # Force deployment target to avoid libc++ issues "QMAKE_MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}", "--designer-plugindir=#{pkgshare}/plugins", "--qml-plugindir=#{pkgshare}/plugins", "--pyuic5-interpreter=#{Formula["[email protected]"].opt_bin}/python3", "--verbose"] system Formula["[email protected]"].opt_bin/"python3", "configure.py", *args system "make" ENV.deparallelize { system "make", "install" } end test do system "#{bin}/pyuic5", "--version" system "#{bin}/pylupdate5", "-version" system Formula["[email protected]"].opt_bin/"python3", "-c", "import PyQt5" m = %w[ Gui Location Multimedia Network Quick Svg Widgets Xml ] m << "WebEngineWidgets" if OS.mac? m.each { |mod| system Formula["[email protected]"].opt_bin/"python3", "-c", "import PyQt5.Qt#{mod}" } end end
36.357143
140
0.675442
1d8d7128c049a3efb729cb61ef90bdf814f0a0b9
4,944
class Admin::CategoriesController < Admin::AdminBaseController def index @selected_left_navi_link = "listing_categories" @categories = @current_community.top_level_categories.includes(:translations, children: :translations) end def new @selected_left_navi_link = "listing_categories" @category = Category.new shapes = get_shapes selected_shape_ids = shapes.map { |s| s[:id] } # all selected by defaults render locals: { shapes: shapes, selected_shape_ids: selected_shape_ids } end def create @selected_left_navi_link = "listing_categories" @category = Category.new(params[:category].except(:listing_shapes)) @category.community = @current_community @category.parent_id = nil if params[:category][:parent_id].blank? @category.sort_priority = Admin::SortingService.next_sort_priority(@current_community.categories) shapes = get_shapes selected_shape_ids = shape_ids_from_params(params) if @category.save update_category_listing_shapes(selected_shape_ids, @category) redirect_to admin_categories_path else flash[:error] = "Category saving failed" render :action => :new, locals: { shapes: shapes, selected_shape_ids: selected_shape_ids } end end def edit @selected_left_navi_link = "listing_categories" @category = @current_community.categories.find_by_url_or_id(params[:id]) shapes = get_shapes selected_shape_ids = CategoryListingShape.where(category_id: @category.id).map(&:listing_shape_id) render locals: { shapes: shapes, selected_shape_ids: selected_shape_ids } end def update @selected_left_navi_link = "listing_categories" @category = @current_community.categories.find_by_url_or_id(params[:id]) shapes = get_shapes selected_shape_ids = shape_ids_from_params(params) if @category.update_attributes(params[:category].except(:listing_shapes)) update_category_listing_shapes(selected_shape_ids, @category) redirect_to admin_categories_path else flash[:error] = "Category saving failed" render :action => :edit, locals: { shapes: shapes, selected_shape_ids: selected_shape_ids } end end def order new_sort_order = params[:order].map(&:to_i).each_with_index order_categories!(new_sort_order) render nothing: true, status: 200 end # Remove form def remove @selected_left_navi_link = "listing_categories" @category = @current_community.categories.find_by_url_or_id(params[:id]) @possible_merge_targets = Admin::CategoryService.merge_targets_for(@current_community.categories, @category) end # Remove action def destroy @category = @current_community.categories.find_by_url_or_id(params[:id]) @category.destroy redirect_to admin_categories_path end def destroy_and_move @category = @current_community.categories.find_by_url_or_id(params[:id]) new_category = @current_community.categories.find_by_url_or_id(params[:new_category]) if new_category # Move listings @category.own_and_subcategory_listings.update_all(:category_id => new_category.id) # Move custom fields Admin::CategoryService.move_custom_fields!(@category, new_category) end @category.destroy redirect_to admin_categories_path end private ## # Builds the following for category ids and corresponding priorities: # UPDATE categories # SET sort_priority = CASE id # WHEN 1 THEN 0 # WHEN 2 THEN 1 # . # . # . # END # WHERE id IN(1, 2, ...); ## def order_categories!(sort_priorities) base = "sort_priority = CASE id\n" update_statements = sort_priorities.reduce(base) do |sql, (cat_id, priority)| sql + "WHEN #{cat_id} THEN #{priority}\n" end update_statements += "END" @current_community.categories.update_all(update_statements) end def update_category_listing_shapes(shape_ids, category) shapes = ListingService::API::Api.shapes.get(community_id: @current_community.id)[:data] selected_shapes = shapes.select { |s| shape_ids.include? s[:id] } raise ArgumentError.new("No shapes selected for category #{category.id}, shape_ids: #{shape_ids}") if selected_shapes.empty? CategoryListingShape.delete_all(category_id: category.id) selected_shapes.each { |s| CategoryListingShape.create!(category_id: category.id, listing_shape_id: s[:id]) } end def shape_ids_from_params(params) params[:category][:listing_shapes].map { |s_param| s_param[:listing_shape_id].to_i } end def get_shapes ListingService::API::Api.shapes.get(community_id: @current_community.id).maybe.or_else(nil).tap { |shapes| raise ArgumentError.new("Cannot find any shapes for community #{@current_community.id}") if shapes.nil? } end end
34.816901
128
0.712783
e8366393c4ac2039a9ded89811498ce3c1192197
188
class RemoveTripOrderFromFlights < ActiveRecord::Migration[5.0] def up remove_column :flights, :trip_order end def down add_column :flights, :trip_order, :integer end end
18.8
63
0.739362
18522b110a3c3b2bb984f38455c5d6cd8bea4384
256
class AddIsVisibleAndLabelToSystemConfigFieldCustomizations < ActiveRecord::Migration[5.2] def change add_column :system_config_field_customizations, :is_visible, :boolean add_column :system_config_field_customizations, :label, :string end end
36.571429
90
0.828125
4ae3f6c6876bd966a62afc5a69e52b3e8219abba
252
#!/usr/bin/env ruby require 'parser/current' code = Dir.glob "#{__dir__}/kintama/scripts/*" code.each do |path| file = File.read path puts file p Parser::CurrentRuby.parse(file) p Parser::CurrentRuby.parse(file).to_hash puts "\n---\n" end
18
46
0.686508
91483e39f5c0c56b37c30e4a412a4ca0b770e059
323
class RemoveTokensFromUserAccounts < ActiveRecord::Migration def change remove_column :user_accounts, :token_expires_at, :datetime, after: :token_secret remove_column :user_accounts, :token_secret, :string, after: :token remove_column :user_accounts, :token, :string, null: false, after: :image_url end end
40.375
84
0.773994
393e3df1d3e915494da621599b6d647b2a996ce9
3,364
## # This module requires Metasploit: https://metasploit.com/download # Current source: https://github.com/rapid7/metasploit-framework ## class MetasploitModule < Msf::Post include Msf::Post::Windows::Registry include Msf::Auxiliary::Report include Msf::Post::Windows::UserProfiles def initialize(info = {}) super( update_info( info, 'Name' => 'Windows Gather WS_FTP Saved Password Extraction', 'Description' => %q{ This module extracts weakly encrypted saved FTP Passwords from WS_FTP. It finds saved FTP connections in the ws_ftp.ini file. }, 'License' => MSF_LICENSE, 'Author' => [ 'theLightCosine'], 'Platform' => [ 'win' ], 'SessionTypes' => [ 'meterpreter' ], 'Compat' => { 'Meterpreter' => { 'Commands' => %w[ core_channel_eof core_channel_open core_channel_read core_channel_write stdapi_fs_stat ] } } ) ) end def run print_status("Checking Default Locations...") grab_user_profiles().each do |user| next if user['AppData'] == nil check_appdata(user['AppData'] + "\\Ipswitch\\WS_FTP\\Sites\\ws_ftp.ini") check_appdata(user['AppData'] + "\\Ipswitch\\WS_FTP Home\\Sites\\ws_ftp.ini") end end def check_appdata(path) begin client.fs.file.stat(path) print_status("Found File at #{path}") get_ini(path) rescue print_status("#{path} not found ....") end end def get_ini(filename) config = client.fs.file.new(filename, 'r') parse = config.read ini = Rex::Parser::Ini.from_s(parse) ini.each_key do |group| next if group == "_config_" print_status("Processing Saved Session #{group}") host = ini[group]['HOST'] host = host.delete "\"" username = ini[group]['UID'] username = username.delete "\"" port = ini[group]['PORT'] passwd = ini[group]['PWD'] passwd = decrypt(passwd) next if passwd == nil or passwd == "" port = 21 if port == nil print_good("Host: #{host} Port: #{port} User: #{username} Password: #{passwd}") service_data = { address: Rex::Socket.getaddress(host), port: port, protocol: "tcp", service_name: "ftp", workspace_id: myworkspace_id } credential_data = { origin_type: :session, session_id: session_db_id, post_reference_name: self.refname, username: username, private_data: passwd, private_type: :password } credential_core = create_credential(credential_data.merge(service_data)) login_data = { core: credential_core, access_level: "User", status: Metasploit::Model::Login::Status::UNTRIED } create_credential_login(login_data.merge(service_data)) end end def decrypt(pwd) decoded = pwd.unpack("m*")[0] key = "\xE1\xF0\xC3\xD2\xA5\xB4\x87\x96\x69\x78\x4B\x5A\x2D\x3C\x0F\x1E\x34\x12\x78\x56\xab\x90\xef\xcd" iv = "\x34\x12\x78\x56\xab\x90\xef\xcd" des = OpenSSL::Cipher.new("des-ede3-cbc") des.decrypt des.key = key des.iv = iv result = des.update(decoded) final = result.split("\000")[0] return final end end
27.349593
108
0.593341
088960a458156e0fd2877b60a4dd6e5aa093c0d7
1,062
Pod::Spec.new do |s| s.name = 'FTS3HTMLTokenizer' s.version = '3.2.2' s.summary = 'FTS3 HTML Tokenizer' s.license = 'MIT' s.author = 'Stephan Heilner' s.homepage = 'https://github.com/stephanheilner/FTS3HTMLTokenizer' s.source = { :git => "https://github.com/stephanheilner/FTS3HTMLTokenizer.git", :tag => s.version.to_s } s.requires_arc = false s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' s.source_files = 'Sources/FTS3HTMLTokenizer/*.{h,c}', 'Sources/FTS3HTMLTokenizer/fts/*.{h,c}', 'Sources/libstemmer_c/libstemmer/libstemmer.c', 'Sources/libstemmer_c/libstemmer/modules.h', 'Sources/libstemmer_c/include/*.h', 'Sources/libstemmer_c/src_c/*.{h,c}', 'Sources/libstemmer_c/runtime/*.{h,c}' s.preserve_paths = 'Sources/libstemmer_c/libstemmer/*', 'Sources/libstemmer_c/src_c/*' s.public_header_files = 'Sources/FTS3HTMLTokenizer/fts3_html_tokenizer.h' s.private_header_files = 'Sources/FTS3HTMLTokenizer/fts/*.h' s.libraries = 'sqlite3' s.swift_version = '5.0' end
55.894737
302
0.694915
2837d1c02c4bc9492e1a9623ea4199a5d3ebbbe9
2,543
# frozen_string_literal: true require 'spec_helper' RSpec.describe API::DependencyProxy, api: true do include ExclusiveLeaseHelpers let_it_be(:user) { create(:user) } let_it_be(:blob) { create(:dependency_proxy_blob )} let_it_be(:group, reload: true) { blob.group } before do group.add_owner(user) stub_config(dependency_proxy: { enabled: true }) stub_last_activity_update end describe 'DELETE /groups/:id/dependency_proxy/cache' do subject { delete api("/groups/#{group_id}/dependency_proxy/cache", user) } shared_examples 'responding to purge requests' do context 'with feature available and enabled' do let_it_be(:lease_key) { "dependency_proxy:delete_group_blobs:#{group.id}" } context 'an admin user' do it 'deletes the blobs and returns no content' do stub_exclusive_lease(lease_key, timeout: 1.hour) expect(PurgeDependencyProxyCacheWorker).to receive(:perform_async) subject expect(response).to have_gitlab_http_status(:accepted) expect(response.body).to eq('202') end context 'called multiple times in one hour', :clean_gitlab_redis_shared_state do it 'returns 409 with an error message' do stub_exclusive_lease_taken(lease_key, timeout: 1.hour) subject expect(response).to have_gitlab_http_status(:conflict) expect(response.body).to include('This request has already been made.') end it 'executes service only for the first time' do expect(PurgeDependencyProxyCacheWorker).to receive(:perform_async).once 2.times { subject } end end end context 'a non-admin' do let(:user) { create(:user) } before do group.add_maintainer(user) end it_behaves_like 'returning response status', :forbidden end end context 'depencency proxy is not enabled in the config' do before do stub_config(dependency_proxy: { enabled: false }) end it_behaves_like 'returning response status', :not_found end end context 'with a group id' do let(:group_id) { group.id } it_behaves_like 'responding to purge requests' end context 'with an url encoded group id' do let(:group_id) { ERB::Util.url_encode(group.full_path) } it_behaves_like 'responding to purge requests' end end end
29.229885
90
0.644514
21038b8416a080c0b5d6802ec18575c28c352d43
1,996
class Photographer < ActiveRecord::Base # Devise modules. Others available are: :encryptable, :confirmable, :timeoutable and :omniauthable, :trackable devise :database_authenticatable, :token_authenticatable, :recoverable, :rememberable, :lockable, :validatable # Validations validates :name, :presence => true, :length => { :within => 3..80 } validates :tagline, :presence => true, :length => { :within => 3..128 } validates :phone, :length => { :within => 7..20, :allow_blank => true } validates :description, :length => { :within => 10..255, :allow_blank => true } validates :time_zone, :presence => true, :inclusion => { :in => ActiveSupport::TimeZone.zones_map.keys } validates :portfolio_url, :length => { :within => 10..512, :allow_blank => true } validates :blog_url, :length => { :within => 10..512, :allow_blank => true } validates :facebook_url, :length => { :within => 10..255, :allow_blank => true } validates :twitter_url, :length => { :within => 10..255, :allow_blank => true } validates :disqus_short_name, :length => { :within => 2..64, :allow_blank => true } validates :conversion_code, :length => { :within => 10..9000, :allow_blank => true } # Mass-assignment protection attr_accessible :email, :password, :name, :tagline, :time_zone, :description, :phone, :portfolio_url, :blog_url, :facebook_url, :twitter_url, :google_analytics_key, :google_verification, :conversion_code, :remember_me # Make sure we always have an auth token assigned. before_save :ensure_authentication_token # Caching CACHED = 'photographer' after_save :clear_cache def self.cached #Rails.cache.fetch(CACHED, :expires_in => 1.day) do self.first #end end def clear_cache #Rails.cache.delete(CACHED) end def self.clear_cache #Rails.cache.delete(CACHED) end # Logging after_update :log_update_event private #---- def log_update_event Event.create(:description => "Changed site settings.") end end
36.962963
219
0.689379
2116b39ea6023ed46153a183cd2cf192c34e49cb
924
require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module QuotesApp class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. config.time_zone = 'Eastern Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true end end
36.96
98
0.737013
d516b6db7d3e50bdf7aa7bccf3969b73ed200286
443
require 'spec_helper' describe Algorithmable::Searches do context '#when factoring new objects' do let(:factory) do Object.new.extend Algorithmable::Searches end it do search = factory.binary_search(1, [2, 4, 5, 1].sort) expect(search).to eq(0) end it do tree = factory.new_binary_search_tree(String, Fixnum) expect(tree).to be_kind_of described_class::BinarySearchTree end end end
22.15
66
0.681716
4a792070bc6ed2747e4734fbeeba6c8bf855e1db
132
package 'php5-gd' do action :install end execute 'php5enmod gd' do command 'php5enmod gd' not_if "php -m | grep -q 'gd'" end
14.666667
32
0.674242
ac46516dab628c74808d914138b09c13fb3115e3
974
# # Author:: Christo De Lange (<[email protected]>) # Cookbook Name:: php # Recipe:: ini # # Copyright 2011-2015, Chef Software, 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. # template "#{node['php']['conf_dir']}/php.ini" do source node['php']['ini']['template'] cookbook node['php']['ini']['cookbook'] unless platform?('windows') owner 'root' group node['root_group'] mode '0644' end variables(directives: node['php']['directives']) end
31.419355
74
0.711499
f7ca7fe633c1c037d6686ef7f8d72014ad3e94dc
936
# 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 ServiceusageV1 # Version of the google-apis-serviceusage_v1 gem GEM_VERSION = "0.9.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 = "20210525" end end end
32.275862
74
0.730769
f803152685dfbb1808b3ffaf8c55e1c2634876a0
315
class AddConfigTable < ActiveRecord::Migration def self.up # Config table has been moved to tog-core end def self.down # Config table has been moved to tog-core end end
31.5
111
0.422222
26464458d84b011aaad910272740939ed65934fe
1,253
name "td" #version '' # git ref dependency "td-agent-files" build do block do # setup related files pkg_type = project.packagers_for_system.first.id.to_s install_path = project.install_dir # for ERB project_name = project.name # for ERB project_name_snake = project.name.gsub('-', '_') # for variable names in ERB project_name_snake_upcase = project_name_snake.upcase rb_major, rb_minor, rb_teeny = project.overrides[:ruby][:version].split("-", 2).first.split(".", 3) gem_dir_version = "#{rb_major}.#{rb_minor}.0" # gem path's teeny version is always 0 template = ->(*parts) { File.join('templates', *parts) } generate_from_template = ->(dst, src, erb_binding, opts={}) { mode = opts.fetch(:mode, 0755) destination = dst.gsub('td-agent', project.name) FileUtils.mkdir_p File.dirname(destination) File.open(destination, 'w', mode) do |f| f.write ERB.new(File.read(src)).result(erb_binding) end } # setup td and td-agent scripts td_bin_path = File.join(install_path, 'usr', 'bin', 'td') # templates/usr/bin/td.erb -> INSTALL_PATH/usr/bin/td generate_from_template.call td_bin_path, template.call('usr', 'bin', 'td.erb'), binding, mode: 0755 end end
37.969697
103
0.672785
61ac42415fd2a36aeb08c168da46c78fa22e3a79
2,644
# # Cookbook:: chef # Recipe:: default # # Copyright:: 2010, OpenStreetMap Foundation # # 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. # cache_dir = Chef::Config[:file_cache_path] chef_version = node[:chef][:client][:version] chef_package = "chef_#{chef_version}-1_amd64.deb" directory "/var/cache/chef" do action :delete recursive true end Dir.glob("#{cache_dir}/chef_*.deb").each do |deb| next if deb == "#{cache_dir}/#{chef_package}" file deb do action :delete backup false end end remote_file "#{cache_dir}/#{chef_package}" do source "https://packages.chef.io/files/stable/chef/#{chef_version}/ubuntu/#{node[:lsb][:release]}/#{chef_package}" owner "root" group "root" mode "644" backup false ignore_failure true end dpkg_package "chef" do source "#{cache_dir}/#{chef_package}" version "#{chef_version}-1" end directory "/etc/chef" do owner "root" group "root" mode "755" end template "/etc/chef/client.rb" do source "client.rb.erb" owner "root" group "root" mode "640" end file "/etc/chef/client.pem" do owner "root" group "root" mode "400" end template "/etc/chef/report.rb" do source "report.rb.erb" owner "root" group "root" mode "644" end template "/etc/logrotate.d/chef" do source "logrotate.erb" owner "root" group "root" mode "644" end directory "/etc/chef/trusted_certs" do owner "root" group "root" mode "755" end template "/etc/chef/trusted_certs/verisign.pem" do source "verisign.pem.erb" owner "root" group "root" mode "644" end directory node[:ohai][:plugin_dir] do owner "root" group "root" mode "755" end directory "/var/log/chef" do owner "root" group "root" mode "755" end systemd_service "chef-client" do description "Chef client" exec_start "/usr/bin/chef-client" end systemd_timer "chef-client" do description "Chef client" after "network.target" on_active_sec 60 on_unit_inactive_sec 25 * 60 randomized_delay_sec 10 * 60 end service "chef-client.timer" do action [:enable, :start] end service "chef-client.service" do action :disable subscribes :stop, "service[chef-client.timer]" end
20.030303
116
0.70764
7942ca270858b1c42a595b2a2e49c49c5040338b
857
require 'rails_helper' RSpec.describe SchoolClassesController, type: :routing do describe 'routing' do it 'routes to #index' do expect(get: '/school_classes').to route_to('school_classes#index') end it 'routes to #show' do expect(get: '/school_classes/1').to route_to('school_classes#show', id: '1') end it 'routes to #create' do expect(post: '/school_classes').to route_to('school_classes#create') end it 'routes to #update via PUT' do expect(put: '/school_classes/1').to route_to('school_classes#update', id: '1') end it 'routes to #update via PATCH' do expect(patch: '/school_classes/1').to route_to('school_classes#update', id: '1') end it 'routes to #destroy' do expect(delete: '/school_classes/1').to route_to('school_classes#destroy', id: '1') end end end
28.566667
88
0.66161
4a656af0db66a4bb1ec8b32b4b60cbb7fde58545
1,146
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'index requests' do describe 'GET /api/v1/timelines/:timeline_id/stories' do subject(:endpoint_call) do get "/api/v1/timelines/#{timeline.id}/stories?page=1", headers: { 'Authentication' => auth_token } end let(:user) { create(:user) } let(:auth_token) { JsonWebToken.encode(user_id: user.id) } let(:timeline) { user.created_timelines.create(title: 'Timeline') } let(:told_stories) do 5.times do |index| user.told_stories.create(date: Time.now.utc - index.days, timeline: timeline) end end let(:data_response) { JSON.parse(response.body)['data'] } before do told_stories subject end context '#index' do it do expect(response).to have_http_status(200) expect(data_response.count).to be(told_stories) expect(data_response.pluck('timeline_id').uniq).to eq([timeline.id]) end end context 'invalid token' do let(:auth_token) { '' } it do expect(response).to have_http_status(:unauthorized) end end end end
26.045455
85
0.643979
1dedee58e1257b23940d93feb4e0b22b1c5f83d9
1,141
require 'spec_helper' describe IEX::Resources::Resource do context 'float number to percent (Positive)' do subject do IEX::Resources::Resource.float_to_percentage(0.09123) end it 'converts to percentage' do expect(subject).to eq '+9.12%' end end context 'float number to percent (Negative)' do subject do IEX::Resources::Resource.float_to_percentage(-0.09123) end it 'converts to percentage' do expect(subject).to eq '-9.12%' end end context 'float number to percent (nil)' do subject do IEX::Resources::Resource.float_to_percentage(nil) end it 'nil argument does not convert' do expect(subject).to eq nil end end context 'float number to percent (0)' do subject do IEX::Resources::Resource.float_to_percentage(0) end it 'Zero converts to +0.00%' do expect(subject).to eq '+0.00%' end end context 'Unformatted money amount to dollar' do subject do IEX::Resources::Resource.to_dollar(amount: 123_391) end it 'converts to dollar' do expect(subject).to eq '$123,391' end end end
23.285714
60
0.658195
334b53c0657f9c3c63922211f5dcaa74894a4316
385
require 'spec_helper' describe "posting_portals/show" do before(:each) do @posting_portal = assign(:posting_portal, stub_model(PostingPortal, :description => "Description" )) end it "renders attributes in <p>" do render # Run the generator again with the --webrat flag if you want to use webrat matchers rendered.should match(/Description/) end end
24.0625
87
0.706494
91f885a255b309f0b5d39b5b1cd98ed135e1c686
180
class UserSerializer include FastJsonapi::ObjectSerializer attributes :id, :username, :email, :password_digest has_many :businesses, serializer: BusinessSerializer end
22.5
55
0.788889
f76fc8b1c3924cb965eaadf25cf0774cd0231877
581
cask 'memory-tracker-by-timely' do version '2019.17' sha256 'a33bbe09e545cc1ecd338dfb57adc1d6a69b05d3e68f7fa1e410bfa0bf48c3ed' # timelytimetracking.s3.amazonaws.com was verified as official when first introduced to the cask url 'https://timelytimetracking.s3.amazonaws.com/mac_tracker/Memory%20Tracker%20by%20Timely.zip' appcast 'https://timelytimetracking.s3.amazonaws.com/mac_tracker/sparkle.xml' name 'Memory Tracker by Timely' homepage 'https://timelyapp.com/' auto_updates true depends_on macos: '>= :high_sierra' app 'Memory Tracker by Timely.app' end
36.3125
98
0.790017
bfa1d2ebfd3454906e12fccce327105984606b36
207
# frozen_string_literal: true class RemoveUpdatesSinceFromHesaCollectionRequests < ActiveRecord::Migration[6.1] def change remove_column :hesa_collection_requests, :updates_since, :datetime end end
25.875
81
0.821256
ab4d18b4227fdda267c8a3a5c0db39189c3e8d02
10,767
# # Copyright:: Copyright (c) 2014-2018 Chef Software Inc. # License:: Apache License, Version 2.0 # # 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_relative "../spec_helper" require_relative "../../verify" module Gem # We stub Gem.ruby because `verify` uses it to locate the omnibus directory, # but we also use it in some of the "test commands" in these tests. class << self alias :real_ruby :ruby end end describe ChefWorkstation::Command::Verify do let(:command_instance) { ChefWorkstation::Command::Verify.new } let(:command_options) { [] } let(:components) { {} } let(:default_components) do [ "berkshelf", "test-kitchen", "tk-policyfile-provisioner", "chef-client", "chef-cli", "chef-apply", "chefspec", "generated-cookbooks-pass-chefspec", "fauxhai-ng", "kitchen-vagrant", "package installation", "openssl", "inspec", "git", "delivery-cli", "curl", ] end def run_command(expected_exit_code) expect(command_instance.run(command_options)).to eq(expected_exit_code) end it "defines berks, test kitchen, chef and chef-cli components by default" do expected_components = default_components expect(command_instance.components).not_to be_empty expect(command_instance.components.map(&:name)).to match_array(expected_components) end it "has a usage banner" do expect(command_instance.banner).to eq("Usage: chef verify [component, ...] [options]") end describe "when locating omnibus directory from the ruby path" do it "should find omnibus root directory from ruby path" do allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin/ruby")) expect(command_instance.omnibus_root).to end_with("eg_omnibus_dir/valid") end it "should raise OmnibusInstallNotFound if directory is not looking like omnibus" do allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, ".rbenv/versions/2.1.1/bin/ruby")) expect { command_instance.omnibus_bin_dir }.to raise_error(ChefCLI::OmnibusInstallNotFound) end it "raises OmnibusInstallNotFound if omnibus directory doesn't exist" do allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/invalid/embedded/bin/ruby")) expect { command_instance.omnibus_bin_dir }.to raise_error(ChefCLI::OmnibusInstallNotFound) end context "and a component's gem is not installed" do before do component_map = ChefWorkstation::Command::Verify.component_map.dup component_map["cucumber"] = ChefWorkstation::ComponentTest.new("cucumber") component_map["cucumber"].gem_base_dir = "cucumber" allow(ChefWorkstation::Command::Verify).to receive(:component_map).and_return(component_map) end it "raises MissingComponentError when a component doesn't exist" do allow(Gem).to receive(:ruby).and_return(File.join(fixtures_path, "eg_omnibus_dir/missing_component/embedded/bin/ruby")) expect { command_instance.validate_components! }.to raise_error(ChefWorkstation::MissingComponentError) end end end describe "when running verify command" do let(:stdout_io) { StringIO.new } let(:stderr_io) { StringIO.new } let(:ruby_path) { File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin/ruby") } def run_unit_test # Set rubyopt to empty to prevent bundler from infecting the ruby # subcommands (and loading a bunch of extra gems). lambda { |_self| sh("#{Gem.real_ruby} verify_me", env: { "RUBYOPT" => "" }) } end def run_integration_test lambda { |_self| sh("#{Gem.real_ruby} integration_test", env: { "RUBYOPT" => "" }) } end let(:all_tests_ok) do ChefWorkstation::ComponentTest.new("successful_comp").tap do |c| c.base_dir = "embedded/apps/berkshelf" c.unit_test(&run_unit_test) c.integration_test(&run_integration_test) c.smoke_test { sh("exit 0") } end end let(:all_tests_ok_2) do ChefWorkstation::ComponentTest.new("successful_comp_2").tap do |c| c.base_dir = "embedded/apps/test-kitchen" c.unit_test(&run_unit_test) c.smoke_test { sh("exit 0") } end end let(:failing_unit_test) do ChefWorkstation::ComponentTest.new("failing_comp").tap do |c| c.base_dir = "embedded/apps/chef" c.unit_test(&run_unit_test) c.smoke_test { sh("exit 0") } end end let(:passing_smoke_test_only) do component = failing_unit_test.dup component.smoke_test { sh("exit 0") } component end let(:failing_smoke_test_only) do component = all_tests_ok.dup component.smoke_test { sh("exit 1") } component end let(:component_without_integration_tests) do ChefWorkstation::ComponentTest.new("successful_comp").tap do |c| c.base_dir = "embedded/apps/berkshelf" c.unit_test { sh("./verify_me") } c.smoke_test { sh("exit 0") } end end def stdout stdout_io.string end before do allow(Gem).to receive(:ruby).and_return(ruby_path) allow(command_instance).to receive(:stdout).and_return(stdout_io) allow(command_instance).to receive(:stderr).and_return(stderr_io) allow(command_instance).to receive(:components).and_return(components) end context "when running smoke tests only" do describe "with single command with success" do let(:components) do [ passing_smoke_test_only ] end before do run_command(0) end it "should report the success of the command" do expect(stdout).to include("Verification of component 'failing_comp' succeeded.") end end describe "with single command with failure" do let(:components) do [ failing_smoke_test_only ] end before do run_command(1) end it "should report the failure of the command" do expect(stdout).to include("Verification of component 'successful_comp' failed.") end end end context "when running unit tests" do let(:command_options) { %w{--unit --verbose} } let(:components) do [ all_tests_ok ] end describe "with single command with success" do before do run_command(0) end it "should have embedded/bin on the PATH" do expect(stdout).to include(File.join(fixtures_path, "eg_omnibus_dir/valid/embedded/bin")) end it "should report the success of the command" do expect(stdout).to include("Verification of component 'successful_comp' succeeded.") end it "reports the component test output" do expect(stdout).to include("you are good to go...") end context "and --verbose is not enabled" do let(:command_options) { %w{--unit} } it "omits the component test output" do expect(stdout).to_not include("you are good to go...") end end context "and --integration flag is given" do let(:command_options) { %w{--integration --verbose} } it "should run the integration command also" do expect(stdout).to include("integration tests OK") end context "and no integration test command is specified for the component" do let(:components) do [ component_without_integration_tests ] end it "skips the integration test and succeeds" do expect(stdout).to include("Verification of component 'successful_comp' succeeded.") end end end end describe "with single command with failure" do let(:components) do [ failing_unit_test ] end before do run_command(1) end it "should report the failure of the command" do expect(stdout).to include("Verification of component 'failing_comp' failed.") end it "reports the component test output" do expect(stdout).to include("i'm not feeling good today...") end end describe "with multiple commands with success" do let(:components) do [ all_tests_ok, all_tests_ok_2 ] end before do run_command(0) end it "should report the success of the command" do expect(stdout).to include("Verification of component 'successful_comp' succeeded.") expect(stdout).to include("Verification of component 'successful_comp_2' succeeded.") end it "reports the component test outputs" do expect(stdout).to include("you are good to go...") expect(stdout).to include("my friend everything is good...") end context "and components are filtered by CLI args" do let(:command_options) { [ "successful_comp_2" ] } it "verifies only the desired component" do expect(stdout).to_not include("Verification of component 'successful_comp_1' succeeded.") expect(stdout).to include("Verification of component 'successful_comp_2' succeeded.") end end end describe "with multiple commands with failures" do let(:components) do [ all_tests_ok, all_tests_ok_2, failing_unit_test ] end before do run_command(1) end it "should report the success and failure of the commands" do expect(stdout).to include("Verification of component 'successful_comp' succeeded.") expect(stdout).to include("Verification of component 'successful_comp_2' succeeded.") expect(stdout).to include("Verification of component 'failing_comp' failed.") end it "reports the component test outputs" do expect(stdout).to include("you are good to go...") expect(stdout).to include("my friend everything is good...") expect(stdout).to include("i'm not feeling good today...") end end end end end
31.667647
127
0.652549
f8b05c834153d0df8bda7100e45c7356cb5fd507
1,799
class BagsController < ApplicationController before_action :set_bag, only: [:show, :edit, :update, :destroy] before_action :authenticate_user! load_and_authorize_resource # GET /bags # GET /bags.json def index @bags = Bag.all end # GET /bags/1 # GET /bags/1.json def show end # GET /bags/new def new @bag = Bag.new end # GET /bags/1/edit def edit end # POST /bags # POST /bags.json def create @bag = Bag.new(bag_params) respond_to do |format| if @bag.save format.html { redirect_to @bag, notice: 'Bag was successfully created.' } format.json { render :show, status: :created, location: @bag } else format.html { render :new } format.json { render json: @bag.errors, status: :unprocessable_entity } end end end # PATCH/PUT /bags/1 # PATCH/PUT /bags/1.json def update respond_to do |format| if @bag.update(bag_params) format.html { redirect_to @bag, notice: 'Bag was successfully updated.' } format.json { render :show, status: :ok, location: @bag } else format.html { render :edit } format.json { render json: @bag.errors, status: :unprocessable_entity } end end end # DELETE /bags/1 # DELETE /bags/1.json def destroy @bag.destroy respond_to do |format| format.html { redirect_to bags_url, notice: 'Bag was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_bag @bag = Bag.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def bag_params params.require(:bag).permit(:color) end end
23.363636
88
0.637576
d5aae7f596bde565e8ba3b777db42b6b789d0c15
107
require 'trello_cli/cli/card/create' require 'trello_cli/cli/card/list' require 'trello_cli/cli/card/move'
26.75
36
0.803738
e852898b6b8a62e3762a8d42854c2603b771d038
2,800
### # Page options, layouts, aliases and proxies ### page "/index.html", :layout => :landing pages_for_pagination = [] pages_for_pagination_index = 0 data.pages.each do |subject, subject_data| if !subject_data.children pages_for_pagination << "/#{subject_data.metadata.url}" else subject_data.children.each do |page, page_data| pages_for_pagination << "/#{subject_data.metadata.url}/#{page_data.metadata.url}" end end end data.pages.each do |subject, subject_data| if !subject_data.children proxy "/#{subject_data.metadata.url}/index.html", "/templates/page.html", locals: { subject_title: subject_data.metadata.page_title, page_title: nil, number: subject_data.metadata.number, page_id: subject_data.metadata.page_id, video_url: subject_data.video_url, description: subject_data.description, code_url: subject_data.code_url, links: subject_data.links, keywords: subject_data.keywords, previous_page: pages_for_pagination_index > 0 ? pages_for_pagination[pages_for_pagination_index-1] || nil : nil, next_page: pages_for_pagination[pages_for_pagination_index+1] || nil }, ignore: true pages_for_pagination_index += 1 else proxy "/#{subject_data.metadata.url}/index.html", "/templates/subject.html", locals: { subject_title: subject_data.metadata.page_title, subject_url: subject_data.metadata.url, pages: subject_data.children }, ignore: true subject_data.children.each do |page, page_data| proxy "/#{subject_data.metadata.url}/#{page_data.metadata.url}/index.html", "/templates/page.html", locals: { subject_title: subject_data.metadata.page_title, page_title: page_data.metadata.page_title, number: page_data.metadata.number, page_id: page_data.metadata.page_id, video_url: page_data.video_url, description: page_data.description, code_url: page_data.code_url, links: page_data.links, keywords: page_data.keywords, previous_page: pages_for_pagination_index > 0 ? pages_for_pagination[pages_for_pagination_index-1] || nil : nil, next_page: pages_for_pagination[pages_for_pagination_index+1] || nil }, ignore: true pages_for_pagination_index += 1 end end end ### # Helpers ### # Reload the browser automatically whenever files change activate :livereload do |livereload| livereload.host = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address end set :css_dir, 'stylesheets' set :js_dir, 'javascripts' set :images_dir, 'images' set :haml, { :attr_wrapper => "\"", :format => :html5 } # Build-specific configuration configure :build do activate :minify_html activate :minify_css activate :minify_javascript end
29.787234
120
0.717857
011551996115ab89a47d6557aa892c8b0b5183f6
2,819
#!/usr/bin/env ruby # Encoding: utf-8 # # Copyright:: Copyright 2011, Google Inc. All Rights Reserved. # # License:: 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. # # This example gets all line item creative associations (LICA). To create LICAs, # run create_licas.rb or associate_creative_set_to_line_item.rb. require 'dfp_api' API_VERSION = :v201605 def get_all_licas() # Get DfpApi instance and load configuration from ~/dfp_api.yml. dfp = DfpApi::Api.new # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in # the configuration file or provide your own logger: # dfp.logger = Logger.new('dfp_xml.log') # Get the LineItemCreativeAssociationService. lica_service = dfp.service(:LineItemCreativeAssociationService, API_VERSION) begin # Create statement for one page with current offset. statement = DfpApi::FilterStatement.new('ORDER BY lineItemId ASC') # Get LICAs by statement. page = lica_service.get_line_item_creative_associations_by_statement( statement.toStatement()) if page[:results] # Print details about each LICA in results page. page[:results].each_with_index do |lica, index| creative_text = (lica[:creative_set_id] != nil) ? 'creative set ID %d' % lica[:creative_set_id] : 'creative ID %d' % lica[:creative_id] puts '%d) LICA with line item ID: %d, %s and status: %s' % [index + statement.offset, lica[:line_item_id], creative_text, lica[:status]] end end statement.offset += DfpApi::SUGGESTED_PAGE_LIMIT end while statement.offset < page[:total_result_set_size] # Print a footer if page.include?(:total_result_set_size) puts 'Total number of LICAs: %d' % page[:total_result_set_size] end end if __FILE__ == $0 begin get_all_licas() # HTTP errors. rescue AdsCommon::Errors::HttpError => e puts 'HTTP Error: %s' % e # API errors. rescue DfpApi::Errors::ApiException => e puts 'Message: %s' % e.message puts 'Errors:' e.errors.each_with_index do |error, index| puts "\tError [%d]:" % (index + 1) error.each do |field, value| puts "\t\t%s: %s" % [field, value] end end end end
32.77907
80
0.672224
08edd1767863aa67ad0c2e95151b83e900a1abd8
2,152
require 'fileutils' # The purpose of this is to go over all document records and match them # with respective files. # Where files are present, create the expected directory structure, e.g. # /private/elibrary/documents/1/filename # Where files are missing, generate a report. # source_dir is the path to the directory with flat file structure # target dir is the path to the /private/elibrary class Elibrary::ManualDocumentFilesImporter def initialize(source_dir, target_dir) @source_dir = source_dir @target_dir = target_dir end def copy_with_path(src, dst) FileUtils.mkdir_p(File.dirname(dst)) FileUtils.cp(src, dst) end def run total = Document.count identification_docs.each_with_index do |doc, idx| info_txt = "#{doc.elib_legacy_file_name} (#{idx + 1} of #{total})" target_location = @target_dir + "/documents/#{doc.id}/#{doc.elib_legacy_file_name}" # check if file exists at target location if File.exists?(target_location) puts "TARGET PRESENT #{target_location}" + info_txt next end source_location = @source_dir + "/#{doc.elib_legacy_file_name}" # check if file exists at source location unless File.exists?(source_location) case doc.type when 'Document::IdManual' puts "SOURCE MISSING #{source_location}" + info_txt next when 'Document::VirtualCollege' unless doc.elib_legacy_file_name =~ /\.pdf/ puts "THIS IS A LINK TO EXTERNAL RESOURCES, NOT A PDF #{source_location}" + info_txt # else # remote_doc = Document.find(doc.id) # remote_doc.remote_filename_url = doc.elib_legacy_file_name # remote_doc.save! end puts "SOURCE MISSING #{source_location}" + info_txt next end end copy_with_path(source_location, target_location) puts "COPIED " + info_txt end end def identification_docs Document.where("type IN ('Document::IdManual', 'Document::VirtualCollege')") .order(:type, :date) .select([:id, :elib_legacy_file_name, :type]) end end
35.866667
96
0.667751
8719a2f73fd79a4d788bd1414166aef6c70a2350
9,187
require File.dirname(__FILE__) + '/../spec_helper' describe "A Call node" do relates "self.method" do compile do |g| g.push :self g.send :method, 0, false end end relates "1.m(2)" do compile do |g| g.push 1 g.push 2 g.send :m, 1, false end end relates "h(1, 2, *a)" do compile do |g| g.push :self g.push 1 g.push 2 g.push :self g.send :a, 0, true g.cast_array g.push :nil g.send_with_splat :h, 2, true, false end end relates <<-ruby do begin (1 + 1) end ruby compile do |g| g.push 1 g.push 1 g.send :+, 1, false end end relates "blah(*a)" do compile do |g| g.push :self g.push :self g.send :a, 0, true g.cast_array g.push :nil g.send_with_splat :blah, 0, true, false end end relates "a.b(&c)" do compile do |g| t = g.new_label g.push :self g.send :a, 0, true g.push :self g.send :c, 0, true g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :b, 0, false end end relates "a.b(4, &c)" do compile do |g| t = g.new_label g.push :self g.send :a, 0, true g.push 4 g.push :self g.send :c, 0, true g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :b, 1, false end end relates "a.b(1, 2, 3, &c)" do compile do |g| t = g.new_label g.push :self g.send :a, 0, true g.push 1 g.push 2 g.push 3 g.push :self g.send :c, 0, true g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :b, 3, false end end relates "a(&b)" do compile do |g| t = g.new_label g.push :self g.push :self g.send :b, 0, true g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :a, 0, true end end relates "a(4, &b)" do compile do |g| t = g.new_label g.push :self g.push 4 g.push :self g.send :b, 0, true g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :a, 1, true end end relates "a(1, 2, 3, &b)" do compile do |g| t = g.new_label g.push :self g.push 1 g.push 2 g.push 3 g.push :self g.send :b, 0, true g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :a, 3, true end end relates "define_attr_method(:x, :sequence_name, &Proc.new { |*args| nil })" do compile do |g| t = g.new_label g.push :self g.push_literal :x g.push_literal :sequence_name g.push_const :Proc in_block_send :new, :splat, nil, 0, false do |d| d.push :nil end g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :define_attr_method, 2, true end end relates "r.read_body(dest, &block)" do compile do |g| t = g.new_label g.push :self g.send :r, 0, true g.push :self g.send :dest, 0, true g.push :self g.send :block, 0, true g.dup g.is_nil g.git t g.push_cpath_top g.find_const :Proc g.swap g.send :__from_block__, 1 t.set! g.send_with_block :read_body, 1, false end end relates "o.m(:a => 1, :b => 2)" do compile do |g| g.push :self g.send :o, 0, true g.push_cpath_top g.find_const :Hash g.push 2 g.send :new_from_literal, 1 g.dup g.push_literal :a g.push 1 g.send :[]=, 2 g.pop g.dup g.push_literal :b g.push 2 g.send :[]=, 2 g.pop g.send :m, 1, false end end relates "o.m(42, :a => 1, :b => 2)" do compile do |g| g.push :self g.send :o, 0, true g.push 42 g.push_cpath_top g.find_const :Hash g.push 2 g.send :new_from_literal, 1 g.dup g.push_literal :a g.push 1 g.send :[]=, 2 g.pop g.dup g.push_literal :b g.push 2 g.send :[]=, 2 g.pop g.send :m, 2, false end end relates "o.m(42, :a => 1, :b => 2, *c)" do compile do |g| g.push :self g.send :o, 0, true g.push 42 g.push_cpath_top g.find_const :Hash g.push 2 g.send :new_from_literal, 1 g.dup g.push_literal :a g.push 1 g.send :[]=, 2 g.pop g.dup g.push_literal :b g.push 2 g.send :[]=, 2 g.pop g.push :self g.send :c, 0, true g.cast_array g.push :nil g.send_with_splat :m, 2, false, false end end relates "a (1,2,3)" do compile do |g| g.push :self g.push 1 g.push 2 g.push 3 g.send :a, 3, true end end relates "o.puts(42)" do compile do |g| g.push :self g.send :o, 0, true g.push 42 g.send :puts, 1, false end end relates "1.b(c)" do compile do |g| g.push 1 g.push :self g.send :c, 0, true g.send :b, 1, false end end relates "(v = (1 + 1)).zero?" do compile do |g| g.push 1 g.push 1 g.send :+, 1, false g.set_local 0 g.send :zero?, 0, false end end relates "-2**31" do compile do |g| g.push 2 g.push 31 g.send :**, 1, false g.send :-@, 0, false end end relates "a[]" do compile do |g| g.push :self g.send :a, 0, true g.send :[], 0, false end end relates "m(:a => 1, :b => 2)" do compile do |g| g.push :self g.push_cpath_top g.find_const :Hash g.push 2 g.send :new_from_literal, 1 g.dup g.push_literal :a g.push 1 g.send :[]=, 2 g.pop g.dup g.push_literal :b g.push 2 g.send :[]=, 2 g.pop g.send :m, 1, true end end relates "m(42, :a => 1, :b => 2)" do compile do |g| g.push :self g.push 42 g.push_cpath_top g.find_const :Hash g.push 2 g.send :new_from_literal, 1 g.dup g.push_literal :a g.push 1 g.send :[]=, 2 g.pop g.dup g.push_literal :b g.push 2 g.send :[]=, 2 g.pop g.send :m, 2, true end end relates "m(42, :a => 1, :b => 2, *c)" do compile do |g| g.push :self g.push 42 g.push_cpath_top g.find_const :Hash g.push 2 g.send :new_from_literal, 1 g.dup g.push_literal :a g.push 1 g.send :[]=, 2 g.pop g.dup g.push_literal :b g.push 2 g.send :[]=, 2 g.pop g.push :self g.send :c, 0, true g.cast_array g.push :nil g.send_with_splat :m, 2, true, false end end relates "m(42)" do compile do |g| g.push :self g.push 42 g.send :m, 1, true end end relates "a(:b) { :c }" do compile do |g| g.push :self g.push_literal :b g.in_block_send :a, :none, nil, 1 do |d| d.push_literal :c end end end relates "a [42]" do compile do |g| g.push :self g.push 42 g.make_array 1 g.send :a, 1, true end end relates "42 if block_given?" do compile do |g| t = g.new_label f = g.new_label g.push :self g.send :block_given?, 0, true g.gif f g.push 42 g.goto t f.set! g.push :nil t.set! end end relates "method" do compile do |g| g.push :self g.send :method, 0, true end end relates <<-ruby do a << begin b rescue c end ruby compile do |g| g.push :self g.send :a, 0, true for_rescue do |rb| rb.body do g.push :self g.send :b, 0, true end rb.condition :StandardError do g.push :self g.send :c, 0, true end end g.send :<<, 1, false end end relates "meth([*[1]])" do compile do |g| g.push :self g.push 1 g.make_array 1 g.send :meth, 1, true end end relates "meth(*[1])" do compile do |g| g.push :self g.push 1 g.make_array 1 g.cast_array g.push :nil g.send_with_splat :meth, 0, true, false end end end
15.92201
80
0.487319
39b2d81c14e5d5867756242d05243269ee1cbb22
651
require 'rexml/document' describe "REXML::Attributes#prefixes" do before :each do @e = REXML::Element.new("root") a1 = REXML::Attribute.new("xmlns:a", "bar") a2 = REXML::Attribute.new("xmlns:b", "bla") a3 = REXML::Attribute.new("xmlns:c", "baz") @e.attributes << a1 @e.attributes << a2 @e.attributes << a3 @e.attributes << REXML::Attribute.new("xmlns", "foo") end it "returns an array with the prefixes of each attribute" do @e.attributes.prefixes.sort.should == ["a", "b", "c"] end it "does not include the default namespace" do @e.attributes.prefixes.include?("xmlns").should == false end end
27.125
62
0.637481
e241dd69e908f13b7c995b4702be3424cc747964
15,190
# frozen_string_literal: true # Assuming you have not yet modified this file, each configuration option below # is set to its default value. Note that some are commented out while others # are not: uncommented lines are intended to protect your configuration from # breaking changes in upgrades (i.e., in the event that future versions of # Devise change the default values for those options). # # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmation, reset password and unlock tokens in the database. # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. # config.secret_key = 'e78bf240571492e94c23b91355bf8521e7e2fb0528c78b2726d717070c05b7fa1194ec00a92b1f169ca3763c5bd6d538ea353a0d6827ecda67299c150aeb90ff' # ==> Controller configuration # Configure the parent class to the devise controllers. # config.parent_controller = 'DeviseController' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. config.mailer_sender = '[email protected]' # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' # Configure the parent class responsible to send e-mails. # config.parent_mailer = 'ActionMailer::Base' # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. require 'devise/orm/active_record' # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. # config.authentication_keys = [:email] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the # find_for_authentication method and considered in your model lookup. For instance, # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. # The same considerations mentioned for authentication_keys also apply to request_keys. # config.request_keys = [] # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. config.case_insensitive_keys = [:email] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. config.strip_whitespace_keys = [:email] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the # given strategies, for example, `config.params_authenticatable = [:database]` will # enable it only for database (email + password) authentication. # config.params_authenticatable = true # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:database]` will # enable it only for database authentication. # For API-only applications to support authentication "out-of-the-box", you will likely want to # enable this with :database unless you are using a custom strategy. # The supported strategies are: # :database = Support basic authentication with authentication key + password # config.http_authenticatable = false # If 401 status code should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true # The realm used in Http Basic Authentication. 'Application' by default. # config.http_authentication_realm = 'Application' # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. # Does not affect registerable. # config.paranoid = true # By default Devise will store the user in session. You can skip storage for # particular strategies by setting this option. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing skip: :sessions to `devise_for` in your config/routes.rb config.skip_session_storage = [:http_auth] # By default, Devise cleans up the CSRF token on authentication to # avoid CSRF token fixation attacks. This means that, when using AJAX # requests for sign in and sign up, you need to get a new CSRF token # from the server. You can disable this option at your own risk. # config.clean_up_csrf_token_on_authentication = true # When false, Devise will not attempt to reload routes on eager load. # This can reduce the time taken to boot the app but if your application # requires the Devise mappings to be loaded during boot time the application # won't boot properly. # config.reload_routes = true # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 12. If # using other algorithms, it sets how many times you want the password to be hashed. # The number of stretches used for generating the hashed password are stored # with the hashed password. This allows you to change the stretches without # invalidating existing passwords. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. Note that, for bcrypt (the default # algorithm), the cost increases exponentially with the number of stretches (e.g. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). config.stretches = Rails.env.test? ? 1 : 12 # Set up a pepper to generate the hashed password. # config.pepper = 'f3af54f17e9dbf86e93daaa1011d53d6ac1198a217b41605bdf52006c9ac3015af3ecab03b7863744584d3af03818a2f8287c6325de88bf8c9f73eddeff68045' # Send a notification to the original email when the user's email is changed. # config.send_email_changed_notification = false # Send a notification email when the user's password is changed. # config.send_password_change_notification = false # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without # confirming their account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming their account, # access will be blocked just in the third day. # You can also set it to nil, which will allow the user to access the website # without confirming their account. # Default is 0.days, meaning the user cannot access the website without # confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their # token becomes invalid. For example, if set to 3.days, the user can confirm # their account within 3 days after the mail was sent, but on the fourth day # their account can't be confirmed with the token any more. # Default is nil, meaning there is no restriction on how long a user can take # before confirming their account. # config.confirm_within = 3.days # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed, new email is stored in # unconfirmed_email column, and copied to email column on successful confirmation. config.reconfirmable = true # Defines which key will be used when confirming an account # config.confirmation_keys = [:email] # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks # Invalidates all the remember me tokens when the user signs out. config.expire_all_remember_me_on_sign_out = true # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set # secure: true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable # Range for password length. config.password_length = 6..128 # Email regex used to validate email formats. It simply asserts that # one (and only one) @ exists in the given string. This is mainly # to give user feedback and not to assert the e-mail validity. config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. # :none = No lock strategy. You should handle locking by yourself. # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account # config.unlock_keys = [:email] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Re-enables login after a certain amount of time (see :unlock_in below) # :both = Enables both strategies # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both # Number of authentication tries before locking an account if lock_strategy # is failed attempts. # config.maximum_attempts = 20 # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour # Warn on the last attempt before the account is locked. # config.last_attempt_warning = true # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account # config.reset_password_keys = [:email] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 6.hours # When set to false, does not sign a user in automatically after their password is # reset. Defaults to true, so a user is signed in automatically after a reset. # config.sign_in_after_reset_password = true # ==> Configuration for :encryptable # Allow you to use another hashing or encryption algorithm besides bcrypt (default). # You can use :sha1, :sha512 or algorithms from others authentication tools as # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 # for default behavior) and :restful_authentication_sha1 (then you should set # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). # # Require the `devise-encryptable` gem when using anything other than bcrypt # config.encryptor = :sha512 # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. # config.scoped_views = false # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). # config.default_scope = :user # Set this configuration to false if you want /users/sign_out to sign out # only the current scope. By default, Devise signs out all scopes. # config.sign_out_all_scopes = true # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like # :html, should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. # config.navigational_formats = ['*/*', :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(scope: :user).unshift :some_external_strategy # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # # When using OmniAuth, Devise cannot automatically set OmniAuth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' # ==> Turbolinks configuration # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: # # ActiveSupport.on_load(:devise_failure_app) do # include Turbolinks::Controller # end # ==> Configuration for :registerable # When set to false, does not sign a user in automatically after their password is # changed. Defaults to true, so a user is signed in automatically after changing a password. # config.sign_in_after_change_password = true end
48.685897
154
0.752535
e8c559856620aec7c461c4e87bac7b1bc6d6bb0d
1,536
# 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. # [START app]naive_bayes require "sinatra" require "csv" require "pry" require "stuff-classifier" require "rubygems" #require "naive_bayes" require_relative 'NaiveBayes' def initialize #@cls = StuffClassifier::Bayes.new("<=50K or >50K") @a = NaiveBayes.new("<=50K", ">50K") CSV.foreach('data.csv') do |row| #@cls.train("#{row[14]}", "#{row[0]} #{row[1]} #{row[3]} #{row[5]} #{row[6]} #{row[8]} #{row[9]} #{row[13]}") @a.train("#{row[14]}".strip, "#{row[0]}".downcase.strip ,"#{row[1]}".downcase.strip,"#{row[3]}".downcase.strip,"#{row[5]}".downcase.strip,"#{row[6]}".downcase.strip,"#{row[8]}".downcase.strip,"#{row[9]}".downcase.strip,"#{row[13]}".downcase.strip) #@a.train("#{row[14]}".strip, "#{row[3]}" ,"#{row[13]}") end #binding.pry end get "/" do #binding.pry #@data = params[:data] #binding.pry erb :index end post "/" do #binding.pry @b= params[:data].downcase.split(' ') erb :index end # [END app]
30.72
253
0.65625
ac6a38fd079681f711e10900724cfa861bad733e
3,659
class User < ApplicationRecord has_many :microposts, dependent: :destroy has_many :active_relationships, class_name: "Relationship", foreign_key: "follower_id", dependent: :destroy has_many :passive_relationships, class_name: "Relationship", foreign_key: "followed_id", dependent: :destroy has_many :following, through: :active_relationships, source: :followed has_many :followers, through: :passive_relationships, source: :follower attr_accessor :remember_token, :activation_token, :reset_token before_save :downcase_email before_create :create_activation_digest validates :name, presence: true, length: { maximum: 50 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, length: { maximum: 255 }, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } has_secure_password validates :password, presence: true, length: { minimum: 6 }, allow_nil: true # Returns the hash digest of the given string. def User.digest(string) cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost BCrypt::Password.create(string, cost: cost) end # Returns a random token. def User.new_token SecureRandom.urlsafe_base64 end # Remembers a user in the database for use in persistent sessions. def remember self.remember_token = User.new_token update_attribute(:remember_digest, User.digest(remember_token)) end # Returns true if the given token matches the digest. def authenticated?(attribute, token) digest = send("#{attribute}_digest") return false if digest.nil? BCrypt::Password.new(digest).is_password?(token) end # Forgets a user. def forget update_attribute(:remember_digest, nil) end # Activates an account. def activate update_attribute(:activated, true) update_attribute(:activated_at, Time.zone.now) end # Sends activation email. def send_activation_email UserMailer.account_activation(self).deliver_now end # Sets the password reset attributes. def create_reset_digest self.reset_token = User.new_token update_attribute(:reset_digest, User.digest(reset_token)) update_attribute(:reset_sent_at, Time.zone.now) end # Sends password reset email. def send_password_reset_email UserMailer.password_reset(self).deliver_now end # Returns true if a password reset has expired. def password_reset_expired? reset_sent_at < 2.hours.ago end # Defines a proto-feed. # Returns a user's status feed. def feed following_ids = "SELECT followed_id FROM relationships WHERE follower_id = :user_id" Micropost.where("user_id IN (#{following_ids}) OR user_id = :user_id", user_id: id) end # Follows a user. def follow(other_user) following << other_user end # Unfollows a user. def unfollow(other_user) following.delete(other_user) end # Returns true if the current user is following the other user. def following?(other_user) following.include?(other_user) end private # Converts email to all lower-case. def downcase_email self.email = email.downcase end # Creates and assigns the activation token and digest. def create_activation_digest self.activation_token = User.new_token self.activation_digest = User.digest(activation_token) end end
31.273504
78
0.678874
7913b3247c3c49c0d6979d5d377dd16910c6acb7
5,152
# This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your database schema. If you need # to create the application database on another system, you should be using db:schema:load, not running # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. ActiveRecord::Schema.define(:version => 20080818121628) do create_table "access_logs", :force => true do |t| t.integer "client_id" t.string "request_body", :limit => 2048 t.string "request_headers", :limit => 2048 t.string "request_method" t.string "request_path", :limit => 2048 t.string "response_body", :limit => 10000 t.string "response_headers", :limit => 2048 t.string "response_status" t.datetime "created_at" t.datetime "updated_at" end add_index "access_logs", ["client_id"], :name => "index_access_logs_on_client_id" create_table "clients", :force => true do |t| t.string "name", :null => false t.boolean "preallowed", :default => false, :null => false t.datetime "created_at" t.datetime "updated_at" end add_index "clients", ["name"], :name => "index_clients_on_name" add_index "clients", ["preallowed"], :name => "index_clients_on_preallowed" create_table "profiles", :force => true do |t| t.integer "client_id", :null => false t.integer "subject_id", :null => false t.datetime "created_at" t.datetime "updated_at" end add_index "profiles", ["client_id", "subject_id"], :name => "index_profiles_on_client_id_and_subject_id", :unique => true add_index "profiles", ["client_id"], :name => "index_profiles_on_client_id" add_index "profiles", ["subject_id"], :name => "index_profiles_on_subject_id" create_table "resources", :force => true do |t| t.string "name", :null => false t.integer "client_id", :null => false t.datetime "created_at" t.datetime "updated_at" end add_index "resources", ["client_id", "name"], :name => "index_resources_on_client_id_and_name", :unique => true add_index "resources", ["name"], :name => "index_resources_on_name" add_index "resources", ["client_id"], :name => "index_resources_on_client_id" create_table "resources_associations", :force => true do |t| t.integer "resource_id", :null => false t.integer "role_id", :null => false t.datetime "created_at" t.datetime "updated_at" end add_index "resources_associations", ["role_id", "resource_id"], :name => "index_resources_associations_on_role_id_and_resource_id", :unique => true add_index "resources_associations", ["resource_id"], :name => "index_resources_associations_on_resource_id" add_index "resources_associations", ["role_id"], :name => "index_resources_associations_on_role_id" create_table "roles", :force => true do |t| t.string "name", :null => false t.integer "client_id", :null => false t.datetime "created_at" t.datetime "updated_at" end add_index "roles", ["client_id", "name"], :name => "index_roles_on_client_id_and_name", :unique => true add_index "roles", ["name"], :name => "index_roles_on_name" add_index "roles", ["client_id"], :name => "index_roles_on_client_id" create_table "sessions", :force => true do |t| t.string "session_id", :null => false t.text "data" t.datetime "created_at" t.datetime "updated_at" end add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" create_table "subjects", :force => true do |t| t.string "name", :null => false t.string "email" t.string "hashed_password" t.string "salt" t.integer "client_id", :null => false t.datetime "created_at" t.datetime "updated_at" end add_index "subjects", ["client_id", "name"], :name => "index_subjects_on_client_id_and_name", :unique => true add_index "subjects", ["client_id"], :name => "index_subjects_on_client_id" add_index "subjects", ["client_id", "email"], :name => "index_subjects_on_client_id_and_email" create_table "subjects_associations", :force => true do |t| t.integer "subject_id", :null => false t.integer "role_id", :null => false t.datetime "created_at" t.datetime "updated_at" end add_index "subjects_associations", ["role_id", "subject_id"], :name => "index_subjects_associations_on_role_id_and_subject_id", :unique => true add_index "subjects_associations", ["subject_id"], :name => "index_subjects_associations_on_subject_id" add_index "subjects_associations", ["role_id"], :name => "index_subjects_associations_on_role_id" end
43.294118
149
0.692158
11306aee37b793ed12914172c9fa5ff8866e249c
4,437
#-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2021 the OpenProject GmbH # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 3. # # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: # Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2010-2013 the ChiliProject Team # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # See docs/COPYRIGHT.rdoc for more details. #++ require 'spec_helper' describe 'user self registration', type: :feature, js: true do let(:admin) { FactoryBot.create :admin, password: 'Test123Test123', password_confirmation: 'Test123Test123' } let(:home_page) { Pages::Home.new } context 'with "manual account activation"', with_settings: { self_registration: Setting::SelfRegistration.manual.to_s } do it 'allows self registration on login page (Regression #28076)' do visit signin_path click_link 'Create a new account' # deliberately inserting a wrong password confirmation within '.registration-modal' do fill_in 'Username', with: 'heidi' fill_in 'First name', with: 'Heidi' fill_in 'Last name', with: 'Switzerland' fill_in 'Email', with: '[email protected]' fill_in 'Password', with: 'test123=321test' fill_in 'Confirmation', with: 'test123=321test' click_button 'Create' end expect(page) .to have_content('Your account was created and is now pending administrator approval.') end it 'allows self registration and activation by an admin' do home_page.visit! # registration as an anonymous user within '.top-menu-items-right .menu_root' do click_link 'Sign in' # Wait until click handler has been initialized sleep(0.1) click_link 'Create a new account' end # deliberately inserting a wrong password confirmation within '.registration-modal' do fill_in 'Username', with: 'heidi' fill_in 'First name', with: 'Heidi' fill_in 'Last name', with: 'Switzerland' fill_in 'Email', with: '[email protected]' fill_in 'Password', with: 'test123=321test' fill_in 'Confirmation', with: 'something different' click_button 'Create' end expect(page) .to have_content('Confirmation doesn\'t match Password') # correcting password within '.registration-modal' do # Cannot use 'Password' here as the error message on 'Confirmation' is part of the label # and contains the string 'Password' as well fill_in 'user_password', with: 'test123=321test' fill_in 'Confirmation', with: 'test123=321test' click_button 'Create' end expect(page) .to have_content('Your account was created and is now pending administrator approval.') registered_user = User.find_by(status: Principal::STATUSES[:registered]) # Trying unsuccessfully to login login_with 'heidi', 'test123=321test' expect(page) .to have_content I18n.t(:'account.error_inactive_manual_activation') # activation as admin login_with admin.login, admin.password user_page = Pages::Admin::Users::Edit.new(registered_user.id) user_page.visit! user_page.activate! expect(page) .to have_content('Successful update.') logout # Test logging in as newly created and activated user login_with 'heidi', 'test123=321test' within '.top-menu-items-right .menu_root' do expect(page) .to have_selector("a[title='#{registered_user.name}']") end end end end
33.870229
111
0.687176
91aceb918cde8ba6ad2e7a308906bde24d27f058
573
# frozen_string_literal: true FactoryBot.define do factory :profile do account { FactoryBot.create(:account) } first_name { Faker::Superhero.name } last_name { Faker::Superhero.name } dob { Faker::Date.birthday } address { Faker::Address.street_address } city { Faker::RickAndMorty.location } country { Faker::Simpsons.location } state { 'validated' } transient do documents_count 1 end after(:create) do |profile, evaluator| create_list(:document, evaluator.documents_count, profile: profile) end end end
24.913043
73
0.685864
61bac8ac90155bc394b844aa27a3c16f841079ea
1,029
module PathHelpers def path_to(page_name) case page_name when 'an invoice page' %r{^/invoices/[^/+]+$} when "the invoice's project's page" project_path @invoice.project when "the project's client's page" client_path @project.client when 'the user profile edit page' edit_user_registration_path when 'the user registration page' new_user_registration_path when /^the (.+)'s page$/ model_path $1 when /^the (.+)'s edit page$/ model_path $1, :edit else begin path_helper = page_name.gsub(/\bpage$/, 'path').gsub(/^the /, '').gsub(' ', '_') self.send path_helper rescue NoMethodError raise ArgumentError, "Path to '#{page_name}' is not defined. Please add a mapping in #{__FILE__}." end end end private def model_path(model, action = nil) model.gsub! ' ', '_' path = [action, model, 'path'].compact.join '_' self.send path, instance_variable_get("@#{model}") end end World PathHelpers
27.810811
106
0.627794
033c3e17908576a1b28fee8c548cfc4c9e2490d6
114
module API class ActivityController < APIController def show perform Activity::Show end end end
14.25
42
0.701754
088834609f322d0fe3a3350a2c593cf2c55ed6c9
221
require "./config/application" app = MyApp::Application.new use Rack::ContentType app.route do match "greetings/show", default: {"controller" => "greetings", "action" => "show"} root "greetings#index" end run app
17
84
0.701357
ac70c953dbb1c35aeedca3213d44d7b858cbdfbb
272
class SetAsdaMobileToParticipating < ActiveRecord::Migration[6.1] def up MobileNetwork.find_by_brand('Asda Mobile').update(participation_in_pilot: 'yes') end def down MobileNetwork.find_by_brand('Asda Mobile').update(participation_in_pilot: 'no') end end
27.2
84
0.772059
91c0e48c14259ccc42963736ed9db98b62af39c6
376
require 'bundler/setup' require 'slanger/health_check' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status' # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end end
25.066667
66
0.757979
7a2bc0c0611b7f84ba7ac72a81ad63c826bccc4c
546
# frozen_string_literal: true class Teachers::SessionsController < Devise::SessionsController # before_action :configure_sign_in_params, only: [:create] # GET /resource/sign_in # def new # super # end # POST /resource/sign_in # def create # super # end # DELETE /resource/sign_out # def destroy # super # end # protected # If you have extra params to permit, append them to the sanitizer. # def configure_sign_in_params # devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute]) # end end
19.5
69
0.697802
87e759b0570fd332fae0678dd7782db65ec86d07
3,607
def member_response File.read(File.dirname(__FILE__) + '/member.json') end def members_response File.read(File.dirname(__FILE__) + '/members.json') end def roll_call_votes_response File.read(File.dirname(__FILE__) + '/roll_call_votes.json') end def member_vote_comparison_response File.read(File.dirname(__FILE__) + '/member_vote_comparison.json') end def limited_legislator_attributes <<-JSON { "id": "L000304", "name": "Joseph I. Lieberman", "first_name": "Joseph I.", "middle_name": "I.", "last_name": "Lieberman", "party": "ID", "state": "CT", "missed_votes_pct": "0.00", "votes_with_party_pct": "93.44" } JSON end def full_legislator_attributes <<-JSON { "status":"OK", "copyright":"Copyright (c) 2009 The New York Times Company. All Rights Reserved.", "results":[ { "member_id": "L000304", "name": "Joseph I. Lieberman", "first_name": "Joseph I.", "middle_name": "I.", "last_name": "Lieberman", "date_of_birth": "1942-02-24", "gender": "M", "url": "http://lieberman.senate.gov/", "govtrack_id": "300067", "roles": [ { "congress": "111", "chamber": "Senate", "title": "Senator, 1st Class", "state": "CT", "party": "ID", "district": "N/A", "start_date": "2009-01-06", "end_date": "2011-01-04", "missed_votes_pct": "0.00", "votes_with_party_pct": "93.44" }, { "congress": "110", "chamber": "Senate", "title": "Senator, 1st Class", "state": "CT", "party": "ID", "district": "N/A", "start_date": "2007-01-04", "end_date": "2009-01-03", "missed_votes_pct": "3.20", "votes_with_party_pct": "86.79" } ] } ] } JSON end def role_response_fragment <<-JSON { "congress":"111", "chamber":"Senate", "title":"Senator, 2nd Class", "state":"DE", "party":"D", "district":"N/A", "start_date":"2009-01-06", "end_date":"2009-01-20" } JSON end def member_positions_response <<-JSON { "status":"OK", "copyright":"Copyright (c) 2009 The New York Times Company. All Rights Reserved.", "results":[ { "member_id":"N000147", "total_votes":"100", "offset":"0", "votes":[ { "member_id":"N000147", "chamber":"House", "congress":"111", "session":"1", "roll_call":"23", "date":"2009-01-21", "time":"15:37:00", "position":"Yes" }, { "member_id":"N000147", "chamber":"House", "congress":"111", "session":"1", "roll_call":"19", "date":"2009-01-15", "time":"13:37:00", "position":"Yes" }, { "member_id":"N000147", "chamber":"House", "congress":"110", "session":"1", "roll_call":"1031", "date":"2007-11-01", "time":"14:21:00", "position":"No" } ] } ] } JSON end
25.58156
88
0.441918
bb08fa2a30cd4a3689943370c78a0f14eac134a8
860
require 'spec_helper' describe 'newrelic_lwrp_test::agent_dotnet' do before do stub_resources end context 'Windows' do let(:chef_run) do ChefSpec::SoloRunner.new(:log_level => LOG_LEVEL, :platform => 'windows', :version => '2012', :step_into => ['newrelic_agent_dotnet']) do |node| stub_node_resources(node) end.converge(described_recipe) end it 'Installs New Relic .Net agent' do expect(chef_run).to install_newrelic_agent_dotnet('Install') end it 'Install New Relic .NET Agent (windows_package)' do expect(chef_run).to install_windows_package('Install New Relic .NET Agent') end it 'Create newrelic.config file' do expect(chef_run).to render_file('C:\ProgramData\New Relic\.NET Agent\newrelic.config').with_content('0000ffff0000ffff0000ffff0000ffff0000ffff') end end end
30.714286
150
0.713953