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
01594036864363b889f44dc750a226b043da2c5f
158
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html resources :todos end
31.6
101
0.78481
bf8faa853d43e9ff8d116c8fcc9e8e6c71660fa2
1,226
class Ykclient < Formula desc "Library to validate YubiKey OTPs against YubiCloud" homepage "https://developers.yubico.com/yubico-c-client/" url "https://developers.yubico.com/yubico-c-client/Releases/ykclient-2.15.tar.gz" sha256 "f461cdefe7955d58bbd09d0eb7a15b36cb3576b88adbd68008f40ea978ea5016" bottle do rebuild 2 # sha256 "73b153bb1d9f5df3aa3a4ffed206c60bd1f207946b9cb43116985ed0cf76de8e" => :mojave sha256 "3e1459f192f7f1df756e2071c78ee41fd163b3dee1f09254e8e5ffc0442a2205" => :high_sierra sha256 "aec1bc9640c8a84089b1d749d689b59862fce858478d180cd6a34a93a34eb370" => :sierra sha256 "deee73fbd68f44bd86fb07d1f2179313dac4679395d861b821ccf218745ab1c8" => :el_capitan end head do url "https://github.com/Yubico/yubico-c-client.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end depends_on "help2man" => :build depends_on "pkg-config" => :build def install system "autoreconf", "-iv" if build.head? system "./configure", "--prefix=#{prefix}" system "make", "install" system "make", "check" end test do assert_equal version.to_s, shell_output("#{bin}/ykclient --version").chomp end end
33.135135
93
0.744698
e2d131b1572bdfaa5e4bf8cceffa156a8cd334d7
593
# This file is autogenerated. Instead of editing this file, please use the # migrations feature of ActiveRecord to incrementally modify your database, and # then regenerate this schema definition. ActiveRecord::Schema.define(:version => 2) do create_table "categorias", :force => true do |t| t.column "nombre", :string end create_table "contactos", :force => true do |t| t.column "nombre", :string t.column "apellidos", :string t.column "telefono", :string t.column "email", :string t.column "direccion", :text t.column "categoria_id", :integer end end
28.238095
79
0.699831
bfccc4105aedb12470fe4ca8bd008d516c2873a6
149
require "mediaarts_scraper" require "json" require_relative "common" open(CORRECT_ANSWER_PATH, "w") do |f| f.puts JSON.pretty_generate(check) end
18.625
37
0.778523
e9cb137d42f5713756986d7193f2662a2ad3381a
4,205
require "pathname" require "tempfile" require "rtesseract/errors" require "rtesseract/mixed" class RTesseract VERSION = '0.0.9' attr_accessor :options attr_writer :lang attr_writer :psm attr_reader :processor def initialize(src = "", options = {}) @uid = options.delete(:uid) || nil @source = Pathname.new src @command = options.delete(:command) || "tesseract" @lang = options.delete(:lang) || options.delete("lang") || "" @psm = options.delete(:psm) || options.delete("psm") || nil @clear_console_output = options.delete(:clear_console_output) @clear_console_output = true if @clear_console_output.nil? @options = options @value = "" @x, @y, @w, @h = [] @processor = options.delete(:processor) || options.delete("processor") choose_processor! end def source= src @value = "" @source = Pathname.new src end def image_name @source.basename end #Crop image to convert def crop!(x,y,width,height) @x, @y, @w, @h = x, y, width, height self end #Remove files def remove_file(files=[]) files.each do |file| begin File.unlink(file) if File.exist?(file) rescue system "rm -f #{file}" end end true rescue raise RTesseract::TempFilesNotRemovedError end def generate_uid @uid = rand.to_s[2,10] if @uid.nil? @uid end # Select the language #===Languages ## * eng - English ## * deu - German ## * deu-f - German fraktur ## * fra - French ## * ita - Italian ## * nld - Dutch ## * por - Portuguese ## * spa - Spanish ## * vie - Vietnamese ## Note: Make sure you have installed the language to tesseract def lang language = "#{@lang}".strip.downcase { #Aliases to languages names "eng" => ["en","en-us","english"], "ita" => ["it"], "por" => ["pt","pt-br","portuguese"], "spa" => ["sp"] }.each do |value,names| return " -l #{value} " if names.include? language end return " -l #{language} " if language.size > 0 "" rescue "" end #Page Segment Mode def psm @psm.nil? ? "" : " -psm #{@psm} " rescue "" end def config @options ||= {} @options.collect{|k,v| "#{k} #{v}" }.join("\n") end def config_file return "" if @options == {} conf = Tempfile.new("config") conf.write(config) conf.path end #TODO: Clear console for MacOS or Windows def clear_console_output return "" unless @clear_console_output return "2>/dev/null" if File.exist?("/dev/null") #Linux console clear end #Convert image to string def convert generate_uid tmp_file = Pathname.new(Dir::tmpdir).join("#{@uid}_#{@source.basename}") tmp_image = image_to_tiff `#{@command} '#{tmp_image}' '#{tmp_file.to_s}' #{lang} #{psm} #{config_file} #{clear_console_output}` @value = File.read("#{tmp_file.to_s}.txt").to_s @uid = nil remove_file([tmp_image,"#{tmp_file.to_s}.txt"]) rescue raise RTesseract::ConversionError end #Read image from memory blob def from_blob(blob) generate_uid tmp_file = Pathname.new(Dir::tmpdir).join("#{@uid}_#{@source.basename}") tmp_image = image_from_blob(blob) `#{@command} '#{tmp_image}' '#{tmp_file.to_s}' #{lang} #{psm} #{config_file} #{clear_console_output}` @value = File.read("#{tmp_file.to_s}.txt").to_s @uid = nil remove_file([tmp_image,"#{tmp_file.to_s}.txt"]) rescue raise RTesseract::ConversionError end #Output value def to_s return @value if @value != "" if @source.file? convert @value else raise RTesseract::ImageNotSelectedError end end #Remove spaces and break-lines def to_s_without_spaces to_s.gsub(" ","").gsub("\n","").gsub("\r","") end private def choose_processor! if @processor.to_s == "mini_magick" require File.expand_path(File.dirname(__FILE__) + "/processors/mini_magick.rb") self.class.send(:include, MiniMagickProcessor) else require File.expand_path(File.dirname(__FILE__) + "/processors/rmagick.rb") self.class.send(:include, RMagickProcessor) end end end
24.590643
105
0.61308
3996b92bb06f47ff6405610c46a720d5aa5922e0
1,358
# frozen_string_literal: true require "rails_helper" describe "Sign up", type: :system do before do driven_by(:selenium) end before(:each) do visit "/users/sign_up" end it "should not sign-up when no credentials" do click_button "Sign up" expect(page).to have_text("Email can't be blank") expect(page).to have_text("Password can't be blank") end it "should not sign-up when password is empty" do fill_in "Name", with: "user1" fill_in "Email", with: "[email protected]" click_button "Sign up" expect(page).to have_text("Password can't be blank") end it "should not sign-up when email is empty" do fill_in "Name", with: "user1" fill_in "Password", with: "secret" click_button "Sign up" expect(page).to have_text("Email can't be blank") end it "should not sign-up when password is less than 6 characters" do fill_in "Name", with: "user1" fill_in "Password", with: "secr" click_button "Sign up" expect(page).to have_text("Password is too short (minimum is 6 characters)") end it "should sign-up when valid credentials" do fill_in "Name", with: "user1" fill_in "Email", with: "[email protected]" fill_in "Password", with: "secret" click_button "Sign up" expect(page).to have_text("Welcome! You have signed up successfully.") end end
24.690909
80
0.675994
87b8b3ca9f92cf13613621f7cef50166abbd4046
777
# frozen_string_literal: true module Stripe class Order < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List include Stripe::APIOperations::Save OBJECT_NAME = "order".freeze custom_method :pay, http_verb: :post custom_method :return_order, http_verb: :post, http_path: "returns" def pay(params, opts = {}) resp, opts = request(:post, pay_url, params, opts) initialize_from(resp.data, opts) end def return_order(params, opts = {}) resp, opts = request(:post, returns_url, params, opts) Util.convert_to_stripe_object(resp.data, opts) end private def pay_url resource_url + "/pay" end def returns_url resource_url + "/returns" end end end
22.2
71
0.669241
1a1ed3829ff1d921f21a7bc7a3afe6c4d83a9c5e
195
require 'itamae-mitsurin/version' require 'itamae-mitsurin/mitsurin/cli' require 'itamae-mitsurin/mitsurin/creators' require 'aws-sdk' module ItamaeMitsurin module Mitsurin # TODO end end
17.727273
43
0.789744
1dca890f9c7cde14a4b01cd2e6f01c2a4d4b5115
16,021
# encoding: utf-8 # 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::V2017_10_01 # # A service client - single point of access to the REST API. # class NetworkManagementClient < MsRestAzure::AzureServiceClient include MsRestAzure include MsRestAzure::Serialization # @return [String] the base URI of the service. attr_accessor :base_url # @return Credentials needed for the client to connect to Azure. attr_reader :credentials # @return [String] The subscription credentials which uniquely identify the # Microsoft Azure subscription. The subscription ID forms part of the URI # for every service call. attr_accessor :subscription_id # @return [String] Client API version. attr_reader :api_version # @return [String] The preferred language for the response. attr_accessor :accept_language # @return [Integer] The retry timeout in seconds for Long Running # Operations. Default value is 30. attr_accessor :long_running_operation_retry_timeout # @return [Boolean] Whether a unique x-ms-client-request-id should be # generated. When set to true a unique x-ms-client-request-id value is # generated and included in each request. Default is true. attr_accessor :generate_client_request_id # @return [ApplicationGateways] application_gateways attr_reader :application_gateways # @return [ApplicationSecurityGroups] application_security_groups attr_reader :application_security_groups # @return [AvailableEndpointServices] available_endpoint_services attr_reader :available_endpoint_services # @return [ExpressRouteCircuitAuthorizations] # express_route_circuit_authorizations attr_reader :express_route_circuit_authorizations # @return [ExpressRouteCircuitPeerings] express_route_circuit_peerings attr_reader :express_route_circuit_peerings # @return [ExpressRouteCircuits] express_route_circuits attr_reader :express_route_circuits # @return [ExpressRouteServiceProviders] express_route_service_providers attr_reader :express_route_service_providers # @return [LoadBalancers] load_balancers attr_reader :load_balancers # @return [LoadBalancerBackendAddressPools] # load_balancer_backend_address_pools attr_reader :load_balancer_backend_address_pools # @return [LoadBalancerFrontendIPConfigurations] # load_balancer_frontend_ipconfigurations attr_reader :load_balancer_frontend_ipconfigurations # @return [InboundNatRules] inbound_nat_rules attr_reader :inbound_nat_rules # @return [LoadBalancerLoadBalancingRules] # load_balancer_load_balancing_rules attr_reader :load_balancer_load_balancing_rules # @return [LoadBalancerNetworkInterfaces] load_balancer_network_interfaces attr_reader :load_balancer_network_interfaces # @return [LoadBalancerProbes] load_balancer_probes attr_reader :load_balancer_probes # @return [NetworkInterfaces] network_interfaces attr_reader :network_interfaces # @return [NetworkInterfaceIPConfigurations] # network_interface_ipconfigurations attr_reader :network_interface_ipconfigurations # @return [NetworkInterfaceLoadBalancers] network_interface_load_balancers attr_reader :network_interface_load_balancers # @return [NetworkSecurityGroups] network_security_groups attr_reader :network_security_groups # @return [SecurityRules] security_rules attr_reader :security_rules # @return [DefaultSecurityRules] default_security_rules attr_reader :default_security_rules # @return [NetworkWatchers] network_watchers attr_reader :network_watchers # @return [PacketCaptures] packet_captures attr_reader :packet_captures # @return [ConnectionMonitors] connection_monitors attr_reader :connection_monitors # @return [Operations] operations attr_reader :operations # @return [PublicIPAddresses] public_ipaddresses attr_reader :public_ipaddresses # @return [RouteFilters] route_filters attr_reader :route_filters # @return [RouteFilterRules] route_filter_rules attr_reader :route_filter_rules # @return [RouteTables] route_tables attr_reader :route_tables # @return [Routes] routes attr_reader :routes # @return [BgpServiceCommunities] bgp_service_communities attr_reader :bgp_service_communities # @return [Usages] usages attr_reader :usages # @return [VirtualNetworks] virtual_networks attr_reader :virtual_networks # @return [Subnets] subnets attr_reader :subnets # @return [VirtualNetworkPeerings] virtual_network_peerings attr_reader :virtual_network_peerings # @return [VirtualNetworkGateways] virtual_network_gateways attr_reader :virtual_network_gateways # @return [VirtualNetworkGatewayConnections] # virtual_network_gateway_connections attr_reader :virtual_network_gateway_connections # @return [LocalNetworkGateways] local_network_gateways attr_reader :local_network_gateways # # Creates initializes a new instance of the NetworkManagementClient class. # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. # @param base_url [String] the base URI of the service. # @param options [Array] filters to be applied to the HTTP requests. # def initialize(credentials = nil, base_url = nil, options = nil) super(credentials, options) @base_url = base_url || 'https://management.azure.com' fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials @application_gateways = ApplicationGateways.new(self) @application_security_groups = ApplicationSecurityGroups.new(self) @available_endpoint_services = AvailableEndpointServices.new(self) @express_route_circuit_authorizations = ExpressRouteCircuitAuthorizations.new(self) @express_route_circuit_peerings = ExpressRouteCircuitPeerings.new(self) @express_route_circuits = ExpressRouteCircuits.new(self) @express_route_service_providers = ExpressRouteServiceProviders.new(self) @load_balancers = LoadBalancers.new(self) @load_balancer_backend_address_pools = LoadBalancerBackendAddressPools.new(self) @load_balancer_frontend_ipconfigurations = LoadBalancerFrontendIPConfigurations.new(self) @inbound_nat_rules = InboundNatRules.new(self) @load_balancer_load_balancing_rules = LoadBalancerLoadBalancingRules.new(self) @load_balancer_network_interfaces = LoadBalancerNetworkInterfaces.new(self) @load_balancer_probes = LoadBalancerProbes.new(self) @network_interfaces = NetworkInterfaces.new(self) @network_interface_ipconfigurations = NetworkInterfaceIPConfigurations.new(self) @network_interface_load_balancers = NetworkInterfaceLoadBalancers.new(self) @network_security_groups = NetworkSecurityGroups.new(self) @security_rules = SecurityRules.new(self) @default_security_rules = DefaultSecurityRules.new(self) @network_watchers = NetworkWatchers.new(self) @packet_captures = PacketCaptures.new(self) @connection_monitors = ConnectionMonitors.new(self) @operations = Operations.new(self) @public_ipaddresses = PublicIPAddresses.new(self) @route_filters = RouteFilters.new(self) @route_filter_rules = RouteFilterRules.new(self) @route_tables = RouteTables.new(self) @routes = Routes.new(self) @bgp_service_communities = BgpServiceCommunities.new(self) @usages = Usages.new(self) @virtual_networks = VirtualNetworks.new(self) @subnets = Subnets.new(self) @virtual_network_peerings = VirtualNetworkPeerings.new(self) @virtual_network_gateways = VirtualNetworkGateways.new(self) @virtual_network_gateway_connections = VirtualNetworkGatewayConnections.new(self) @local_network_gateways = LocalNetworkGateways.new(self) @api_version = '2017-10-01' @accept_language = 'en-US' @long_running_operation_retry_timeout = 30 @generate_client_request_id = true add_telemetry end # # Makes a request and returns the body of the response. # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. # @param path [String] the path, relative to {base_url}. # @param options [Hash{String=>String}] specifying any request options like :body. # @return [Hash{String=>String}] containing the body of the response. # Example: # # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}" # path = "/path" # options = { # body: request_content, # query_params: {'api-version' => '2016-02-01'} # } # result = @client.make_request(:put, path, options) # def make_request(method, path, options = {}) result = make_request_with_http_info(method, path, options) result.body unless result.nil? end # # Makes a request and returns the operation response. # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. # @param path [String] the path, relative to {base_url}. # @param options [Hash{String=>String}] specifying any request options like :body. # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status. # def make_request_with_http_info(method, path, options = {}) result = make_request_async(method, path, options).value! result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body) result end # # Makes a request asynchronously. # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. # @param path [String] the path, relative to {base_url}. # @param options [Hash{String=>String}] specifying any request options like :body. # @return [Concurrent::Promise] Promise object which holds the HTTP response. # def make_request_async(method, path, options = {}) fail ArgumentError, 'method is nil' if method.nil? fail ArgumentError, 'path is nil' if path.nil? request_url = options[:base_url] || @base_url if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?) @request_headers['Content-Type'] = options[:headers]['Content-Type'] end request_headers = @request_headers request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil? options.merge!({headers: request_headers.merge(options[:headers] || {})}) options.merge!({credentials: @credentials}) unless @credentials.nil? super(request_url, method, path, options) end # # Checks whether a domain name in the cloudapp.azure.com zone is available for # use. # # @param location [String] The location of the domain name. # @param domain_name_label [String] The domain name to be verified. It must # conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [DnsNameAvailabilityResult] operation results. # def check_dns_name_availability(location, domain_name_label, custom_headers:nil) response = check_dns_name_availability_async(location, domain_name_label, custom_headers:custom_headers).value! response.body unless response.nil? end # # Checks whether a domain name in the cloudapp.azure.com zone is available for # use. # # @param location [String] The location of the domain name. # @param domain_name_label [String] The domain name to be verified. It must # conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. # @param custom_headers [Hash{String => String}] A hash of custom headers that # will be added to the HTTP request. # # @return [MsRestAzure::AzureOperationResponse] HTTP response information. # def check_dns_name_availability_with_http_info(location, domain_name_label, custom_headers:nil) check_dns_name_availability_async(location, domain_name_label, custom_headers:custom_headers).value! end # # Checks whether a domain name in the cloudapp.azure.com zone is available for # use. # # @param location [String] The location of the domain name. # @param domain_name_label [String] The domain name to be verified. It must # conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. # @param [Hash{String => String}] A hash of custom headers that will be added # to the HTTP request. # # @return [Concurrent::Promise] Promise object which holds the HTTP response. # def check_dns_name_availability_async(location, domain_name_label, custom_headers:nil) fail ArgumentError, 'location is nil' if location.nil? fail ArgumentError, 'domain_name_label is nil' if domain_name_label.nil? fail ArgumentError, 'api_version is nil' if api_version.nil? fail ArgumentError, 'subscription_id is nil' if subscription_id.nil? request_headers = {} request_headers['Content-Type'] = 'application/json; charset=utf-8' # Set Headers request_headers['x-ms-client-request-id'] = SecureRandom.uuid request_headers['accept-language'] = accept_language unless accept_language.nil? path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability' request_url = @base_url || self.base_url options = { middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], path_params: {'location' => location,'subscriptionId' => subscription_id}, query_params: {'domainNameLabel' => domain_name_label,'api-version' => api_version}, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = self.make_request_async(:get, path_template, options) promise = promise.then do |result| http_response = result.response status_code = http_response.status response_content = http_response.body unless status_code == 200 error_model = JSON.load(response_content) fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model) end result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil? result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil? result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil? # Deserialize Response if status_code == 200 begin parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) result_mapper = Azure::Network::Mgmt::V2017_10_01::Models::DnsNameAvailabilityResult.mapper() result.body = self.deserialize(result_mapper, parsed_response) rescue Exception => e fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result) end end result end promise.execute end private # # Adds telemetry information. # def add_telemetry sdk_information = 'azure_mgmt_network' sdk_information = "#{sdk_information}/0.21.0" add_user_agent_information(sdk_information) end end end
41.721354
154
0.730416
62506741836cf425415ab3bdf274c652e9d13acb
1,163
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "net-dns" s.version = "0.8.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Marco Ceresa", "Simone Carletti"] s.date = "2013-05-08" s.description = "Net::DNS is a pure Ruby DNS library, with a clean OO interface and an extensible API." s.email = ["[email protected]", "[email protected]"] s.homepage = "http://github.com/bluemonk/net-dns" s.require_paths = ["lib"] s.required_ruby_version = Gem::Requirement.new(">= 1.8.7") s.rubyforge_project = "net-dns" s.rubygems_version = "2.0.14.1" s.summary = "Pure Ruby DNS library." if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q<rake>, ["~> 10.0"]) s.add_development_dependency(%q<yard>, [">= 0"]) else s.add_dependency(%q<rake>, ["~> 10.0"]) s.add_dependency(%q<yard>, [">= 0"]) end else s.add_dependency(%q<rake>, ["~> 10.0"]) s.add_dependency(%q<yard>, [">= 0"]) end end
34.205882
105
0.638865
1141a14e9371b8d880d0a5f26a4a11823b405cc9
615
# Definition for a binary tree node. # class TreeNode # attr_accessor :val, :left, :right # def initialize(val) # @val = val # @left, @right = nil, nil # end # end # @param {TreeNode} root # @return {Integer} def diameter_of_binary_tree(root) return 0 if root.nil? def height_of_btree(tree, height=0) return height if tree.nil? [height_of_btree(tree.left, height+1), height_of_btree(tree.right, height+1)].max end temp = height_of_btree(root.left) + height_of_btree(root.right) [diameter_of_binary_tree(root.left), diameter_of_binary_tree(root.right), temp].max end
27.954545
86
0.692683
019261d8a5df0c71d2a93ea77abf339caaa9a3aa
389
require_relative 'solver' require_relative 'utils/tree' class Day06 < Solver def get_data File.read(file_name).split end def tree @tree ||= Tree.new(data, edge_separator=')') end def names @test_data ? %w(L D) : %w(YOU SAN) end def run_one tree.nodes.values.map(&:number_of_ancestors).sum end def run_two tree.distance_by_name(*names) end end
14.961538
52
0.673522
8767ddbaa62702a9dccf441b61e4d317de85d104
2,328
# frozen_string_literal: true # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! module Google module Ads module GoogleAds module V4 module Services module CampaignBidModifierService # Path helper methods for the CampaignBidModifierService API. module Paths ## # Create a fully-qualified Campaign resource string. # # The resource will be in the following format: # # `customers/{customer}/campaigns/{campaign}` # # @param customer [String] # @param campaign [String] # # @return [::String] def campaign_path customer:, campaign: raise ::ArgumentError, "customer cannot contain /" if customer.to_s.include? "/" "customers/#{customer}/campaigns/#{campaign}" end ## # Create a fully-qualified CampaignBidModifier resource string. # # The resource will be in the following format: # # `customers/{customer}/campaignBidModifiers/{campaign_bid_modifier}` # # @param customer [String] # @param campaign_bid_modifier [String] # # @return [::String] def campaign_bid_modifier_path customer:, campaign_bid_modifier: raise ::ArgumentError, "customer cannot contain /" if customer.to_s.include? "/" "customers/#{customer}/campaignBidModifiers/#{campaign_bid_modifier}" end extend self end end end end end end end
32.788732
96
0.590206
335ccab83e7394d9ac5e2ba7b847157efab9adfd
1,236
# 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. # # This file is the source Rails uses to define your schema when running `rails # db:schema:load`. When creating a new database, `rails db:schema:load` tends to # be faster and is potentially less error prone than running all of your # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2020_08_22_021955) do create_table "logs", force: :cascade do |t| t.integer "user_id" t.date "date" t.string "pilot_in_command" t.string "aircraft_type" t.string "aircraft_rego" t.string "origin" t.string "destination" t.integer "landings" t.string "remarks" t.index ["user_id"], name: "index_logs_on_user_id" end create_table "users", force: :cascade do |t| t.string "fullname" t.string "username" t.string "password_digest" end end
35.314286
86
0.7411
6148494fb3f19ea3ade4f3e9de1192fcb704098b
810
# frozen_string_literal: true module Const GITHUB_PHRASEAPP_PR_TITLE = '[PhraseApp] Update locales' GITHUB_PHRASEAPP_PR_BODY = 'Update locales from PhraseApp' GIT_PHRASEAPP_COMMIT_MSG = '[skip ci] Update translations from PhraseApp' GIT_PHRASEAPP_BRANCH_BASE = 'master' PHRASEAPP_PROJECT_ID = '9036e89959d471e0c2543431713b7ba1' PHRASEAPP_FALLBACK_LOCALE = 'en_US' # project-specific mappings for locales to filenames PHRASEAPP_TAG = 'prestashop' LOCALE_SPECIFIC_MAP = { 'en_US': 'en', 'de_DE': 'de', 'fr_FR': 'fr', 'id_ID': 'id', 'ja_JP': 'ja', 'ko_KR': 'ko', 'pl_PL': 'pl', 'zh_TW': 'tw', 'zh_CN': 'zh', }.freeze # paths relative to project root PLUGIN_DIR = 'wirecardpaymentgateway' PLUGIN_I18N_DIR = File.join(PLUGIN_DIR, 'translations') end
27.931034
75
0.701235
38bbddefb42fbaf1bffef28839ac02cec776a908
455
# Time complexity: O(n) # Space Complexity: O(n) def newman_conway(num) raise ArgumentError if num < 1 sequence = [] n = 1 while n <= num sequence.push(get_newman_num(n)) n += 1 end return sequence.join(" ") end def get_newman_num(num) if num < 3 return 1 else num = get_newman_num(get_newman_num(num - 1)) + get_newman_num(num - get_newman_num(num - 1)) # P(n) = P(P(n - 1)) + P(n - P(n - 1)) return num end end
19.782609
97
0.617582
abb181cf49898f88e50ed9d0b202cb3678b05f01
939
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "blogo/version" require 'blogo/constants' # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "blogo" s.version = Blogo::VERSION s.authors = ["Sergey Potapov"] s.email = ["[email protected]"] s.homepage = Blogo::HOME_PAGE_URL s.summary = "Mountable blog engine for Ruby on Rails" s.description = "Mountable blog engine for Ruby on Rails. It allows you to quickly add a featured blog to an existing rails application." s.license = "MIT" s.files = Dir["{app,config,db,lib,vendor}/**/*", "MIT-LICENSE", "Rakefile", "README.markdown"] s.test_files = Dir["rspec/**/*"] s.add_dependency "rails" , "~> 5.2" s.add_dependency "jquery-rails" s.add_dependency 'coffee-rails' s.add_dependency "bcrypt", "~> 3.1" s.add_dependency "sass-rails" , ">= 5" end
34.777778
139
0.664537
1dde93aea33b949851fc29528514be12e5561950
446
# frozen_string_literal: true module Metanorma; module Document; module Devel; module ClassGen; class Generator # Generates Ruby files for DataTypes class DataType < Generator def generate_part module_block([::Class, @item.name, :"Core::Node::DataType"]) do # For the current understanding, DataTypes are Strings in general, # but could implement additional methods. end end end end; end; end; end; end
31.857143
81
0.70852
ab0ed39e990bcd06c8445082293a97904be3ab16
83
module TokyoMetro::Modules::ToFactory::Api::Convert::Customize::TrainTimetable end
27.666667
78
0.819277
7a4356d181f781087929de12703a0a17de36b33f
1,562
module QBIntegration class CreditMemo < Base attr_accessor :flowlink_credit_memo def initialize(message = {}, config) super @flowlink_credit_memo = payload[:credit_memo] ? payload[:credit_memo] : {} end def create if credit_memo = credit_memo_service.find_by_number(@flowlink_credit_memo[:id]) raise AlreadyPersistedOrderException.new("FlowLink Credit Memo #{flowlink_credit_memo[:id]} already exists - QuickBooks Credit Memo #{credit_memo.id}") end credit_memo = credit_memo_service.create flowlink_credit_memo[:qbo_id] = credit_memo.id text = "Created QuickBooks Credit Memo: #{credit_memo.doc_number}" [200, text, flowlink_credit_memo] end def update credit_memo = credit_memo_service.find_by_memo_number if !credit_memo.present? && config[:quickbooks_create_or_update].to_s == "1" credit_memo = credit_memo_service.create text = "Created QuickBooks Credit Memo: #{credit_memo.doc_number}" flowlink_credit_memo[:qbo_id] = credit_memo.id [200, text, flowlink_credit_memo] elsif !credit_memo.present? raise RecordNotFound.new "QuickBooks credit memo not found for doc_number #{flowlink_credit_memo[:number] || flowlink_credit_memo[:id]}" else credit_memo = credit_memo_service.update_memo(credit_memo) text = "Update QuickBooks Credit Memo: #{credit_memo.doc_number}" flowlink_credit_memo[:qbo_id] = credit_memo.id [200, text, flowlink_credit_memo] end end end end
38.097561
159
0.711268
285327c0fd15e8019d2d86d3ea10ae5896c87e8a
3,913
require 'spec_helper' describe Spree::Api::ShipmentsController do render_views let!(:shipment) { create(:shipment) } let!(:attributes) { [:id, :tracking, :number, :cost, :shipped_at, :stock_location_name, :order_id, :shipping_rates, :shipping_methods] } before do stub_authentication! end let!(:resource_scoping) { { id: shipment.to_param, shipment: { order_id: shipment.order.to_param } } } context "as a non-admin" do it "cannot make a shipment ready" do api_put :ready assert_not_found! end it "cannot make a shipment shipped" do api_put :ship assert_not_found! end end context "as an admin" do let!(:order) { shipment.order } let!(:stock_location) { create(:stock_location_with_items) } let!(:variant) { create(:variant) } sign_in_as_admin! it 'can create a new shipment' do params = { variant_id: stock_location.stock_items.first.variant.to_param, shipment: { order_id: order.number }, stock_location_id: stock_location.to_param, } api_post :create, params response.status.should == 200 json_response.should have_attributes(attributes) end it 'can update a shipment' do params = { shipment: { stock_location_id: stock_location.to_param } } api_put :update, params response.status.should == 200 json_response['stock_location_name'].should == stock_location.name end it "can make a shipment ready" do Spree::Order.any_instance.stub(:paid? => true, :complete? => true) api_put :ready json_response.should have_attributes(attributes) json_response["state"].should == "ready" shipment.reload.state.should == "ready" end it "cannot make a shipment ready if the order is unpaid" do Spree::Order.any_instance.stub(:paid? => false) api_put :ready json_response["error"].should == "Cannot ready shipment." response.status.should == 422 end context 'for completed shipments' do let(:order) { create :completed_order_with_totals } let!(:resource_scoping) { { id: order.shipments.first.to_param, shipment: { order_id: order.to_param } } } it 'adds a variant to a shipment' do api_put :add, { variant_id: variant.to_param, quantity: 2 } response.status.should == 200 json_response['manifest'].detect { |h| h['variant']['id'] == variant.id }["quantity"].should == 2 end it 'removes a variant from a shipment' do order.contents.add(variant, 2) api_put :remove, { variant_id: variant.to_param, quantity: 1 } response.status.should == 200 json_response['manifest'].detect { |h| h['variant']['id'] == variant.id }["quantity"].should == 1 end it 'removes a destroyed variant from a shipment' do order.contents.add(variant, 2) variant.destroy api_put :remove, { variant_id: variant.to_param, quantity: 1 } response.status.should == 200 json_response['manifest'].detect { |h| h['variant']['id'] == variant.id }["quantity"].should == 1 end end context "can transition a shipment from ready to ship" do before do Spree::Order.any_instance.stub(:paid? => true, :complete? => true) # For the shipment notification email Spree::Config[:mails_from] = "[email protected]" shipment.update!(shipment.order) shipment.state.should == "ready" Spree::ShippingRate.any_instance.stub(:cost => 5) end it "can transition a shipment from ready to ship" do shipment.reload api_put :ship, id: shipment.to_param, shipment: { tracking: "123123", order_id: shipment.order.to_param } json_response.should have_attributes(attributes) json_response["state"].should == "shipped" end end end end
32.608333
138
0.646307
ed62a08181ccd71950b24bd9cf62bff962258ab5
145
class AddClassificaToSenders < ActiveRecord::Migration[5.2] def change add_column :senders, :classifica, :boolean, default: true end end
24.166667
61
0.758621
1a990394cd3378db2c2e422f054f49273d4dc77e
266
class SurplusMeter < Cask url 'http://www.skoobysoft.com/downloads/SurplusMeterv203.dmg' homepage 'http://www.skoobysoft.com/utilities/utilities.html#surplusmeter' version '2.0.3' sha1 '737fea8d51f1879f85ba65d4081808e023234445' link 'SurplusMeter.app' end
33.25
76
0.789474
878deefcc2396cca205bfc0d6dad0564fb6a457e
534
package 'nginx' do action :install end service 'nginx.service' do supports :status => true, :restart => true, :reload => true action [ :enable, :start ] end cookbook_file '/opt/edit_nginx_config.rb' do source 'nginx.rb' owner 'root' group 'root' mode '755' end execute "edit nginx config" do command '/opt/edit_nginx_config.rb' end service 'nginx.service' do action :restart end execute 'open nginx port' do command 'firewall-cmd --zone=public --permanent --add-service=http && firewall-cmd --reload' end
19.071429
94
0.700375
e9ca1fdf2c758c33957389db9650e65d93117480
279
class Freezer < Cask version 'latest' sha256 :no_check url 'http://download.mrgeckosmedia.com/Freezer.zip' appcast 'https://mrgeckosmedia.com/applications/appcast/Freezer' homepage 'https://mrgeckosmedia.com/applications/info/Freezer' app 'Freezer/Freezer.app' end
25.363636
66
0.763441
33dc42d6614fb5e71e1bbf3ab088ac8280cc71ff
1,374
class Benthos < Formula desc "Stream processor for mundane tasks written in Go" homepage "https://www.benthos.dev" url "https://github.com/Jeffail/benthos/archive/v3.25.0.tar.gz" sha256 "65c458bfba9a115c1898ca00968d24006ae23f033fc6ec7155bd7d18f11cd174" license "MIT" bottle do cellar :any_skip_relocation sha256 "af4bfa9edbcf494ca7bd2706fb69b1b9f782a9f53387f284c39f7c2102632b4d" => :catalina sha256 "2ad255e7b7944122e50c3ab10fd35fce81991ddbbb3c4b6d9ceca8269d8d4fe6" => :mojave sha256 "b011996c0c1fa2b87afbb7651883a3df2c939c83754b42761f3a6efce14bd33b" => :high_sierra sha256 "83dc79a3913df8337acdfdbfceca8969c9ce1e2d759070de27aa61c4267cde0e" => :x86_64_linux end depends_on "go" => :build def install system "make", "VERSION=#{version}" bin.install "target/bin/benthos" end test do (testpath/"sample.txt").write <<~EOS QmVudGhvcyByb2NrcyE= EOS (testpath/"test_pipeline.yaml").write <<~EOS --- logger: level: ERROR input: type: file file: path: ./sample.txt pipeline: threads: 1 processors: - type: decode decode: scheme: base64 output: type: stdout EOS output = shell_output("#{bin}/benthos -c test_pipeline.yaml") assert_match "Benthos rocks!", output.strip end end
28.040816
94
0.686317
18d36d643f813de00cc6bdf998183638330cef2e
509
RSpec.describe Field do include_context "shared api instance" it "can list" do fields = cm.field.list first_result = fields.first expect(fields.count).to be > 1 expect(first_result['TrimType']).to eq('FieldDefinition') expect(first_result).to include('Uri' => a_kind_of(Integer)) end it "can list items" do fields = cm.field.list_items first_result = fields.first expect(fields.count).to be > 1 expect(first_result).to respond_to(:search_clause_name) end end
24.238095
64
0.701375
e9da30c70ca12e2d95a0c90aa9d2a940d9d4ed4f
3,327
# frozen_string_literal: true # Adapted from https://github.com/eric/metriks-graphite/blob/master/lib/metriks/reporter/graphite.rb require 'metriks' module Dyndnsd class TextfileReporter # @return [String] attr_reader :file # @param file [String] # @param options [Hash{Symbol => Object}] def initialize(file, options = {}) @file = file @prefix = options[:prefix] @registry = options[:registry] || Metriks::Registry.default @interval = options[:interval] || 60 @on_error = options[:on_error] || proc { |ex| } end # @return [void] def start @thread ||= Thread.new do loop do sleep @interval Thread.new do begin write rescue StandardError => e @on_error[e] rescue nil end end end end end # @return [void] def stop @thread&.kill @thread = nil end # @return [void] def restart stop start end # @return [void] def write File.open(@file, 'w') do |f| @registry.each do |name, metric| case metric when Metriks::Meter write_metric f, name, metric, [ :count, :one_minute_rate, :five_minute_rate, :fifteen_minute_rate, :mean_rate ] when Metriks::Counter write_metric f, name, metric, [ :count ] when Metriks::UtilizationTimer write_metric f, name, metric, [ :count, :one_minute_rate, :five_minute_rate, :fifteen_minute_rate, :mean_rate, :min, :max, :mean, :stddev, :one_minute_utilization, :five_minute_utilization, :fifteen_minute_utilization, :mean_utilization ], [ :median, :get_95th_percentile ] when Metriks::Timer write_metric f, name, metric, [ :count, :one_minute_rate, :five_minute_rate, :fifteen_minute_rate, :mean_rate, :min, :max, :mean, :stddev ], [ :median, :get_95th_percentile ] when Metriks::Histogram write_metric f, name, metric, [ :count, :min, :max, :mean, :stddev ], [ :median, :get_95th_percentile ] end end end end # @param file [String] # @param base_name [String] # @param metric [Object] # @param keys [Array{Symbol}] # @param snapshot_keys [Array{Symbol}] # @return [void] def write_metric(file, base_name, metric, keys, snapshot_keys = []) time = Time.now.to_i base_name = base_name.to_s.gsub(/ +/, '_') base_name = "#{@prefix}.#{base_name}" if @prefix keys.flatten.each do |key| name = key.to_s.gsub(/^get_/, '') value = metric.send(key) file.write("#{base_name}.#{name} #{value} #{time}\n") end unless snapshot_keys.empty? snapshot = metric.snapshot snapshot_keys.flatten.each do |key| name = key.to_s.gsub(/^get_/, '') value = snapshot.send(key) file.write("#{base_name}.#{name} #{value} #{time}\n") end end end end end
26.616
100
0.532011
ed81cc9e7f629c7d69b3ff7704b857a98bc8778e
658
require_relative "models/base" require_relative "models/course" require_relative "models/course_configuration" require_relative "models/course_import" require_relative "models/destination" require_relative "models/dispatch" require_relative "models/dispatch_registration_count" require_relative "models/dispatch_zip" require_relative "models/learner" require_relative "models/registration" require_relative "models/registration_activity_detail" require_relative "models/registration_configuration" require_relative "models/registration_launch_history" require_relative "models/registration_runtime_interaction" require_relative "models/tenant_configuration"
41.125
58
0.886018
336573270abe20922de585fb299830513ea0cfa3
65
User.create([{name:'admin',email:'[email protected]', role_id:3}])
65
65
0.707692
5d16526c7faefe9a56b137912f4c8f6d713abdd8
1,389
require 'set' module NewRelic module Binding class Metric attr_reader :component, :name, :value, :count, :min, :max, :sum_of_squares def initialize(component, name, input_value, options = {} ) value = input_value.to_f @component = component @name = name @value = value if options_has_required_keys(options) @count = options[:count].to_i @min = options[:min].to_f @max = options[:max].to_f @sum_of_squares = options[:sum_of_squares].to_f else PlatformLogger.warn("Metric #{@name} count, min, max, and sum_of_squares are all required if one is set, falling back to value only") unless options.size == 0 @count = 1 @min = value @max = value @sum_of_squares = (value * value) end end def aggregate(metric) @value += metric.value @count += metric.count @min = [@min, metric.min].min @max = [@max, metric.max].max @sum_of_squares += metric.sum_of_squares end def to_hash { name => [ @value, @count, @min, @max, @sum_of_squares ] } end private def options_has_required_keys(options) options.keys.to_set.superset?(Set.new([:count, :min, :max, :sum_of_squares])) end end end end
27.78
168
0.565875
088f2f6631428e48c0a526a40316a3a6f8bf986b
1,578
# frozen_string_literal: true class UnauthorizedController < ActionController::Metal include ActionController::UrlFor include ActionController::Redirecting include AbstractController::Rendering include ActionController::Rendering include ActionController::Renderers::All include ActionController::ConditionalGet include ActionController::MimeResponds include Rails.application.routes.url_helpers delegate :flash, to: :request def self.call(env) action(:respond).call(env) end def respond action = (["patch", "post", "put"].include?(params[:_method]) ? "make this change" : "view this page") message = "You are not #{current_user ? "authorized to #{action}" : "logged in"}" respond_to do |format| format.json do render json: {error: "#{message}, see docs/api.md on how to authenticate"}, status: :unauthorized end format.html do attempted_path = "/#{url_for(params).split("/", 4).last}" # request.fullpath is /unauthenticated flash[:alert] = "".html_safe << message << ". " << access_request_link redirect_to login_path(redirect_to: attempted_path) end end end private def current_user request.env['warden']&.user end def access_request_link return '' if !AccessRequestsController.feature_enabled? || !current_user || current_user.super_admin? if current_user.access_request_pending? 'Access request pending.' else ActionController::Base.helpers.link_to('Request additional access rights', new_access_request_path) end end end
31.56
106
0.712928
1a9cafddcdcb93a269120a68c9beb68f15a27d72
1,631
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../fixtures/classes', __FILE__) describe "Hash#default" do it "returns the default value" do h = new_hash 5 h.default.should == 5 h.default(4).should == 5 new_hash.default.should == nil new_hash.default(4).should == nil end it "uses the default proc to compute a default value, passing given key" do h = new_hash { |*args| args } h.default(nil).should == [h, nil] h.default(5).should == [h, 5] end it "calls default proc with nil arg if passed a default proc but no arg" do h = new_hash { |*args| args } h.default.should == nil end end describe "Hash#default=" do it "sets the default value" do h = new_hash h.default = 99 h.default.should == 99 end it "unsets the default proc" do [99, nil, lambda { 6 }].each do |default| h = new_hash { 5 } h.default_proc.should_not == nil h.default = default h.default.should == default h.default_proc.should == nil end end ruby_version_is ""..."1.9" do it "raises a TypeError if called on a frozen instance" do lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(TypeError) lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(TypeError) end end ruby_version_is "1.9" do it "raises a RuntimeError if called on a frozen instance" do lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(RuntimeError) lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(RuntimeError) end end end
29.125
91
0.664623
edde93c4c15fcb14beb7e230eee6dd4043b0ba4e
1,046
require "language/node" class Heroku < Formula desc "Command-line client for the cloud PaaS" homepage "https://cli.heroku.com" url "https://registry.npmjs.org/heroku-cli/-/heroku-cli-6.16.12.tgz" sha256 "934395c3aa9ddfcd9ab4c160674e32019234bc87a1376da7e5a921c6651031b8" head "https://github.com/heroku/cli.git" bottle do cellar :any_skip_relocation sha256 "132a34dd2eeb567c7af9498cf9ba8df67abe60eed64aea67f9412c5f082c0337" => :high_sierra sha256 "912f634786bd9b475cf246040426a7443f43146f0872fe1742a6c487ffffdd14" => :sierra sha256 "348ed0c0cabbdb62d30f7fbd7639d9b928a1f721590542b3afa71a19bbc8eb66" => :el_capitan end depends_on "node" def install inreplace "bin/run" do |s| s.gsub! "npm update -g heroku-cli", "brew upgrade heroku" s.gsub! "#!/usr/bin/env node", "#!#{Formula["node"].opt_bin}/node" end system "npm", "install", *Language::Node.std_npm_install_args(libexec) bin.install_symlink Dir["#{libexec}/bin/*"] end test do system bin/"heroku", "version" end end
32.6875
93
0.736138
ffc2f4480166a02dfcc7f92f72945352520981c6
313
class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :authenticate_user! before_action :configure_permitted_parameters, if: :devise_controller? def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: [:name]) end end
31.3
72
0.821086
b99af4d47ba03343a78e29a1acba8f5aecdeac1e
9,057
require 'fileutils' require 'rdoc/generator' require 'rdoc/markup/to_html' ## # We're responsible for generating all the HTML files from the object tree # defined in code_objects.rb. We generate: # # [files] an html file for each input file given. These # input files appear as objects of class # TopLevel # # [classes] an html file for each class or module encountered. # These classes are not grouped by file: if a file # contains four classes, we'll generate an html # file for the file itself, and four html files # for the individual classes. # # [indices] we generate three indices for files, classes, # and methods. These are displayed in a browser # like window with three index panes across the # top and the selected description below # # Method descriptions appear in whatever entity (file, class, or module) that # contains them. # # We generate files in a structure below a specified subdirectory, normally # +doc+. # # opdir # | # |___ files # | |__ per file summaries # | # |___ classes # |__ per class/module descriptions # # HTML is generated using the Template class. class RDoc::Generator::HTML include RDoc::Generator::MarkUp ## # Generator may need to return specific subclasses depending on the # options they are passed. Because of this we create them using a factory def self.for(options) RDoc::Generator::AllReferences.reset RDoc::Generator::Method.reset if options.all_one_file RDoc::Generator::HTMLInOne.new options else new options end end class << self protected :new end ## # Set up a new HTML generator. Basically all we do here is load up the # correct output temlate def initialize(options) #:not-new: @options = options load_html_template @main_page_path = nil end ## # Build the initial indices and output objects # based on an array of TopLevel objects containing # the extracted information. def generate(toplevels) @toplevels = toplevels @files = [] @classes = [] write_style_sheet gen_sub_directories() build_indices generate_html end private ## # Load up the HTML template specified in the options. # If the template name contains a slash, use it literally def load_html_template template = @options.template unless template =~ %r{/|\\} then template = File.join('rdoc', 'generator', @options.generator.key, template) end require template @template = self.class.const_get @options.template.upcase @options.template_class = @template rescue LoadError $stderr.puts "Could not find HTML template '#{template}'" exit 99 end ## # Write out the style sheet used by the main frames def write_style_sheet return unless @template.constants.include? :STYLE or @template.constants.include? 'STYLE' template = RDoc::TemplatePage.new @template::STYLE unless @options.css then open RDoc::Generator::CSS_NAME, 'w' do |f| values = {} if @template.constants.include? :FONTS or @template.constants.include? 'FONTS' then values["fonts"] = @template::FONTS end template.write_html_on(f, values) end end end ## # See the comments at the top for a description of the directory structure def gen_sub_directories FileUtils.mkdir_p RDoc::Generator::FILE_DIR FileUtils.mkdir_p RDoc::Generator::CLASS_DIR rescue $stderr.puts $!.message exit 1 end def build_indices @files, @classes = RDoc::Generator::Context.build_indicies(@toplevels, @options) end ## # Generate all the HTML def generate_html # the individual descriptions for files and classes gen_into(@files) gen_into(@classes) # and the index files gen_file_index gen_class_index gen_method_index gen_main_index # this method is defined in the template file write_extra_pages if defined? write_extra_pages end def gen_into(list) list.each do |item| if item.document_self op_file = item.path FileUtils.mkdir_p(File.dirname(op_file)) open(op_file, "w") { |file| item.write_on(file) } end end end def gen_file_index gen_an_index @files, 'Files', @template::FILE_INDEX, "fr_file_index.html" end def gen_class_index gen_an_index(@classes, 'Classes', @template::CLASS_INDEX, "fr_class_index.html") end def gen_method_index gen_an_index(RDoc::Generator::Method.all_methods, 'Methods', @template::METHOD_INDEX, "fr_method_index.html") end def gen_an_index(collection, title, template, filename) template = RDoc::TemplatePage.new @template::FR_INDEX_BODY, template res = [] collection.sort.each do |f| if f.document_self res << { "href" => f.path, "name" => f.index_name } end end values = { "entries" => res, 'list_title' => CGI.escapeHTML(title), 'index_url' => main_url, 'charset' => @options.charset, 'style_url' => style_url('', @options.css), } open filename, 'w' do |f| template.write_html_on(f, values) end end ## # The main index page is mostly a template frameset, but includes the # initial page. If the <tt>--main</tt> option was given, we use this as # our main page, otherwise we use the first file specified on the command # line. def gen_main_index template = RDoc::TemplatePage.new @template::INDEX open 'index.html', 'w' do |f| classes = @classes.sort.map { |klass| klass.value_hash } values = { 'main_page' => @main_page, 'initial_page' => main_url, 'style_url' => style_url('', @options.css), 'title' => CGI.escapeHTML(@options.title), 'charset' => @options.charset, 'classes' => classes, } values['inline_source'] = @options.inline_source template.write_html_on f, values end end ## # Returns the url of the main page def main_url @main_page = @options.main_page @main_page_ref = nil if @main_page @main_page_ref = RDoc::Generator::AllReferences[@main_page] if @main_page_ref then @main_page_path = @main_page_ref.path else $stderr.puts "Could not find main page #{@main_page}" end end unless @main_page_path then file = @files.find { |context| context.document_self } @main_page_path = file.path if file end unless @main_page_path then $stderr.puts "Couldn't find anything to document" $stderr.puts "Perhaps you've used :stopdoc: in all classes" exit 1 end @main_page_path end end class RDoc::Generator::HTMLInOne < RDoc::Generator::HTML def initialize(*args) super end ## # Build the initial indices and output objects # based on an array of TopLevel objects containing # the extracted information. def generate(info) @toplevels = info @hyperlinks = {} build_indices generate_xml end ## # Generate: # # * a list of RDoc::Generator::File objects for each TopLevel object. # * a list of RDoc::Generator::Class objects for each first level # class or module in the TopLevel objects # * a complete list of all hyperlinkable terms (file, # class, module, and method names) def build_indices @files, @classes = RDoc::Generator::Context.build_indices(@toplevels, @options) end ## # Generate all the HTML. For the one-file case, we generate # all the information in to one big hash def generate_xml values = { 'charset' => @options.charset, 'files' => gen_into(@files), 'classes' => gen_into(@classes), 'title' => CGI.escapeHTML(@options.title), } # this method is defined in the template file write_extra_pages if defined? write_extra_pages template = RDoc::TemplatePage.new @template::ONE_PAGE if @options.op_name opfile = open @options.op_name, 'w' else opfile = $stdout end template.write_html_on(opfile, values) end def gen_into(list) res = [] list.each do |item| res << item.value_hash end res end def gen_file_index gen_an_index(@files, 'Files') end def gen_class_index gen_an_index(@classes, 'Classes') end def gen_method_index gen_an_index(RDoc::Generator::Method.all_methods, 'Methods') end def gen_an_index(collection, title) res = [] collection.sort.each do |f| if f.document_self res << { "href" => f.path, "name" => f.index_name } end end return { "entries" => res, 'list_title' => title, 'index_url' => main_url, } end end
24.412399
77
0.63796
e807bb4d775c807989a1efffcbbe6f8a4118d12b
466
require "smart_answer_flows/shared/redundancy_pay_flow" module SmartAnswer class CalculateEmployeeRedundancyPayFlow < Flow def define start_page_content_id "a5b52037-1712-4544-a3d1-a352ce8a8287" flow_content_id "04cbc84c-ad73-4f49-b5a0-ba4906b37e3b" name "calculate-employee-redundancy-pay" status :published satisfies_need "7b64d692-db45-428a-8767-131bb6d5b118" append(Shared::RedundancyPayFlow.build) end end end
27.411765
66
0.766094
3346b5c21ba98cad9f64d5645658d1b23f0834e1
1,285
require './lib/random_quoter.rb' class CommandWatcher def self.parse(text) args = text.split(' ') if args[0].include?('/start') <<-MESSAGE Hello, nice yo meet you! - ask me for a quote by typing /quote - type /help whenever you are confused - type /info if you want to find out more :) MESSAGE elsif args[0].include?('/help') <<-MESSAGE /start - startup message /quote - get a mindful quote you may need to write /quote@MindfulnessQuoterBot if there are multiple bots in a group chat /info - info about this bot /help - this list of commands MESSAGE elsif args[0].include?('/info') <<-MESSAGE Made by @tpei_bots The code is open source and can be found here: https://github.com/TPei/MindfulnessQuoterBot If there are persisting problem with this bot or you'd like to request changes, open an issue here: https://github.com/TPei/MindfulnessQuoterBot/issues/new Right now there are #{RandomQuoter.count} different quotes that this bot will respond with. MESSAGE elsif args[0].include?('/quote') RandomQuoter.quote elsif ['what?', 'wat', 'wat?'].include? args[0].downcase 'Think about it man!' elsif args[0].start_with? '/' 'Sorry, but I do not know that command' else end end end
30.595238
155
0.684047
7acd79e0ea8ee3e9bad74a9db979c56c3c7cf400
1,248
class DeviseCreateDanvanthiriCorePatients < ActiveRecord::Migration def change create_table(:danvanthiri_core_patients) do |t| ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token t.datetime :reset_password_sent_at ## Rememberable t.datetime :remember_created_at ## Trackable t.integer :sign_in_count, default: 0, null: false t.datetime :current_sign_in_at t.datetime :last_sign_in_at t.string :current_sign_in_ip t.string :last_sign_in_ip t.string :first_name t.string :last_name t.string :mobile_number t.integer :gender t.datetime :date_of_birth t.string :address_line_1 t.string :address_line_2 t.string :address_city t.string :address_state t.string :pin_code t.string :slug t.string :auth_token t.string :otp t.timestamps null: false end add_index :danvanthiri_core_patients, :email, unique: true add_index :danvanthiri_core_patients, :reset_password_token, unique: true end end
26.553191
77
0.657853
396e8f5080a783bdba7f0931a3bd99a8f9fedf6b
2,847
# 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' require 'factory_bot' # 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 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") # sign_in helpers for feature specs config.include Devise::Test::IntegrationHelpers, type: :feature config.include FactoryBot::Syntax::Methods end
45.190476
86
0.752722
7a5b9684dff18c3a3d79f84daab1ec37e8a2d7f9
2,152
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. if Rails.root.join('tmp/caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :test host = 'rails-tutorial-mhartl.c9users.io' # ここをコピペすると失敗します。自分の環境に合わせてください。 config.action_mailer.default_url_options = { host: host, protocol: 'https' } config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker end
37.103448
85
0.765335
7a235af649f59ad47af64832d610a0156c679f39
4,566
require 'spec_helper' describe 'vswitch::ovs' do let :default_params do { :package_ensure => 'present', :dkms_ensure => true, } end let :redhat_platform_params do { :ovs_package_name => 'openvswitch', :ovs_service_name => 'openvswitch', :provider => 'ovs_redhat', } end let :debian_platform_params do { :ovs_package_name => 'openvswitch-switch', :ovs_dkms_package_name => 'openvswitch-datapath-dkms', :ovs_service_name => 'openvswitch-switch', :provider => 'ovs', :service_hasstatus => false, :service_status => '/etc/init.d/openvswitch-switch status | fgrep "is running"', } end let :ubuntu_platform_params do { :ovs_package_name => 'openvswitch-switch', :ovs_dkms_package_name => 'openvswitch-datapath-dkms', :ovs_service_name => 'openvswitch-switch', :provider => 'ovs', :service_hasstatus => false, :service_status => '/sbin/status openvswitch-switch | fgrep "start/running"', } end shared_examples_for 'vswitch ovs' do it 'contains params' do is_expected.to contain_class('vswitch::params') end it 'configures service' do is_expected.to contain_service('openvswitch').with( :ensure => true, :enable => true, :name => platform_params[:ovs_service_name], :hasstatus => platform_params[:service_hasstatus], :status => platform_params[:service_status], ) end it 'install package' do is_expected.to contain_package(platform_params[:ovs_package_name]).with( :name => platform_params[:ovs_package_name], :ensure => params[:package_ensure], :before => 'Service[openvswitch]' ) end end shared_examples_for 'do not install dkms' do it 'does not rebuild kernel module' do is_expected.to_not contain_exec('rebuild-ovsmod') end end shared_examples_for 'install dkms' do it 'install kernel module' do is_expected.to contain_package(platform_params[:ovs_dkms_package_name]).with( :name => platform_params[:ovs_dkms_package_name], :ensure => params[:package_ensure], ) end it 'rebuilds kernel module' do is_expected.to contain_exec('rebuild-ovsmod').with( :command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log', :refreshonly => true, ) end end context 'on redhat with default parameters' do let :params do default_params end let :facts do {:osfamily => 'Redhat'} end let :platform_params do redhat_platform_params end it_configures 'vswitch ovs' it_configures 'do not install dkms' end context 'on redhat with parameters' do let :params do { :package_ensure => 'latest', :dkms_ensure => false, } end let :facts do {:osfamily => 'Redhat'} end let :platform_params do redhat_platform_params end it_configures 'vswitch ovs' it_configures 'do not install dkms' end context 'on Debian with default parameters' do let :params do default_params end let :facts do {:osfamily => 'Debian', :operatingsystem => 'Debian', } end let :platform_params do debian_platform_params end it_configures 'vswitch ovs' it_configures 'install dkms' end context 'on Debian with parameters' do let :params do { :package_ensure => 'latest', :dkms_ensure => false, } end let :facts do {:osfamily => 'Debian', :operatingsystem => 'Debian', } end let :platform_params do debian_platform_params end it_configures 'vswitch ovs' it_configures 'do not install dkms' end context 'on Ubuntu with default parameters' do let :params do default_params end let :facts do {:osfamily => 'Debian', :operatingsystem => 'ubuntu', } end let :platform_params do ubuntu_platform_params end it_configures 'vswitch ovs' it_configures 'install dkms' end context 'on Ubuntu with parameters' do let :params do { :package_ensure => 'latest', :dkms_ensure => false, } end let :facts do {:osfamily => 'Debian', :operatingsystem => 'ubuntu', } end let :platform_params do ubuntu_platform_params end it_configures 'vswitch ovs' it_configures 'do not install dkms' end end
25.651685
99
0.626369
610b3fb102b4988bc5d82b0eb46719174421c15e
1,464
# NOTE: the rspec should be test alonely. describe WeixinAuthorize::Client do describe "#get access_token" do it "return a access_token nil value before authenticate" do expect($client.access_token).to eq(nil) end it "appid and appsecret shoud be valid" do valid_info = $client.is_valid? expect(valid_info).to eq(true) end it "return the same access_token in the same thing twice" do access_token_1 = $client.get_access_token sleep 5 access_token_2 = $client.get_access_token expect(access_token_1).to eq(access_token_2) end it "return errorcode and errormsg when appid or appsecret is invalid" do $client_1 = WeixinAuthorize::Client.new("appid", "app_secret") valid_info = $client_1.is_valid? expect(valid_info).to eq(false) end it "#get_access_token should raise error if app_secret or appid is invalid" do $client_2 = WeixinAuthorize::Client.new("appid_2", "app_secret_2") expect{$client_2.get_access_token}.to raise_error(RuntimeError) end it "#token_expired return the different access_token after token is expired" do token_1 = $client.get_access_token if WeixinAuthorize.weixin_redis.nil? $client.expired_at = Time.now.to_i - 7300 else WeixinAuthorize.weixin_redis.del($client.redis_key) end token_2 = $client.get_access_token expect(token_1).to_not eq(token_2) end end end
33.272727
83
0.703552
fff71b2fb4a161b764e829b25d7690505d347e22
6,691
=begin #Selling Partner API for Fulfillment Inbound #The Selling Partner API for Fulfillment Inbound lets you create applications that create and update inbound shipments of inventory to Amazon's fulfillment network. OpenAPI spec version: v0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 3.0.33 =end require 'date' module AmzSpApi::FulfillmentInboundV0 # The response schema for the getPrepInstructions operation. class GetPrepInstructionsResponse attr_accessor :payload attr_accessor :errors # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'payload' => :'payload', :'errors' => :'errors' } end # Attribute type mapping. def self.openapi_types { :'payload' => :'Object', :'errors' => :'Object' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::FulfillmentInboundV0::GetPrepInstructionsResponse` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `AmzSpApi::FulfillmentInboundV0::GetPrepInstructionsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'payload') self.payload = attributes[:'payload'] end if attributes.key?(:'errors') self.errors = attributes[:'errors'] end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? true end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && payload == o.payload && errors == o.errors end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [payload, errors].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model AmzSpApi::FulfillmentInboundV0.const_get(type).build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end
30.834101
237
0.630548
f85e96bd8722a0e41b026c672b2e7e6a3553e659
357
class CreateDoctors < ActiveRecord::Migration def self.up create_table :doctors do |t| t.column :name, :string t.column :in_network, :boolean t.column :address, :string t.column :copay, :integer t.column :comments, :text t.column :specialty, :string end end def self.down drop_table :doctors end end
21
45
0.647059
ab36d82fabc6685f2b34e92afe6bd2f870fd1f67
517
# frozen_string_literal: true class Brokers::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
18.464286
69
0.73501
f820256ba7e2311f916f72c829b91f81ba81971f
54
module HerokuSsl module ApplicationHelper end end
10.8
26
0.814815
ed1e0e5b720f59501004365312e931773889153f
3,599
# -*- encoding: utf-8 -*- # stub: eventmachine 1.2.6 ruby lib # stub: ext/extconf.rbext/fastfilereader/extconf.rb Gem::Specification.new do |s| s.name = "eventmachine".freeze s.version = "1.2.6" s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Francis Cianfrocca".freeze, "Aman Gupta".freeze] s.date = "2018-04-30" s.description = "EventMachine implements a fast, single-threaded engine for arbitrary network\ncommunications. It's extremely easy to use in Ruby. EventMachine wraps all\ninteractions with IP sockets, allowing programs to concentrate on the\nimplementation of network protocols. It can be used to create both network\nservers and clients. To create a server or client, a Ruby program only needs\nto specify the IP address and port, and provide a Module that implements the\ncommunications protocol. Implementations of several standard network protocols\nare provided with the package, primarily to serve as examples. The real goal\nof EventMachine is to enable programs to easily interface with other programs\nusing TCP/IP, especially if custom protocols are required.\n".freeze s.email = ["[email protected]".freeze, "[email protected]".freeze] s.extensions = ["ext/extconf.rb".freeze, "ext/fastfilereader/extconf.rb".freeze] s.extra_rdoc_files = ["README.md".freeze, "docs/DocumentationGuidesIndex.md".freeze, "docs/GettingStarted.md".freeze, "docs/old/ChangeLog".freeze, "docs/old/DEFERRABLES".freeze, "docs/old/EPOLL".freeze, "docs/old/INSTALL".freeze, "docs/old/KEYBOARD".freeze, "docs/old/LEGAL".freeze, "docs/old/LIGHTWEIGHT_CONCURRENCY".freeze, "docs/old/PURE_RUBY".freeze, "docs/old/RELEASE_NOTES".freeze, "docs/old/SMTP".freeze, "docs/old/SPAWNED_PROCESSES".freeze, "docs/old/TODO".freeze] s.files = ["README.md".freeze, "docs/DocumentationGuidesIndex.md".freeze, "docs/GettingStarted.md".freeze, "docs/old/ChangeLog".freeze, "docs/old/DEFERRABLES".freeze, "docs/old/EPOLL".freeze, "docs/old/INSTALL".freeze, "docs/old/KEYBOARD".freeze, "docs/old/LEGAL".freeze, "docs/old/LIGHTWEIGHT_CONCURRENCY".freeze, "docs/old/PURE_RUBY".freeze, "docs/old/RELEASE_NOTES".freeze, "docs/old/SMTP".freeze, "docs/old/SPAWNED_PROCESSES".freeze, "docs/old/TODO".freeze, "ext/extconf.rb".freeze, "ext/fastfilereader/extconf.rb".freeze] s.homepage = "http://rubyeventmachine.com".freeze s.licenses = ["Ruby".freeze, "GPL-2.0".freeze] s.rdoc_options = ["--title".freeze, "EventMachine".freeze, "--main".freeze, "README.md".freeze, "-x".freeze, "lib/em/version".freeze, "-x".freeze, "lib/jeventmachine".freeze] s.rubygems_version = "2.5.2".freeze s.summary = "Ruby/EventMachine library".freeze s.installed_by_version = "2.5.2" if s.respond_to? :installed_by_version if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q<test-unit>.freeze, ["~> 2.0"]) s.add_development_dependency(%q<rake-compiler>.freeze, ["~> 0.9.5"]) s.add_development_dependency(%q<rake-compiler-dock>.freeze, ["~> 0.5.1"]) else s.add_dependency(%q<test-unit>.freeze, ["~> 2.0"]) s.add_dependency(%q<rake-compiler>.freeze, ["~> 0.9.5"]) s.add_dependency(%q<rake-compiler-dock>.freeze, ["~> 0.5.1"]) end else s.add_dependency(%q<test-unit>.freeze, ["~> 2.0"]) s.add_dependency(%q<rake-compiler>.freeze, ["~> 0.9.5"]) s.add_dependency(%q<rake-compiler-dock>.freeze, ["~> 0.5.1"]) end end
81.795455
781
0.729369
33f5491450749233d1e3389a64e0dd16b732c494
479
# WARNING ABOUT GENERATED CODE # # This file is generated. See the contributing guide for more information: # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md # # WARNING ABOUT GENERATED CODE module Aws::Batch class Resource # @param options ({}) # @option options [Client] :client def initialize(options = {}) @client = options[:client] || Client.new(options) end # @return [Client] def client @client end end end
19.16
74
0.665971
d5080ad0e5a8fdbecb8dd9ebf2a542d78553b635
964
Pod::Spec.new do |s| s.name = "QCButton" # 项目名称 s.version = "0.0.2" # 版本号 与 你仓库的 标签号 对应 s.license = "MIT" # 开源证书 s.license = { :type => "MIT", :file => "FILE_LICENSE" } s.summary = "这是一个可以调整Button图片显示方向的SDK" # 项目简介 s.description = <<-DESC QCButton可以调整Button图片显示方向的SDK DESC s.homepage = "https://github.com/aiyouBug/QCButton1" # 你的主页 s.source = { :git => "https://github.com/aiyouBug/QCButton1.git", :tag => "#{s.version}" }#你的仓库地址,不能用SSH地址 s.source_files = "Classes/QCButton/*.{h,m}" # 你代码的位置, Classes/*.{h,m} 表示 Classes 文件夹下所有的.h和.m文件 s.requires_arc = true # 是否启用ARC s.platform = :ios, "9.0" #平台及支持的最低版本 s.frameworks = "UIKit", "Foundation" #支持的框架 # s.dependency = "AFNetworking" # 依赖库 # User s.author = { "hqc" => "[email protected]" } # 作者信息 s.social_media_url = "https://github.com/aiyouBug" # 个人主页 end
43.818182
114
0.56639
abb17c5494bea2d1708681ed5367738571cad7a6
1,519
=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: [email protected] Generated by: https://openapi-generator.tech Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-Present Datadog, Inc. =end require 'spec_helper' require 'json' require 'date' # Unit tests for DatadogAPIClient::V1::LogsExclusion # Automatically generated by openapi-generator (https://openapi-generator.tech) # Please update as you see appropriate describe DatadogAPIClient::V1::LogsExclusion do let(:instance) { DatadogAPIClient::V1::LogsExclusion.new } describe 'test an instance of LogsExclusion' do it 'should create an instance of LogsExclusion' do expect(instance).to be_instance_of(DatadogAPIClient::V1::LogsExclusion) end end describe 'test attribute "filter"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "is_enabled"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "name"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end
30.38
107
0.750494
91d1f236bfe244471415e8b6544e36e47d65a5fa
2,001
#-- encoding: UTF-8 #-- copyright # OpenProject is a project management system. # Copyright (C) 2012-2018 the OpenProject Foundation (OPF) # # 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-2017 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. #++ module API module V3 module Types class TypeRepresenter < ::API::Decorators::Single self_link property :id property :name property :color, getter: -> (*) { color.hexcode if color }, render_nil: true property :position property :is_default property :is_milestone property :created_at, exec_context: :decorator, getter: -> (*) { datetime_formatter.format_datetime(represented.created_at) } property :updated_at, exec_context: :decorator, getter: -> (*) { datetime_formatter.format_datetime(represented.updated_at) } def _type 'Type' end end end end end
34.5
94
0.67916
18f66fe2e721e247a114150c1a7f442e5032befc
4,798
# encoding: UTF-8 # frozen_string_literal: true require_dependency 'authorization/bearer' class ApplicationController < ActionController::Base include Authorization::Bearer extend Memoist helper_method :current_user, :is_admin?, :current_market, :gon before_action :set_language, :set_gon private def current_market unless params[:market].blank? Market.enabled.find_by_id(params[:market]) end || Market.enabled.ordered.first end memoize :current_market def current_user if request.headers['Authorization'] token = request.headers['Authorization'] payload = authenticate!(token) Member.from_payload(payload) end end memoize :current_user def auth_member! unless current_user redirect_to root_path, alert: t('activations.new.login_required') end end def auth_anybody! redirect_to root_path if current_user end def auth_admin! redirect_to root_path unless is_admin? end def is_admin? current_user&.admin? end def set_gon gon.environment = Rails.env gon.local = I18n.locale gon.market = current_market.attributes gon.ticker = current_market.ticker gon.markets = Market.enabled.each_with_object({}) { |market, memo| memo[market.id] = market.as_json } gon.host = request.base_url gon.clipboard = { :click => I18n.t('actions.clipboard.click'), :done => I18n.t('actions.clipboard.done') } gon.i18n = { ask: I18n.t('gon.ask'), bid: I18n.t('gon.bid'), cancel: I18n.t('actions.cancel'), latest_trade: I18n.t('private.markets.order_book.latest_trade'), switch: { notification: I18n.t('private.markets.settings.notification'), sound: I18n.t('private.markets.settings.sound') }, notification: { title: I18n.t('gon.notification.title'), enabled: I18n.t('gon.notification.enabled'), new_trade: I18n.t('gon.notification.new_trade') }, time: { minute: I18n.t('chart.minute'), hour: I18n.t('chart.hour'), day: I18n.t('chart.day'), week: I18n.t('chart.week'), month: I18n.t('chart.month'), year: I18n.t('chart.year') }, chart: { price: I18n.t('chart.price'), volume: I18n.t('chart.volume'), open: I18n.t('chart.open'), high: I18n.t('chart.high'), low: I18n.t('chart.low'), close: I18n.t('chart.close'), candlestick: I18n.t('chart.candlestick'), line: I18n.t('chart.line'), zoom: I18n.t('chart.zoom'), depth: I18n.t('chart.depth'), depth_title: I18n.t('chart.depth_title') }, place_order: { confirm_submit: I18n.t('private.markets.show.confirm'), confirm_cancel: I18n.t('private.markets.show.cancel_confirm'), price: I18n.t('private.markets.place_order.price'), volume: I18n.t('private.markets.place_order.amount'), sum: I18n.t('private.markets.place_order.total'), price_high: I18n.t('private.markets.place_order.price_high'), price_low: I18n.t('private.markets.place_order.price_low'), full_bid: I18n.t('private.markets.place_order.full_bid'), full_ask: I18n.t('private.markets.place_order.full_ask') }, trade_state: { new: I18n.t('private.markets.trade_state.new'), partial: I18n.t('private.markets.trade_state.partial') } } gon.currencies = Currency.enabled.inject({}) do |memo, currency| memo[currency.code] = { code: currency.code, symbol: currency.symbol, isCoin: currency.coin? } memo end gon.display_currency = ENV.fetch('DISPLAY_CURRENCY') gon.fiat_currencies = Currency.enabled.ordered.fiats.codes gon.tickers = {} Market.enabled.each do |market| gon.tickers[market.id] = market.unit_info.merge(Global[market.id].ticker) end if current_user gon.user = { sn: current_user&.uid } gon.accounts = current_user.accounts.enabled.includes(:currency).inject({}) do |memo, account| memo[account.currency.code] = { currency: account.currency.code, balance: account.balance, locked: account.locked } if account.currency.try(:enabled) memo end end gon.bank_details_html = ENV['BANK_DETAILS_HTML'] gon.ranger_host = ENV["RANGER_HOST"] || '0.0.0.0' gon.ranger_port = ENV["RANGER_PORT"] || '8081' gon.ranger_connect_secure = ENV["RANGER_CONNECT_SECURE"] || false end def set_language cookies[:lang] = params[:lang] unless params[:lang].blank? cookies[:lang].tap do |locale| I18n.locale = locale if locale.present? && I18n.available_locales.include?(locale.to_sym) end end end
30.367089
105
0.642559
393cb73ffcbe9f471c12155c2c0f364a9a1859ff
142
class UserMailer < ApplicationMailer def reset_password(user) @user = user mail to: user.email, subject: 'Password reset' end end
20.285714
50
0.71831
1a94c4577148614223fc20d7181ab381bcfee874
1,999
require 'spec_helper' describe User do it { should validate_presence_of(:email) } it { should validate_presence_of(:password) } it 'is valid' do user = FactoryGirl.build(:user) expect(user).to be_valid end it 'is saved' do user = FactoryGirl.create(:user) expect(user).to be_persisted end context 'when already registered from a provider' do it 'gets the user from provider' do user = FactoryGirl.create(:user_twitter) user_got = User.from_oauth(user.provider, user.uid) expect(user_got.id).to eq(user.id) end end context 'when email from provider already exist' do it 'gets the user from email' do user = FactoryGirl.create(:user) user_got = User.from_oauth('twitter', '1', user.email) expect(user_got.id).to eq(user.id) end end context "when user from provider doesn't exist" do it 'creates a new user with temporary email' do user = User.from_oauth('twitter', '1') expect(user.email).to match(User::TEMP_EMAIL_REGEX) end it 'creates a new user with email received from profider' do email = '[email protected]' user = User.from_oauth('twitter', '1', email) expect(user.email).to match(email) end end context 'before create' do it 'creates a profile' do user = FactoryGirl.create(:user) expect(user.profile).to be_persisted end end context 'when destroying' do it 'destroys affiliated profile' do user = FactoryGirl.create(:user) profile = user.profile user.destroy expect(profile).not_to be_persisted end end context 'when there is only one admin' do it "can't be destroy" do user = FactoryGirl.create(:user_admin) user.destroy expect(user).to be_persisted end it "can't be set as not admin" do user = FactoryGirl.create(:user_admin) user.admin = false user.save user.reload expect(user.admin).to be true end end end
24.378049
64
0.66033
114d99843554f865926bcb26916c9ef248ba9e8d
69
# current version of gem module Auth0 VERSION = '5.5.0'.freeze end
13.8
26
0.710145
03fd6d8ad50b2ae4aef876346f5378217e21531d
338
require 'spec_helper' describe "Fetches" do it "bundler" do Dir.mktmpdir do |dir| Dir.chdir(dir) do fetcher = LanguagePack::Fetcher.new(LanguagePack::Base::VENDOR_URL) fetcher.fetch_untar("#{LanguagePack::Ruby::BUNDLER_GEM_PATH}.tgz") expect(`ls bin`).to match("bundle") end end end end
21.125
75
0.647929
1a0ec0b8d4abba4ba436b6b071f712596c4c771d
2,409
# encoding: UTF-8 require File.expand_path("helper", File.dirname(__FILE__)) require "lint/strings" class TestCommandsOnStrings < Test::Unit::TestCase include Helper::Client include Lint::Strings def test_mget r.set("foo", "s1") r.set("bar", "s2") assert_equal ["s1", "s2"] , r.mget("foo", "bar") assert_equal ["s1", "s2", nil], r.mget("foo", "bar", "baz") end def test_mget_mapped r.set("foo", "s1") r.set("bar", "s2") response = r.mapped_mget("foo", "bar") assert_equal "s1", response["foo"] assert_equal "s2", response["bar"] response = r.mapped_mget("foo", "bar", "baz") assert_equal "s1", response["foo"] assert_equal "s2", response["bar"] assert_equal nil , response["baz"] end def test_mapped_mget_in_a_pipeline_returns_hash r.set("foo", "s1") r.set("bar", "s2") result = r.pipelined do r.mapped_mget("foo", "bar") end assert_equal result[0], { "foo" => "s1", "bar" => "s2" } end def test_mset r.mset(:foo, "s1", :bar, "s2") assert_equal "s1", r.get("foo") assert_equal "s2", r.get("bar") end def test_mset_mapped r.mapped_mset(:foo => "s1", :bar => "s2") assert_equal "s1", r.get("foo") assert_equal "s2", r.get("bar") end def test_msetnx r.set("foo", "s1") assert_equal false, r.msetnx(:foo, "s2", :bar, "s3") assert_equal "s1", r.get("foo") assert_equal nil, r.get("bar") r.del("foo") assert_equal true, r.msetnx(:foo, "s2", :bar, "s3") assert_equal "s2", r.get("foo") assert_equal "s3", r.get("bar") end def test_msetnx_mapped r.set("foo", "s1") assert_equal false, r.mapped_msetnx(:foo => "s2", :bar => "s3") assert_equal "s1", r.get("foo") assert_equal nil, r.get("bar") r.del("foo") assert_equal true, r.mapped_msetnx(:foo => "s2", :bar => "s3") assert_equal "s2", r.get("foo") assert_equal "s3", r.get("bar") end def test_bitop target_version "2.5.10" do r.set("foo", "a") r.set("bar", "b") r.bitop(:and, "foo&bar", "foo", "bar") assert_equal "\x60", r.get("foo&bar") r.bitop(:or, "foo|bar", "foo", "bar") assert_equal "\x63", r.get("foo|bar") r.bitop(:xor, "foo^bar", "foo", "bar") assert_equal "\x03", r.get("foo^bar") r.bitop(:not, "~foo", "foo") assert_equal "\x9E", r.get("~foo") end end end
24.09
67
0.575342
212653224e9f77de89f07d39d55b180a9a9e78d6
156
# encoding: utf-8 require 'spec/expectations' require 'cucumber/formatter/unicode' $:.unshift(File.dirname(__FILE__) + '/../../lib') require 'kalkulator'
22.285714
50
0.717949
33705eb12b6ccd6b4f286f168243e62a625bd117
1,444
class InvalidHerokuGovernatorConfigError < StandardError def initialize(msg) super end end module HerokuJobGovernator class Config attr_accessor :queue_adapter, :workers, :default_worker REQUIRED_SETTINGS = %i[queue_adapter workers default_worker].freeze REQUIRED_WORKER_SETTINGS = %i[workers_min workers_max max_enqueued_per_worker queue_name].freeze SUPPORTED_ADAPTERS = [ HerokuJobGovernator::DELAYED_JOB, HerokuJobGovernator::SIDEKIQ, HerokuJobGovernator::RESQUE, ].freeze def validate! errors = [] missing_settings = REQUIRED_SETTINGS.select { |setting| send(setting).nil? } errors << "Missing required settings: #{missing_settings.join(', ')}" if missing_settings.any? errors << "workers incorrectly formatted. See README for configuration details." unless valid_workers? unless queue_adapter.nil? || SUPPORTED_ADAPTERS.include?(queue_adapter.to_sym) errors << "Unsupported queue_adaptor. Must be one of: #{SUPPORTED_ADAPTERS.join(', ')}" end if errors.any? raise InvalidHerokuGovernatorConfigError, "Heroku Config problems: #{errors.join('; ')}" end true end private def valid_workers? return true if workers.nil? return false unless workers.is_a?(Hash) workers.all? do |_k, v| v.is_a?(Hash) && v.keys.sort == REQUIRED_WORKER_SETTINGS.sort end end end end
30.083333
108
0.702216
625baefe6b288579035a94aa934458511ec0ff6c
367
require_relative "test_helper" describe "CHANGELOG" do it "should have an entry for the current version" do changelog_contents = File.read(File.expand_path("../CHANGELOG.md", __dir__)) assert_match( /^#+\s*#{Regexp.escape(Slimmer::VERSION)}/, changelog_contents, "No entry for #{Slimmer::VERSION} found in CHANGELOG.md", ) end end
26.214286
80
0.683924
1cdf6bc89cab1a6081e64359bfe4f1c04ce6fa62
1,451
# frozen_string_literal: true Encoding.default_external = 'UTF-8' require_relative '../lib/gitlab' require_relative '../lib/gitlab/utils' require_relative '../config/initializers/0_inject_enterprise_edition_module' require_relative 'lib/gitlab' require_relative '../config/bundler_setup' Bundler.require(:default) module QA root = "#{__dir__}/qa" loader = Zeitwerk::Loader.new loader.push_dir(root, namespace: QA) loader.ignore("#{root}/specs/features") loader.inflector.inflect( "ce" => "CE", "ee" => "EE", "api" => "API", "ssh" => "SSH", "ssh_key" => "SSHKey", "ssh_keys" => "SSHKeys", "ecdsa" => "ECDSA", "ed25519" => "ED25519", "rsa" => "RSA", "ldap" => "LDAP", "ldap_tls" => "LDAPTLS", "ldap_no_tls" => "LDAPNoTLS", "ldap_no_server" => "LDAPNoServer", "rspec" => "RSpec", "web_ide" => "WebIDE", "ci_cd" => "CiCd", "project_imported_from_url" => "ProjectImportedFromURL", "repo_by_url" => "RepoByURL", "oauth" => "OAuth", "saml_sso_sign_in" => "SamlSSOSignIn", "saml_sso_sign_up" => "SamlSSOSignUp", "group_saml" => "GroupSAML", "instance_saml" => "InstanceSAML", "saml_sso" => "SamlSSO", "ldap_sync" => "LDAPSync", "ip_address" => "IPAddress", "gpg" => "GPG", "user_gpg" => "UserGPG", "smtp" => "SMTP", "otp" => "OTP", "jira_api" => "JiraAPI", "registry_tls" => "RegistryTLS" ) loader.setup end
24.59322
76
0.604411
ffc72cebaa6caf52fa80b41790c1680a8c9e4206
136
class AddCustombbfeeToInstances < ActiveRecord::Migration[5.0] def change add_column :instances, :custom_bb_fee, :float end end
22.666667
62
0.772059
e857f931a065460f4561e6b3f677cb8dbb4eb124
1,261
# frozen_string_literal require 'spec_helper' 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 'rspec/rails' begin ActiveRecord::Migration.maintain_test_schema! rescue ActiveRecord::PendingMigrationError => e puts e.to_s.strip exit 1 end RSpec.configure do |config| # 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") end
31.525
86
0.746233
3974e7d4ebb69e9976a55d7b05813a1cfd363a60
215
class AddIndicesToSipityAdditionalAttributes < ActiveRecord::Migration[4.2] def change add_index :sipity_additional_attributes, :work_id add_index :sipity_additional_attributes, [:work_id, :key] end end
30.714286
75
0.8
ab41e7095759002f63eb10c85f4ad23ae0b51eea
2,315
module Intrigue module Task class WordpressEnumeratePlugins < BaseTask def self.metadata { :name => "wordpress_enumerate_plugins", :pretty_name => "Wordpress Enumerate Plugins", :authors => ["jcran"], :description => "If the target's running Wordpress, this'll enumerate the plugins", :references => [], :type => "discovery", :passive => false, :allowed_types => ["Uri"], :example_entities => [{"type" => "Uri", "details" => {"name" => "https://intrigue.io"}}], :allowed_options => [ { :name => "use_extended_list", :regex => "boolean", :default => false }, { :name => "threads", :regex => "integer", :default => 5 } ], :created_types => [] } end def run super uri = _get_entity_name # First just get the easy stuff _set_entity_detail("wordpress_plugins", get_wordpress_parsable_plugins(uri) ) # Then, attempt to brute _set_entity_detail("wordpress_bruted_plugins", brute_wordpress_plugin_paths(uri) ) end # end run() def brute_wordpress_plugin_paths(uri) if _get_option("use_extended_list") _log "Using extended list" file_path = "#{$intrigue_basedir}/data/tech/wordpress_plugins.list" else _log "Using short list" file_path = "#{$intrigue_basedir}/data/tech/wordpress_plugins.short.list" end # add wordpress plugins list from a file work_q = Queue.new File.open(file_path,"r").each_line do |l| next if l =~ /^#/ work_q.push({ path: "#{l.strip}/" , severity: 5, body_regex: nil, status: "potential" }) work_q.push({ path: "#{l.strip}/readme.txt" , severity: 5, body_regex: /Contributors:/i, status: "confirmed" }) end # then make the requests thread_count = _get_option("threads") || 5 results = make_http_requests_from_queue(uri, work_q, thread_count, false, false) # always create an issue _log "Got matches: #{results}" results end def get_wordpress_parsable_plugins(uri) body = http_get_body "#{uri}/wp-json" begin parsed = JSON.parse body rescue JSON::ParserError _log_error "Unable to parse!" end return nil unless parsed plugins = (parsed["namespaces"] || []).uniq.map{|x| x.gsub("\\","") } end end end end
28.580247
118
0.63067
5d44ba6e697d0a4d3bd93f98345d3fc8926d08b5
4,021
module Doorkeeper module AccessTokenMixin extend ActiveSupport::Concern include OAuth::Helpers include Models::Expirable include Models::Revocable include Models::Accessible include Models::Scopes included do belongs_to :application, class_name: 'Doorkeeper::Application', inverse_of: :access_tokens validates :token, presence: true, uniqueness: true validates :refresh_token, uniqueness: true, if: :use_refresh_token? attr_writer :use_refresh_token if ::Rails.version.to_i < 4 || defined?(::ProtectedAttributes) attr_accessible :application_id, :resource_owner_id, :expires_in, :scopes, :use_refresh_token end before_validation :generate_token, on: :create before_validation :generate_refresh_token, on: :create, if: :use_refresh_token? end module ClassMethods def by_token(token) where(token: token).limit(1).to_a.first end def by_refresh_token(refresh_token) where(refresh_token: refresh_token).first end def revoke_all_for(application_id, resource_owner) where(application_id: application_id, resource_owner_id: resource_owner.id, revoked_at: nil). map(&:revoke) end def matching_token_for(application, resource_owner_or_id, scopes) resource_owner_id = if resource_owner_or_id.respond_to?(:to_key) resource_owner_or_id.id else resource_owner_or_id end token = last_authorized_token_for(application.try(:id), resource_owner_id) if token && scopes_match?(token.scopes, scopes, application.try(:scopes)) token end end def scopes_match?(token_scopes, param_scopes, app_scopes) (!token_scopes.present? && !param_scopes.present?) || Doorkeeper::OAuth::Helpers::ScopeChecker.match?( token_scopes.to_s, param_scopes, app_scopes ) end def find_or_create_for(application, resource_owner_id, scopes, expires_in, use_refresh_token) if Doorkeeper.configuration.reuse_access_token access_token = matching_token_for(application, resource_owner_id, scopes) if access_token && !access_token.expired? return access_token end end create!( application_id: application.try(:id), resource_owner_id: resource_owner_id, scopes: scopes.to_s, expires_in: expires_in, use_refresh_token: use_refresh_token ) end def last_authorized_token_for(application_id, resource_owner_id) where(application_id: application_id, resource_owner_id: resource_owner_id, revoked_at: nil). send(order_method, created_at_desc). limit(1). to_a. first end end def token_type 'bearer' end def use_refresh_token? !!@use_refresh_token end def as_json(_options = {}) { resource_owner_id: resource_owner_id, scopes: scopes, expires_in_seconds: expires_in_seconds, application: { uid: application.try(:uid) }, created_at: created_at.to_i, } end # It indicates whether the tokens have the same credential def same_credential?(access_token) application_id == access_token.application_id && resource_owner_id == access_token.resource_owner_id end def acceptable?(scopes) accessible? && includes_scope?(*scopes) end private def generate_refresh_token write_attribute :refresh_token, UniqueToken.generate end def generate_token self.token = UniqueToken.generate end end end
29.785185
99
0.621736
0357032c671b92022411adceba89b8ad87c427b6
7,899
require 'download_utils' RSpec.describe ActiveStorage::Service::CloudinaryService do let(:subject) { ActiveStorage::Service::CloudinaryService.new(config) } let(:key) { 'some-resource-key' } let(:file) { double } let(:download_util) { double } let(:checksum) { 'zyxddfs' } let(:config) do { cloud_name: 'name', api_key: 'abcde', api_secret: '12345' } end before do stub_const('Cloudinary', DummyCloudinary) allow(file).to receive(:extension_with_delimiter).and_return('.png') end include_examples 'download utils' describe '#new' do it 'setups cloudinary sdk with the given config' do ActiveStorage::Service::CloudinaryService.new(config) config.each do |key, value| expect(Cloudinary.send(key)).to eq value end end it 'allows extra params' do xtra = { upload_preset: 'some-preset', cname: 'some-cname' } ActiveStorage::Service::CloudinaryService.new(config.merge(xtra)) xtra.each do |key, value| expect(Cloudinary.send(key)).to eq value end end end describe '#upload' do it 'calls the upload method on the cloudinary sdk with the given args' do expect(Cloudinary::Uploader) .to receive(:upload).with(file, public_id: key, resource_type: 'auto') subject.upload(key, file) end it 'instruments the operation' do options = { key: key, checksum: checksum } expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:upload, options) subject.upload(key, file, checksum: checksum) end end describe '#download' do context 'when block is given' do it 'calls the stream_download method' do block = -> { 'some block' } expect(subject).to receive(:stream_download) .with('https://some-resource-key') { |&blk| expect(blk).to be(block) } expect(Cloudinary::Downloader).not_to receive(:download) subject.download(key, &block) end end context 'when no block is given' do it 'calls the cloudinary downloader download method' do source = DummyCloudinary::Utils.cloudinary_url(key, sign_url: true) expect(Cloudinary::Downloader).to receive(:download).with(source) expect(subject).not_to receive(:stream_download) subject.download(key) end end it 'instruments the operation' do options = { key: key } expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:download, options) subject.download(key) end end describe '#download_chunk' do let(:range) { 1..10 } it 'calls the download range method' do expect(subject).to receive(:download_range) .with('https://some-resource-key', range) subject.download_chunk(key, range) end it 'instruments the operation' do options = { key: key, range: range } expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:download_chunk, options) subject.download_chunk(key, range) end end describe '#delete' do it 'calls the delete method on the cloudinary sdk with the given args' do expect(Cloudinary::Uploader).to receive(:destroy).with(key) subject.delete(key) end it 'instruments the operation' do options = { key: key } expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:delete, options) subject.delete(key) end end describe '#delete_prefixed' do let(:prefix) { 'some-key-prefix' } it 'calls the delete_resources_by_prefix method on the cloudinary sdk' do expect(Cloudinary::Api) .to receive(:delete_resources_by_prefix) .with(prefix) .and_return('resources' => []) subject.delete_prefixed(prefix) end it 'instruments the operation' do options = { prefix: key } expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:delete_prefixed, options) subject.delete_prefixed(key) end end describe '#exist?' do it 'calls the resources methods on the cloundinary sdk with the given args' do expect(Cloudinary::Api) .to receive(:resources_by_ids).with(key).and_return('resources' => []) subject.exist?(key) end it 'returns true if a resource exists with the given key' do allow(Cloudinary::Api) .to receive(:resources_by_ids).with(key).and_return('resources' => [1]) expect(subject.exist?(key)).to be true end it 'returns false if no resource exists with the given key' do allow(Cloudinary::Api) .to receive(:resources_by_ids).with(key).and_return('resources' => []) expect(subject.exist?(key)).to be false end it 'instruments the operation' do options = { key: key } expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:exist?, options) subject.exist?(key) end end describe '#url' do let(:options) do { expires_in: 1000, disposition: 'inline', filename: file, content_type: 'image/png' } end let(:signed_options) do { resource_type: 'image', type: 'upload', attachment: false } end it 'calls the private_download_url on the cloudinary sdk' do expect(Cloudinary::Utils) .to receive(:private_download_url) .with(key, 'png', hash_including(signed_options)) subject.url(key, options) end context 'raw type assets' do before do allow(file).to receive(:extension_with_delimiter).and_return('.docx') end it 'includes the asset format in the public key' do expected = signed_options.merge(resource_type: 'raw') expect(Cloudinary::Utils) .to receive(:private_download_url) .with(key + '.docx', 'docx', hash_including(expected)) subject.url(key, options) end end context 'non raw type assets' do it 'does not include the asset format in the public key' do expect(Cloudinary::Utils) .to receive(:private_download_url) .with(key, 'png', hash_including(signed_options)) subject.url(key, options) end end it 'instruments the operation' do expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:url, key: key) subject.url(key, options) end end describe '#url_for_direct_upload' do let(:options) do { expires_in: 1000, content_type: 'image/png', content_length: 123_456_789, checksum: checksum } end let(:signed_options) do { resource_type: 'auto', type: 'upload', attachment: false } end it 'calls the private_download_url on the cloudinary sdk' do expect(Cloudinary::Utils) .to receive(:private_download_url) .with(key, '', hash_including(signed_options)) .and_return("https://cloudinary.api/signed/url/for/#{key}/") subject.url_for_direct_upload(key, options) end it 'instruments the operation' do expect_any_instance_of(ActiveStorage::Service) .to receive(:instrument).with(:url_for_direct_upload, key: key) subject.url_for_direct_upload(key, options) end end describe '#headers_for_direct_upload' do it 'returns header info for the content_type and unique id' do options = { filename: 'some-file-name', content_type: 'image/png', content_length: 1_234_567, checksum: checksum } exp_result = { 'Content-Type' => options[:content_type], 'X-Unique-Upload-Id' => key } expect( subject.headers_for_direct_upload(key, options) ).to eq exp_result end end end
28.11032
82
0.644639
ab50d40cf44265e21bcede8de1fdb86cdffce2cf
428
ENV['RACK_ENV'] = 'test' require 'minitest/autorun' require 'minitest/color' require 'rack/test' require 'sequel' require 'sinatra' DB = Sequel.connect( adapter: 'postgres', database: 'vocational-test_test', host: 'testdb', user: 'unicorn', password: 'magic') class Minitest::HooksSpec def around DB.transaction(:rollback=>:always, :auto_savepoint=>true){super} end end require File.expand_path './app.rb'
23.777778
68
0.71028
182c566df9c5faaf23b473aee55c06dacc113f17
116
class AddModeToCategory < ActiveRecord::Migration def change add_column :categories, :mode, :string end end
19.333333
49
0.758621
e21b7549b3c01685c32bf0f8df70ee5908b3b0b8
1,232
# frozen_string_literal: true # Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! # [START cloudtasks_v2beta3_generated_CloudTasks_GetTask_sync] require "google/cloud/tasks/v2beta3" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Tasks::V2beta3::CloudTasks::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Tasks::V2beta3::GetTaskRequest.new # Call the get_task method. result = client.get_task request # The returned object is of type Google::Cloud::Tasks::V2beta3::Task. p result # [END cloudtasks_v2beta3_generated_CloudTasks_GetTask_sync]
36.235294
74
0.778409
e871f14255e72847cf488f6801d0641380ab782f
614
require "rails_helper" RSpec.describe Section do [:name, :description, :image, :item_id, :order, :caption, :showcase, :item, :updated_at, :created_at].each do |field| it "has the field #{field}" do expect(subject).to respond_to(field) expect(subject).to respond_to("#{field}=") end end [:showcase].each do |field| it "requires the field, #{field}" do expect(subject).to have(1).error_on(field) end end it "has a papertrail" do expect(subject).to respond_to(:paper_trail_enabled_for_model?) expect(subject.paper_trail_enabled_for_model?).to be(true) end end
27.909091
119
0.684039
39068027ee454aeba50cbed7fa5a6dbd8e0467a8
46
module PlaybillGemCli VERSION = "0.1.0" end
11.5
21
0.717391
621e8543e15a6658c3a929d787413b56e9908172
7,650
=begin PureCloud Platform API With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more. OpenAPI spec version: v2 Contact: [email protected] Generated by: https://github.com/swagger-api/swagger-codegen.git License: ININ http://www.inin.com Terms of Service: https://developer.mypurecloud.com/tos =end require 'date' module PureCloud class DomainResourceConditionNode attr_accessor :variable_name attr_accessor :operator attr_accessor :operands attr_accessor :conjunction attr_accessor :terms # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'variable_name' => :'variableName', :'operator' => :'operator', :'operands' => :'operands', :'conjunction' => :'conjunction', :'terms' => :'terms' } end # Attribute type mapping. def self.swagger_types { :'variable_name' => :'String', :'operator' => :'String', :'operands' => :'Array<DomainResourceConditionValue>', :'conjunction' => :'String', :'terms' => :'Array<DomainResourceConditionNode>' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes.has_key?(:'variableName') self.variable_name = attributes[:'variableName'] end if attributes.has_key?(:'operator') self.operator = attributes[:'operator'] end if attributes.has_key?(:'operands') if (value = attributes[:'operands']).is_a?(Array) self.operands = value end end if attributes.has_key?(:'conjunction') self.conjunction = attributes[:'conjunction'] end if attributes.has_key?(:'terms') if (value = attributes[:'terms']).is_a?(Array) self.terms = value end end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properies with the reasons def list_invalid_properties invalid_properties = Array.new return invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? allowed_values = ["EQ", "IN", "GE", "GT", "LE", "LT"] if @operator && !allowed_values.include?(@operator) return false end allowed_values = ["AND", "OR"] if @conjunction && !allowed_values.include?(@conjunction) return false end end # Custom attribute writer method checking allowed values (enum). # @param [Object] operator Object to be assigned def operator=(operator) allowed_values = ["EQ", "IN", "GE", "GT", "LE", "LT"] if operator && !allowed_values.include?(operator) fail ArgumentError, "invalid value for 'operator', must be one of #{allowed_values}." end @operator = operator end # Custom attribute writer method checking allowed values (enum). # @param [Object] conjunction Object to be assigned def conjunction=(conjunction) allowed_values = ["AND", "OR"] if conjunction && !allowed_values.include?(conjunction) fail ArgumentError, "invalid value for 'conjunction', must be one of #{allowed_values}." end @conjunction = conjunction end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && variable_name == o.variable_name && operator == o.operator && operands == o.operands && conjunction == o.conjunction && terms == o.terms end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash [variable_name, operator, operands, conjunction, terms].hash end # build the object from hash def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) else #TODO show warning in debug mode end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) else # data not found in attributes(hash), not an issue as the data can be optional end end self end def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /^(true|t|yes|y|1)$/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model _model = Object.const_get("PureCloud").const_get(type).new _model.build_from_hash(value) end end def to_s to_hash.to_s end # to_body is an alias to to_body (backward compatibility)) def to_body to_hash end # return the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end # Method to output non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value def _to_hash(value) if value.is_a?(Array) value.compact.map{ |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end
22.904192
177
0.56183
037ba013c9a7fb107ba1fd607418f580e6f1e9c5
2,516
require File.dirname(__FILE__) + '/test_helper' class MyHighlightingObject include Widgets::Highlightable end class HighlightableTest < Test::Unit::TestCase EXPECTED_INSTANCE_METHODS = %w{highlights highlights= highlighted? highlights_on} def setup @obj = MyHighlightingObject.new end def test_included_methods EXPECTED_INSTANCE_METHODS.each do |method| assert @obj.respond_to?(method), "An Highlightable object should respond to '#{method}'" end end def test_accessor assert_equal [], @obj.highlights, 'should return an empty array' end def test_highlights_on @obj.highlights=[ {:action => 'my_action'}, {:action => 'my_action2', :controller => 'my_controller'}] assert @obj.highlights.kind_of?(Array) assert_equal 2, @obj.highlights.size, '2 highlights were added so far' @obj.highlights.each {|hl| assert hl.kind_of?(Hash)} # sanity check assert_equal 'my_action',@obj.highlights[0][:action] end def test_highlights_on_proc @bonus_points = 0 @obj.highlights_on proc {@bonus_points > 5} assert [email protected]?, 'should not highlight until @bonus_points is greater than 5' @bonus_points = 10 assert @obj.highlighted?, 'should highlight because @bonus_points is greater than 5' end def test_highlight_on_string @obj.highlights_on "http://www.seesaw.it" end def test_highlighted? @obj.highlights_on :controller => 'pippo' #check that highlights on its own link assert @obj.highlighted?(:controller => 'pippo'), 'should highlight' assert @obj.highlighted?(:controller => 'pippo', :action => 'list'), 'should highlight' assert [email protected]?(:controller => 'pluto', :action => 'list'), 'should NOT highlight' end def test_more_highlighted? # add some other highlighting rules # and check again @obj.highlights=[{:controller => 'pluto'}] assert @obj.highlighted?(:controller => 'pluto'), 'should highlight' @obj.highlights << {:controller => 'granny', :action => 'oyster'} assert @obj.highlighted?(:controller => 'granny', :action => 'oyster'), 'should highlight' assert [email protected]?(:controller => 'granny', :action => 'daddy'), 'should NOT highlight' end def test_highlighted_with_slash @obj.highlights_on :controller => '/pippo' assert @obj.highlighted?({:controller => 'pippo'}) end end
33.105263
107
0.662957
d56b21bebc3f50b5e205ae0eca410159515368f9
1,748
# frozen_string_literal: true require("config") require("data_structures/linked_list") require("ctci/ctci_c2_p6") module CTCI module C2 class TestP6 < Minitest::Test LinkedList = DataStructures::LinkedList.dup.class_exec { include(P6) } def setup @list = LinkedList.new @loop = LinkedList.new end def test_find_loop 1.upto(3) { |n| @list.append(n) } 4.upto(11) { |n| @loop.append(n) } join(@list, @loop) expected = make_loop(@loop) # 1,2,3,4,5,6,7,8,9,10,11,4,5,6... assert_equal(expected.data, @list.find_loop.data) end def test_find_loop_front @list.append(1) expected = make_loop(@list) # 1,1,1... assert_equal(expected, @list.find_loop) end def test_find_loop_single 1.upto(3) { |n| @list.append(n) } @loop.append(4) join(@list, @loop) expected = make_loop(@loop) assert_equal(expected, @list.find_loop) end def test_find_loop_empty assert_nil(@list.find_loop) end def test_find_loop_nonexistent 1.upto(3) { |n| @list.append(n) } assert_nil(@list.find_loop) end def test_find_loop_nonexistent_single @list.append(1) assert_nil(@list.find_loop) end private def join(first, second) first_tail = first.instance_variable_get(:@tail) second_head = second.instance_variable_get(:@head).next first_tail.next = second_head end def make_loop(list) head = list.instance_variable_get(:@head).next tail = list.instance_variable_get(:@tail) tail.next = head head end end end end
23
70
0.597826
218c168767e63f81e935a5aaba603b53d0e7a2e3
1,932
require 'set' require 'warp/dir/errors' require 'warp/dir/formatter' require 'singleton' module Warp module Dir class Commander include Singleton attr_reader :commands attr_accessor :command_map def initialize @commands ||= Set.new # a pre-caution, normally it would already by defined by now @command_map = {} end def register(command) @commands << command if command self end def installed_commands @commands.map(&:command_name) end def lookup(command_name) reindex! command_map[command_name] end def find(command_name) command = lookup(command_name) if command.nil? raise ::Warp::Dir::Errors::InvalidCommand.new(command_name) end command end def run(command_name, *args) cmd = find command_name raise ::Warp::Dir::Errors::InvalidCommand.new(command_name) unless cmd.is_a?(warp::Dir::Command) cmd.new(*args).run end def reindex! commands.each do |command| if command.respond_to?(:aliases) command.aliases.each do |an_alias| if self.command_map[an_alias] && !self.command_map[an_alias] == command raise Warp::Dir::Errors::InvalidCommand.new("Duplicate alias for command #{command}") end self.command_map[an_alias] = command end end self.command_map[command.command_name] = command end self end def validate! self.commands.delete_if do |subclass| if !subclass.respond_to?(:abstract_class?) && !subclass.method_defined?(:run) raise ::Warp::Dir::Errors::InvalidCommand.new(subclass) end subclass.respond_to?(:abstract_class?) || !subclass.method_defined?(:run) end end end end end
26.833333
104
0.600932
b9b171b01b86c83bfe209ff3fd560b363aeb8f94
402
ENV['RAILS_ENV'] ||= 'testrailrali' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require "minitest/reporters" Minitest::Reporters.use! class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all include ApplicationHelper # Add more helper methods to be used by all tests here... end
28.714286
82
0.758706
1d45b20513f6300a11a946127cc1cf8d64d59494
5,502
require "banter/errors" require "banter/query" require "thread_safe" module Banter class Channel attr_reader :name, :prefix alias_method :to_s, :name alias_method :to_str, :to_s # Public: Initializes the channel. # # name - The channel name String. # network - The Banter::Network. def initialize(name, network) @name, @prefix, @network = name, name[0], network # Convenience. @commands = network.implementation::Commands @constants = network.implementation::Constants @replies = network.implementation::REPLIES end def privmsg(message) @network << @commands.privmsg(self.name, message) end def notice(message) @network << @commands.notice(self.name, message) end # Public: Gets the channel modes. # # Returns a Hash. def modes replies = @replies[:channel_mode].dup replies.delete(:end) query = Query.new replies messages = replies_for(query) { @commands.mode(self.name) } return @network.implementation::Modes.new(*messages) end # Public: Looks up a channel mode. # # mode - A mode Symbol. # # Returns `true`/`false` for set/unset modes, a String for set modes with a # parameter and an Array of mask Strings for set modes "b", "e" and "I". def [](mode) case mode.to_s when "b", "e", "I" then return masks_list(mode) else return self.modes[mode] end end # TODO: Removing bans, ban exception and invite exceptions is impossible. # Public: Sets a mode. Use `true`/`false` to set/unset modes. # # mode - A mode Symbol. # parameter - A parameter String, true or false. def []=(mode, parameter) replies = @replies[:channel_mode].dup replies.delete(:end) query = Query.new replies messages = replies_for(query) do if parameter == true param = nil elsif parameter == false param = false mode = :"-#{mode}" else param = parameter end @commands.mode(self.name, mode, param) end modes = @network.implementation::Modes.new(*messages) unless modes[mode] == parameter raise Banter::ErrorReply.new("setting mode failed", 0) end end # Public: Gets the topic. # # Returns a String if there is a topic or `nil` if there is no topic. def topic query = Query.new @replies[:topic] messages = replies_for(query) { @commands.topic(self.name) } message = messages.first case message.command when @constants::RPL_NOTOPIC then return nil when @constants::RPL_TOPIC then return message.trail end end # Public: Sets the topic. # # topic - An object implementing #to_s. def topic=(topic) query = Query.new @replies[:topic] replies_for(query) { @commands.topic(self.name, topic) } return true end # Public: Gets the nicknames of users on the channel. If a `status` argument # is given it returns only the users with that status on the channel. If no # `status` argument is given it returns all users. # # status - A prefix Symbol such as `:@` or `:+` (default: nil). # # Returns an Array of nickname Strings. def names(status = nil) query = Query.new @replies[:names] msgs = replies_for(query) { @commands.names(self.name) } names = msgs.select do |msg| if msg.params[2].nil? msg.params[1][1..-1] == self.name else msg.params[2] == self.name end end.map { |m| m.trail.split }.flatten if status.nil? # Nicknames may start with a letter or a "special". # nickname = A-Z a-z # special = [ ] \ ` _ ^ { | } names.map { |nick| nick[/^[^a-zA-Z\[\]\\`_\^{|}]/] ? nick[1..-1] : nick } else names.select { |nick| nick[0] == status } .map { |nick| nick[1..-1] } end end # Public: Invites a user to channel. # # user - An object implementing #to_s. # # Returns `true` or `false`. def invite(user) query = Query.new @replies[:invite] messages = replies_for(query) do @commands.invite(user, self.name) end return case messages.first.command when @constants::RPL_INVITING then true when @constants::RPL_AWAY then false end end # Public: Kicks a user of the channel. # # user - An object implementing #to_s. # reason - An object implementing #to_s (default: nil). # # Returns true. def kick(user, reason = nil) query = Query.new @replies[:kick] replies_for(query) { @commands.kick(self.name, user, reason) } return true end private # Internal: Registers the query as a plugin with the network, sends the # result of block to the network and unregsiters the query as a plugin. # # query - A Banter::Query. def replies_for(query) @network.register(query) if block_given? @network << yield end return query.messages ensure @network.unregister(query) end def masks_list(mode) query = Query.new(@replies[:channel_mode]) messages = replies_for(query) { @commands.mode(self.name, mode) } return @network.implementation::Modes.new(*messages)[mode] end end end
27.373134
81
0.594511
3837a6775c38105d2f19d1e3612f27ade0a2f251
2,007
=begin #DPN API #Digital Preservation Network OpenAPI spec version: 2.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git 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. =end require 'spec_helper' require 'json' require 'date' # Unit tests for SwaggerClient::IngestResultList # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'IngestResultList' do before do # run before each test @instance = SwaggerClient::IngestResultList.new end after do # run after each test end describe 'test an instance of IngestResultList' do it 'should create an instact of IngestResultList' do expect(@instance).to be_instance_of(SwaggerClient::IngestResultList) end end describe 'test attribute "count"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "_next"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "previous"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end describe 'test attribute "results"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end
27.875
103
0.742402
d5a79ad72d827900667c1269fb5790f6214a2668
3,071
# frozen_string_literal: true module SCA class LicenseCompliance include ::Gitlab::Utils::StrongMemoize SORT_DIRECTION = { asc: -> (items) { items }, desc: -> (items) { items.reverse } }.with_indifferent_access def initialize(project, pipeline) @project = project @pipeline = pipeline end def policies strong_memoize(:policies) do unclassified_policies.merge(known_policies).sort.map(&:last) end end def find_policies(detected_only: false, classification: [], sort: { by: :name, direction: :asc }) classifications = Array(classification || []) matching_policies = policies.reject do |policy| (detected_only && policy.dependencies.none?) || (classifications.present? && !policy.classification.in?(classifications)) end sort_items(items: matching_policies, by: sort&.dig(:by), direction: sort&.dig(:direction)) end def latest_build_for_default_branch return if pipeline.blank? strong_memoize(:latest_build_for_default_branch) do pipeline.builds.latest.license_scan.last end end def report_for(policy) build_policy(license_scan_report[policy.software_license.canonical_id], policy) end def diff_with(other) license_scan_report .diff_with(other.license_scan_report) .transform_values do |reported_licenses| reported_licenses.map do |reported_license| matching_license_policy = known_policies[reported_license.canonical_id] || known_policies[reported_license&.name&.downcase] build_policy(reported_license, matching_license_policy) end end end def license_scan_report strong_memoize(:license_scan_report) do pipeline.blank? ? empty_report : pipeline.license_scanning_report end end private attr_reader :project, :pipeline def known_policies return {} if project.blank? strong_memoize(:known_policies) do project.software_license_policies.including_license.unreachable_limit.map do |policy| [policy.software_license.canonical_id, report_for(policy)] end.to_h end end def unclassified_policies license_scan_report.licenses.map do |reported_license| next if known_policies[reported_license.canonical_id] [reported_license.canonical_id, build_policy(reported_license, nil)] end.compact.to_h end def empty_report ::Gitlab::Ci::Reports::LicenseScanning::Report.new end def build_policy(reported_license, software_license_policy) ::SCA::LicensePolicy.new(reported_license, software_license_policy) end def sort_items(items:, by:, direction:, available_attributes: ::SCA::LicensePolicy::ATTRIBUTES) attribute = available_attributes[by] || available_attributes[:name] direction = SORT_DIRECTION[direction] || SORT_DIRECTION[:asc] direction.call(items.sort_by { |item| attribute.call(item) }) end end end
30.71
101
0.69326
d5bfddb99b1744e70d070d623604d72d7c880fe9
395
class UserPolicy < ApplicationPolicy def lockable? return false unless role = user.person && user.person.hbx_staff_role return false unless role.permission role.permission.can_lock_unlock end def reset_password? return false unless role = user.person && user.person.hbx_staff_role return false unless role.permission role.permission.can_reset_password end end
24.6875
72
0.764557
210e36558799fa8e51b40b392ac56489f764f098
504
process_is_foreground do with_feature :readline do require 'readline' describe "Readline.completion_append_character" do it "returns not nil" do Readline.completion_append_character.should_not be_nil end end describe "Readline.completion_append_character=" do it "returns the first character of the passed string" do Readline.completion_append_character = "test" Readline.completion_append_character.should == "t" end end end end
26.526316
62
0.718254
28ddc6138cb9616de7784f8f328b90c566e377d6
204
require "gds_api/content_store" module Services def self.content_store @content_store ||= GdsApi::ContentStore.new( Plek.new.find("content-store"), disable_cache: true, ) end end
18.545455
48
0.691176
7a1594c792ef785793739418746c0324238443f0
111
module Spina module AttachmentsHelper def file_url(file) main_app.url_for(file) end end end
12.333333
28
0.693694
38b960b3bde35f76387833f57183e62a6f3e1d7a
2,208
#-- copyright # OpenProject is an open source project management software. # Copyright (C) 2012-2020 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-2017 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' require_relative './mock_global_permissions' describe 'Global role: No module', type: :feature, js: true do let(:admin) { FactoryBot.create(:admin) } let(:project) { FactoryBot.create :project } let!(:role) { FactoryBot.create(:role) } before do login_as(admin) end scenario 'Global Rights Modules do not exist as Project -> Settings -> Modules' do # Scenario: # Given there is the global permission "glob_test" of the module "global" mock_global_permissions [['global_perm1', project_module: :global]] # And there is 1 project with the following: # | name | test | # | identifier | test | # And I am already admin # When I go to the modules tab of the settings page for the project "test" # Then I should not see "Global" visit settings_modules_project_path(project) expect(page).to have_text 'Activity' expect(page).to have_no_text 'Foo' end end
38.068966
91
0.713768
628d4e2b6637ae63cdb9a36b8fecd175653b9971
2,603
module Fog module Storage class InternetArchive class Real # Get headers for an object from S3 # # @param bucket_name [String] Name of bucket to read from # @param object_name [String] Name of object to read # @param options [Hash]: # @option options [String] If-Match Returns object only if its etag matches this value, otherwise returns 412 (Precondition Failed). # @option options [Time] If-Modified-Since Returns object only if it has been modified since this time, otherwise returns 304 (Not Modified). # @option options [String] If-None-Match Returns object only if its etag differs from this value, otherwise returns 304 (Not Modified) # @option options [Time] If-Unmodified-Since Returns object only if it has not been modified since this time, otherwise returns 412 (Precodition Failed). # @option options [String] Range Range of object to download # # @return [Excon::Response] response: # * body [String] Contents of object # * headers [Hash]: # * Content-Length [String] - Size of object contents # * Content-Type [String] - MIME type of object # * ETag [String] - Etag of object # * Last-Modified - [String] Last modified timestamp for object # # @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectHEAD.html # def head_object(bucket_name, object_name, options={}) unless bucket_name raise ArgumentError.new('bucket_name is required') end unless object_name raise ArgumentError.new('object_name is required') end headers = {} headers['If-Modified-Since'] = Fog::Time.at(options['If-Modified-Since'].to_i).to_date_header if options['If-Modified-Since'] headers['If-Unmodified-Since'] = Fog::Time.at(options['If-Unmodified-Since'].to_i).to_date_header if options['If-Modified-Since'] headers.merge!(options) request({ :expects => 200, :headers => headers, :host => "#{bucket_name}.#{@host}", :idempotent => true, :method => 'HEAD', :path => CGI.escape(object_name) }) end end class Mock # :nodoc:all def head_object(bucket_name, object_name, options = {}) response = get_object(bucket_name, object_name, options) response.body = nil response end end end end end
41.983871
163
0.605839
e28a9878acdde5deae0e2ac40f8d211d0c2960df
1,341
module PDF module Core class DocumentState #:nodoc: alias __initialize initialize def initialize(options) normalize_metadata(options) if options[:template] @store = if options[:print_scaling] PDF::Core::ObjectStore.new( template: options[:template], print_scaling: options[:print_scaling] ) else PDF::Core::ObjectStore.new(template: options[:template]) end @store.info.data.merge!(options[:info]) if options[:info] else @store = if options[:print_scaling] PDF::Core::ObjectStore.new( info: options[:info], print_scaling: options[:print_scaling] ) else PDF::Core::ObjectStore.new(info: options[:info]) end end @version = 1.3 @pages = [] @page = nil @trailer = options.fetch(:trailer, {}) @compress = options.fetch(:compress, false) @encrypt = options.fetch(:encrypt, false) @encryption_key = options[:encryption_key] @skip_encoding = options.fetch(:skip_encoding, false) @before_render_callbacks = [] @on_page_create_callback = nil end end end end
29.8
70
0.539896
e90175fc9d3406540d1e3efda6364cf55c6cd979
3,522
# This is a parser based on the "Handling Bounced Email" section of the "Rails Recipes" book. # Not all e-mail servers follow RFC-1892 perfectly (i.e. some don't include the original message, # some show the original message header inline rather than as a separate part of content, etc.) # # This module is designed to handle specific mail servers which don't support RFC-1892 properly module TmailBounceParser class BouncedDelivery attr_accessor :status_info, :original_message_id, :original_sender, :original_recipient, :original_subject, :handling_server def self.from_email(email) returning(bounce = self.new) do if (email['subject'].to_s =~ /not listed in Domino Directory/) bounce.handling_server = "DOMINO" elsif (email['subject'].to_s =~ /Mail delivery failed: returning message to sender/) bounce.handling_server = "EXIM" else bounce.handling_server = "STANDARD" end # Domino mail servers munge the "original message id" to something completely different # from the real original message-id. Therefore, only the original sender, recipients, subject, # etc. can be retrieved. if bounce.handling_server == "DOMINO" status_part = email.parts.detect do |part| part.content_type == "message/delivery-status" end statuses = status_part.body.gsub("\n ","").split(/\n/) bounce.status_info = statuses.inject({}) do |hash,line| key,value = line.split(/:/,2) hash[key] = value.strip rescue nil hash end bounce.original_recipient = status_part.to_s[/^Final-Recipient:.*$/].gsub("Final-Recipient: ","").gsub("rfc822;","").strip original_message_part = email.parts.detect do |part| part.content_type == "message/rfc822" end bounce.original_subject = original_message_part.to_s[/^Subject:.*$/].gsub("Subject:","").strip end # Exim mail servers don't use the report/message-status and mail/rfc222 parts. Rather, # they include the original message header information inline. if bounce.handling_server == "EXIM" end # This is to cover all other mail servers that properly follow the message/delivery-status and # message/rfc822 parts if bounce.handling_server == "STANDARD" status_part = email.parts.detect do |part| part.content_type == "message/delivery-status" end unless status_part.nil? statuses = status_part.body.gsub("\n ","").split(/\n/) bounce.status_info = statuses.inject({}) do |hash,line| key,value = line.split(/:/,2) hash[key] = value.strip rescue nil hash end original_message_part = email.parts.detect do |part| part.content_type == "message/rfc822" end unless original_message_part.nil? parsed_msg = TMail::Mail.parse(original_message_part.body) bounce.original_message_id = parsed_msg.message_id end end end # ////////////////////////// end end def status case status_info['Status'] when /^5/ 'Failure' when /^4/ 'Temporary Failure' when /^2/ 'Success' end end end def undeliverable_info BouncedDelivery.from_email(self) end end
40.022727
132
0.614708
e2a277ef0dd2d19e79e242299f6084640912a508
63
class Account::Revenue < Account ACCOUNT_TYPE = :revenue end
15.75
32
0.761905
1db8ecb1fd8dfb2e682b073c45a296d3b3b02e52
504
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. ActionController::Base.cookie_verifier_secret = '968c38990463176aef663172090d554518a1e14109f680b50466325411741649cd891107c57ce0a5dcbef3b5bfcdd4e2ad906ae2760ce30304b579861b5959d9'
63
178
0.835317
ffcc7ae5b403c216393c097bef32ec8f7a2f2157
27,799
# # Author:: Adam Jacob (<[email protected]>) # Author:: Christopher Walters (<[email protected]>) # Author:: Tim Hinderliter (<[email protected]>) # Author:: Seth Chisamore (<[email protected]>) # Copyright:: Copyright (c) 2008-2011 Opscode, 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 'spec_helper' class ResourceTestHarness < Chef::Resource provider_base Chef::Provider::Package end describe Chef::Resource do before(:each) do @cookbook_repo_path = File.join(CHEF_SPEC_DATA, 'cookbooks') @cookbook_collection = Chef::CookbookCollection.new(Chef::CookbookLoader.new(@cookbook_repo_path)) @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, @cookbook_collection, @events) @resource = Chef::Resource.new("funk", @run_context) end describe "when declaring the identity attribute" do it "has no identity attribute by default" do Chef::Resource.identity_attr.should be_nil end it "sets an identity attribute" do resource_class = Class.new(Chef::Resource) resource_class.identity_attr(:path) resource_class.identity_attr.should == :path end it "inherits an identity attribute from a superclass" do resource_class = Class.new(Chef::Resource) resource_subclass = Class.new(resource_class) resource_class.identity_attr(:package_name) resource_subclass.identity_attr.should == :package_name end it "overrides the identity attribute from a superclass when the identity attr is set" do resource_class = Class.new(Chef::Resource) resource_subclass = Class.new(resource_class) resource_class.identity_attr(:package_name) resource_subclass.identity_attr(:something_else) resource_subclass.identity_attr.should == :something_else end end describe "when no identity attribute has been declared" do before do @resource_sans_id = Chef::Resource.new("my-name") end # Would rather force identity attributes to be set for everything, # but that's not plausible for back compat reasons. it "uses the name as the identity" do @resource_sans_id.identity.should == "my-name" end end describe "when an identity attribute has been declared" do before do @file_resource_class = Class.new(Chef::Resource) do identity_attr :path attr_accessor :path end @file_resource = @file_resource_class.new("identity-attr-test") @file_resource.path = "/tmp/foo.txt" end it "gives the value of its identity attribute" do @file_resource.identity.should == "/tmp/foo.txt" end end describe "when declaring state attributes" do it "has no state_attrs by default" do Chef::Resource.state_attrs.should be_empty end it "sets a list of state attributes" do resource_class = Class.new(Chef::Resource) resource_class.state_attrs(:checksum, :owner, :group, :mode) resource_class.state_attrs.should =~ [:checksum, :owner, :group, :mode] end it "inherits state attributes from the superclass" do resource_class = Class.new(Chef::Resource) resource_subclass = Class.new(resource_class) resource_class.state_attrs(:checksum, :owner, :group, :mode) resource_subclass.state_attrs.should =~ [:checksum, :owner, :group, :mode] end it "combines inherited state attributes with non-inherited state attributes" do resource_class = Class.new(Chef::Resource) resource_subclass = Class.new(resource_class) resource_class.state_attrs(:checksum, :owner) resource_subclass.state_attrs(:group, :mode) resource_subclass.state_attrs.should =~ [:checksum, :owner, :group, :mode] end end describe "when a set of state attributes has been declared" do before do @file_resource_class = Class.new(Chef::Resource) do state_attrs :checksum, :owner, :group, :mode attr_accessor :checksum attr_accessor :owner attr_accessor :group attr_accessor :mode end @file_resource = @file_resource_class.new("describe-state-test") @file_resource.checksum = "abc123" @file_resource.owner = "root" @file_resource.group = "wheel" @file_resource.mode = "0644" end it "describes its state" do resource_state = @file_resource.state resource_state.keys.should =~ [:checksum, :owner, :group, :mode] resource_state[:checksum].should == "abc123" resource_state[:owner].should == "root" resource_state[:group].should == "wheel" resource_state[:mode].should == "0644" end end describe "load_prior_resource" do before(:each) do @prior_resource = Chef::Resource.new("funk") @prior_resource.supports(:funky => true) @prior_resource.source_line @prior_resource.allowed_actions << :funkytown @prior_resource.action(:funkytown) @resource.allowed_actions << :funkytown @run_context.resource_collection << @prior_resource end it "should load the attributes of a prior resource" do @resource.load_prior_resource @resource.supports.should == { :funky => true } end it "should not inherit the action from the prior resource" do @resource.load_prior_resource @resource.action.should_not == @prior_resource.action end end describe "name" do it "should have a name" do @resource.name.should eql("funk") end it "should let you set a new name" do @resource.name "monkey" @resource.name.should eql("monkey") end it "should not be valid without a name" do lambda { @resource.name false }.should raise_error(ArgumentError) end it "should always have a string for name" do lambda { @resource.name Hash.new }.should raise_error(ArgumentError) end end describe "noop" do it "should accept true or false for noop" do lambda { @resource.noop true }.should_not raise_error(ArgumentError) lambda { @resource.noop false }.should_not raise_error(ArgumentError) lambda { @resource.noop "eat it" }.should raise_error(ArgumentError) end end describe "notifies" do it "should make notified resources appear in the actions hash" do @run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee") @resource.notifies :reload, @run_context.resource_collection.find(:zen_master => "coffee") @resource.delayed_notifications.detect{|e| e.resource.name == "coffee" && e.action == :reload}.should_not be_nil end it "should make notified resources be capable of acting immediately" do @run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee") @resource.notifies :reload, @run_context.resource_collection.find(:zen_master => "coffee"), :immediate @resource.immediate_notifications.detect{|e| e.resource.name == "coffee" && e.action == :reload}.should_not be_nil end it "should raise an exception if told to act in other than :delay or :immediate(ly)" do @run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee") lambda { @resource.notifies :reload, @run_context.resource_collection.find(:zen_master => "coffee"), :someday }.should raise_error(ArgumentError) end it "should allow multiple notified resources appear in the actions hash" do @run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee") @resource.notifies :reload, @run_context.resource_collection.find(:zen_master => "coffee") @resource.delayed_notifications.detect{|e| e.resource.name == "coffee" && e.action == :reload}.should_not be_nil @run_context.resource_collection << Chef::Resource::ZenMaster.new("beans") @resource.notifies :reload, @run_context.resource_collection.find(:zen_master => "beans") @resource.delayed_notifications.detect{|e| e.resource.name == "beans" && e.action == :reload}.should_not be_nil end it "creates a notification for a resource that is not yet in the resource collection" do @resource.notifies(:restart, :service => 'apache') expected_notification = Chef::Resource::Notification.new({:service => "apache"}, :restart, @resource) @resource.delayed_notifications.should include(expected_notification) end it "notifies another resource immediately" do @resource.notifies_immediately(:restart, :service => 'apache') expected_notification = Chef::Resource::Notification.new({:service => "apache"}, :restart, @resource) @resource.immediate_notifications.should include(expected_notification) end it "notifies a resource to take action at the end of the chef run" do @resource.notifies_delayed(:restart, :service => "apache") expected_notification = Chef::Resource::Notification.new({:service => "apache"}, :restart, @resource) @resource.delayed_notifications.should include(expected_notification) end end describe "subscribes" do it "should make resources appear in the actions hash of subscribed nodes" do @run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee") zr = @run_context.resource_collection.find(:zen_master => "coffee") @resource.subscribes :reload, zr zr.delayed_notifications.detect{|e| e.resource.name == "funk" && e.action == :reload}.should_not be_nil end it "should make resources appear in the actions hash of subscribed nodes" do @run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee") zr = @run_context.resource_collection.find(:zen_master => "coffee") @resource.subscribes :reload, zr zr.delayed_notifications.detect{|e| e.resource.name == @resource.name && e.action == :reload}.should_not be_nil @run_context.resource_collection << Chef::Resource::ZenMaster.new("bean") zrb = @run_context.resource_collection.find(:zen_master => "bean") zrb.subscribes :reload, zr zr.delayed_notifications.detect{|e| e.resource.name == @resource.name && e.action == :reload}.should_not be_nil end it "should make subscribed resources be capable of acting immediately" do @run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee") zr = @run_context.resource_collection.find(:zen_master => "coffee") @resource.subscribes :reload, zr, :immediately zr.immediate_notifications.detect{|e| e.resource.name == @resource.name && e.action == :reload}.should_not be_nil end end describe "defined_at" do it "should correctly parse source_line on unix-like operating systems" do @resource.source_line = "/some/path/to/file.rb:80:in `wombat_tears'" @resource.defined_at.should == "/some/path/to/file.rb line 80" end it "should correctly parse source_line on Windows" do @resource.source_line = "C:/some/path/to/file.rb:80 in 1`wombat_tears'" @resource.defined_at.should == "C:/some/path/to/file.rb line 80" end it "should include the cookbook and recipe when it knows it" do @resource.source_line = "/some/path/to/file.rb:80:in `wombat_tears'" @resource.recipe_name = "wombats" @resource.cookbook_name = "animals" @resource.defined_at.should == "animals::wombats line 80" end it "should recognize dynamically defined resources" do @resource.defined_at.should == "dynamically defined" end end describe "to_s" do it "should become a string like resource_name[name]" do zm = Chef::Resource::ZenMaster.new("coffee") zm.to_s.should eql("zen_master[coffee]") end end describe "is" do it "should return the arguments passed with 'is'" do zm = Chef::Resource::ZenMaster.new("coffee") zm.is("one", "two", "three").should == %w|one two three| end it "should allow arguments preceeded by is to methods" do @resource.noop(@resource.is(true)) @resource.noop.should eql(true) end end describe "to_json" do it "should serialize to json" do json = @resource.to_json json.should =~ /json_class/ json.should =~ /instance_vars/ end end describe "to_hash" do it "should convert to a hash" do hash = @resource.to_hash expected_keys = [ :allowed_actions, :params, :provider, :updated, :updated_by_last_action, :before, :supports, :noop, :ignore_failure, :name, :source_line, :action, :retries, :retry_delay, :elapsed_time] (hash.keys - expected_keys).should == [] (expected_keys - hash.keys).should == [] hash[:name].should eql("funk") end end describe "self.json_create" do it "should deserialize itself from json" do json = @resource.to_json serialized_node = Chef::JSONCompat.from_json(json) serialized_node.should be_a_kind_of(Chef::Resource) serialized_node.name.should eql(@resource.name) end end describe "supports" do it "should allow you to set what features this resource supports" do support_hash = { :one => :two } @resource.supports(support_hash) @resource.supports.should eql(support_hash) end it "should return the current value of supports" do @resource.supports.should == {} end end describe "ignore_failure" do it "should default to throwing an error if a provider fails for a resource" do @resource.ignore_failure.should == false end it "should allow you to set whether a provider should throw exceptions with ignore_failure" do @resource.ignore_failure(true) @resource.ignore_failure.should == true end it "should allow you to epic_fail" do @resource.epic_fail(true) @resource.epic_fail.should == true end end describe "retries" do it "should default to not retrying if a provider fails for a resource" do @resource.retries.should == 0 end it "should allow you to set how many retries a provider should attempt after a failure" do @resource.retries(2) @resource.retries.should == 2 end it "should default to a retry delay of 2 seconds" do @resource.retry_delay.should == 2 end it "should allow you to set the retry delay" do @resource.retry_delay(10) @resource.retry_delay.should == 10 end end describe "setting the base provider class for the resource" do it "defaults to Chef::Provider for the base class" do Chef::Resource.provider_base.should == Chef::Provider end it "allows the base provider to be overriden by a " do ResourceTestHarness.provider_base.should == Chef::Provider::Package end end it "supports accessing the node via the @node instance variable [DEPRECATED]" do @resource.instance_variable_get(:@node).inspect.should == @node.inspect end it "runs an action by finding its provider, loading the current resource and then running the action" do pending end describe "when updated by a provider" do before do @resource.updated_by_last_action(true) end it "records that it was updated" do @resource.should be_updated end it "records that the last action updated the resource" do @resource.should be_updated_by_last_action end describe "and then run again without being updated" do before do @resource.updated_by_last_action(false) end it "reports that it is updated" do @resource.should be_updated end it "reports that it was not updated by the last action" do @resource.should_not be_updated_by_last_action end end end describe "when invoking its action" do before do @resource = Chef::Resource.new("provided", @run_context) @resource.provider = Chef::Provider::SnakeOil @node.automatic_attrs[:platform] = "fubuntu" @node.automatic_attrs[:platform_version] = '10.04' end it "does not run only_if if no only_if command is given" do @resource.not_if.clear @resource.run_action(:purr) end it "runs runs an only_if when one is given" do snitch_variable = nil @resource.only_if { snitch_variable = true } @resource.only_if.first.positivity.should == :only_if #Chef::Mixin::Command.should_receive(:only_if).with(true, {}).and_return(false) @resource.run_action(:purr) snitch_variable.should be_true end it "runs multiple only_if conditionals" do snitch_var1, snitch_var2 = nil, nil @resource.only_if { snitch_var1 = 1 } @resource.only_if { snitch_var2 = 2 } @resource.run_action(:purr) snitch_var1.should == 1 snitch_var2.should == 2 end it "accepts command options for only_if conditionals" do Chef::Resource::Conditional.any_instance.should_receive(:evaluate_command).at_least(1).times @resource.only_if("true", :cwd => '/tmp') @resource.only_if.first.command_opts.should == {:cwd => '/tmp'} @resource.run_action(:purr) end it "runs not_if as a command when it is a string" do Chef::Resource::Conditional.any_instance.should_receive(:evaluate_command).at_least(1).times @resource.not_if "pwd" @resource.run_action(:purr) end it "runs not_if as a block when it is a ruby block" do Chef::Resource::Conditional.any_instance.should_receive(:evaluate_block).at_least(1).times @resource.not_if { puts 'foo' } @resource.run_action(:purr) end it "does not run not_if if no not_if command is given" do @resource.run_action(:purr) end it "accepts command options for not_if conditionals" do @resource.not_if("pwd" , :cwd => '/tmp') @resource.not_if.first.command_opts.should == {:cwd => '/tmp'} end it "accepts multiple not_if conditionals" do snitch_var1, snitch_var2 = true, true @resource.not_if {snitch_var1 = nil} @resource.not_if {snitch_var2 = false} @resource.run_action(:purr) snitch_var1.should be_nil snitch_var2.should be_false end end describe "building the platform map" do it 'adds mappings for a single platform' do klz = Class.new(Chef::Resource) Chef::Resource.platform_map.should_receive(:set).with( :platform => :autobots, :short_name => :dinobot, :resource => klz ) klz.provides :dinobot, :on_platforms => ['autobots'] end it 'adds mappings for multiple platforms' do klz = Class.new(Chef::Resource) Chef::Resource.platform_map.should_receive(:set).twice klz.provides :energy, :on_platforms => ['autobots','decepticons'] end it 'adds mappings for all platforms' do klz = Class.new(Chef::Resource) Chef::Resource.platform_map.should_receive(:set).with( :short_name => :tape_deck, :resource => klz ) klz.provides :tape_deck end end describe "lookups from the platform map" do before(:each) do @node = Chef::Node.new @node.name("bumblebee") @node.automatic[:platform] = "autobots" @node.automatic[:platform_version] = "6.1" Object.const_set('Soundwave', Class.new(Chef::Resource)) Object.const_set('Grimlock', Class.new(Chef::Resource){ provides :dinobot, :on_platforms => ['autobots'] }) end after(:each) do Object.send(:remove_const, :Soundwave) Object.send(:remove_const, :Grimlock) end describe "resource_for_platform" do it 'return a resource by short_name and platform' do Chef::Resource.resource_for_platform(:dinobot,'autobots','6.1').should eql(Grimlock) end it "returns a resource by short_name if nothing else matches" do Chef::Resource.resource_for_node(:soundwave, @node).should eql(Soundwave) end end describe "resource_for_node" do it "returns a resource by short_name and node" do Chef::Resource.resource_for_node(:dinobot, @node).should eql(Grimlock) end it "returns a resource by short_name if nothing else matches" do Chef::Resource.resource_for_node(:soundwave, @node).should eql(Soundwave) end end end end describe Chef::Resource::Notification do before do @notification = Chef::Resource::Notification.new(:service_apache, :restart, :template_httpd_conf) end it "has a resource to be notified" do @notification.resource.should == :service_apache end it "has an action to take on the service" do @notification.action.should == :restart end it "has a notifying resource" do @notification.notifying_resource.should == :template_httpd_conf end it "is a duplicate of another notification with the same target resource and action" do other = Chef::Resource::Notification.new(:service_apache, :restart, :sync_web_app_code) @notification.duplicates?(other).should be_true end it "is not a duplicate of another notification if the actions differ" do other = Chef::Resource::Notification.new(:service_apache, :enable, :install_apache) @notification.duplicates?(other).should be_false end it "is not a duplicate of another notification if the target resources differ" do other = Chef::Resource::Notification.new(:service_sshd, :restart, :template_httpd_conf) @notification.duplicates?(other).should be_false end it "raises an ArgumentError if you try to check a non-ducktype object for duplication" do lambda {@notification.duplicates?(:not_a_notification)}.should raise_error(ArgumentError) end it "takes no action to resolve a resource reference that doesn't need to be resolved" do @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @notification.resource = @keyboard_cat @long_cat = Chef::Resource::Cat.new("long_cat") @notification.notifying_resource = @long_cat @resource_collection = Chef::ResourceCollection.new # would raise an error since the resource is not in the collection @notification.resolve_resource_reference(@resource_collection) @notification.resource.should == @keyboard_cat end it "resolves a lazy reference to a resource" do @notification.resource = {:cat => "keyboard_cat"} @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @keyboard_cat @long_cat = Chef::Resource::Cat.new("long_cat") @notification.notifying_resource = @long_cat @notification.resolve_resource_reference(@resource_collection) @notification.resource.should == @keyboard_cat end it "resolves a lazy reference to its notifying resource" do @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @notification.resource = @keyboard_cat @notification.notifying_resource = {:cat => "long_cat"} @long_cat = Chef::Resource::Cat.new("long_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @long_cat @notification.resolve_resource_reference(@resource_collection) @notification.notifying_resource.should == @long_cat end it "resolves lazy references to both its resource and its notifying resource" do @notification.resource = {:cat => "keyboard_cat"} @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @keyboard_cat @notification.notifying_resource = {:cat => "long_cat"} @long_cat = Chef::Resource::Cat.new("long_cat") @resource_collection << @long_cat @notification.resolve_resource_reference(@resource_collection) @notification.resource.should == @keyboard_cat @notification.notifying_resource.should == @long_cat end it "raises a RuntimeError if you try to reference multiple resources" do @notification.resource = {:cat => ["keyboard_cat", "cheez_cat"]} @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @cheez_cat = Chef::Resource::Cat.new("cheez_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @keyboard_cat @resource_collection << @cheez_cat @long_cat = Chef::Resource::Cat.new("long_cat") @notification.notifying_resource = @long_cat lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError) end it "raises a RuntimeError if you try to reference multiple notifying resources" do @notification.notifying_resource = {:cat => ["long_cat", "cheez_cat"]} @long_cat = Chef::Resource::Cat.new("long_cat") @cheez_cat = Chef::Resource::Cat.new("cheez_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @long_cat @resource_collection << @cheez_cat @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @notification.resource = @keyboard_cat lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError) end it "raises a RuntimeError if it can't find a resource in the resource collection when resolving a lazy reference" do @notification.resource = {:cat => "keyboard_cat"} @cheez_cat = Chef::Resource::Cat.new("cheez_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @cheez_cat @long_cat = Chef::Resource::Cat.new("long_cat") @notification.notifying_resource = @long_cat lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError) end it "raises a RuntimeError if it can't find a notifying resource in the resource collection when resolving a lazy reference" do @notification.notifying_resource = {:cat => "long_cat"} @cheez_cat = Chef::Resource::Cat.new("cheez_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @cheez_cat @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @notification.resource = @keyboard_cat lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(RuntimeError) end it "raises an ArgumentError if improper syntax is used in the lazy reference to its resource" do @notification.resource = "cat => keyboard_cat" @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @keyboard_cat @long_cat = Chef::Resource::Cat.new("long_cat") @notification.notifying_resource = @long_cat lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(ArgumentError) end it "raises an ArgumentError if improper syntax is used in the lazy reference to its notifying resource" do @notification.notifying_resource = "cat => long_cat" @long_cat = Chef::Resource::Cat.new("long_cat") @resource_collection = Chef::ResourceCollection.new @resource_collection << @long_cat @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @notification.resource = @keyboard_cat lambda {@notification.resolve_resource_reference(@resource_collection)}.should raise_error(ArgumentError) end # Create test to resolve lazy references to both notifying resource and dest. resource # Create tests to check proper error raising end
38.080822
128
0.705133
ab2eee9e1600e95c3862a0274848c6eba8731d74
2,193
Rails.application.routes.draw do get 'home/me' resources :subscriptions resources :stories do member do post 'approve' post 'unapprove' end end resources :letters get '/subscribe', to: 'subscriptions#new', as: :subscribe get '/logout', to: 'sessions#destroy', as: :logout get '/login', to: 'sessions#new', as: :login get '/auth/:provider/callback', to: 'sessions#create' get '/auth/failure', to: 'sessions#login_error' get 'sessions/create' get 'sessions/new' get 'home', to: 'home#index', as: :home get 'me', to: 'home#me', as: :me # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". post '/email_processor' => 'griddler/emails#create' # You can have the root of your site routed with "root" root 'home#index' # Example of regular route: # get 'products/:id' => 'catalog#view' # Example of named route that can be invoked with purchase_url(id: product.id) # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase # Example resource route (maps HTTP verbs to controller actions automatically): # resources :products # Example resource route with options: # resources :products do # member do # get 'short' # post 'toggle' # end # # collection do # get 'sold' # end # end # Example resource route with sub-resources: # resources :products do # resources :comments, :sales # resource :seller # end # Example resource route with more complex sub-resources: # resources :products do # resources :comments # resources :sales do # get 'recent', on: :collection # end # end # Example resource route with concerns: # concern :toggleable do # post 'toggle' # end # resources :posts, concerns: :toggleable # resources :photos, concerns: :toggleable # Example resource route within a namespace: # namespace :admin do # # Directs /admin/products/* to Admin::ProductsController # # (app/controllers/admin/products_controller.rb) # resources :products # end end
27.4125
84
0.649339
281fac0387537851b8fd237892c35e2d5507559a
467
require 'spec_helper' provider_class = Puppet::Type.type(:postgres_version).provider(:v1) describe provider_class do context 'postgres_version operations' do it 'lists postgres_version instances' do VCR.use_cassette('postgres_version_list') do instances = provider_class.instances expect(instances.length).to be > 0 expect(instances[0]).to be_an_instance_of Puppet::Type::Postgres_version::ProviderV1 end end end end
29.1875
92
0.736617
bf9dcdb3bf22bbfa97017693d52d4b6c312e197f
169
cask :v1 => 'radi' do version :latest sha256 :no_check url 'http://radiapp.com/Radi.zip' homepage 'http://radiapp.com/' license :closed app 'Radi.app' end
15.363636
35
0.656805
33bc73d42e399b57737d1382ae92de08110fe469
36
module Gcal VERSION = "0.0.3" end
9
19
0.638889
91cae1c61f76fdb266d87d2dd3970099483810d9
135
module Fog module Compute class Ecloud class Real basic_request :get_physical_device end end end end
11.25
42
0.637037
790dd67e87881fa24bc249723d96bcd6ec56490d
116
class MyPoroAddress2 include ActiveModel::Model attr_accessor :zipcode validates_correios_cep_of :zipcode end
19.333333
36
0.836207
bb4350728d211cba79c7036422f929defa32a057
59,693
require 'hashie' module Plaid module Models # Internal: Base model for all other models. class BaseModel < Hashie::Dash include Hashie::Extensions::Dash::IndifferentAccess include Hashie::Extensions::Dash::Coercion @ignored_properties = [] def self.property_ignored?(property) if defined? @ignored_properties @ignored_properties.include?(property) else false end end # Internal: Be strict or forgiving depending on Plaid.relaxed_models # value. def assert_property_exists!(property) super unless Plaid.relaxed_models? || self.class.property_ignored?(property) end end # Internal: Base API response. class BaseResponse < BaseModel ## # :attr_reader: # Public: The String request ID assigned by the API. property :request_id end # Internal: Base error. class BaseError < BaseModel ## # :attr_reader: # Public: The String broad categorization of the error. One of: # 'INVALID_REQUEST', 'INVALID_INPUT', 'RATE_LIMIT_EXCEEDED', 'API_ERROR', # or 'ITEM_ERROR'. property :error_type ## # :attr_reader: # Public: The particular String error code. Each error_type has a # specific set of error_codes. property :error_code ## # :attr_reader: # Public: A developer-friendly representation of the error message. property :error_message ## # :attr_reader: # Public: A user-friendly representation of the error message. nil if the # error is not related to user action. property :display_message end # Public: A representation of a cause. class Cause < BaseError ## # :attr_reader: # Public: The item ID. property :item_id end # Public: A representation of an error. class Error < BaseError ## # :attr_reader: # Public: A list of reasons explaining why the error happened. property :causes, coerce: Array[Cause] end # Public: A representation of a warning. class Warning < BaseModel ## # :attr_reader: # Public: The type of warning. property :warning_type ## # :attr_reader: # Public: The warning code. property :warning_code ## # :attr_reader: # Public: The underlying cause. property :cause, coerce: Cause end # Public: A representation of an item. class Item < BaseModel ## # :attr_reader: # Public: The Array with String products available for this item # (e.g. ["balance", "auth"]). property :available_products ## # :attr_reader: # Public: The Array with String products billed for this item # (e.g. ["identity", "transactions"]). property :billed_products ## # :attr_reader: # Public: The String error related to property :error, coerce: Error ## # :attr_reader: # Public: The String institution ID for this item. property :institution_id ## # :attr_reader: # Public: The String item ID. property :item_id ## # :attr_reader: # Public: The String update type. property :update_type ## # :attr_reader: # Public: The String webhook URL. property :webhook ## # :attr_reader: # Public: The String consent expiration timestamp (or nil) # (e.g. "2019-04-22T00:00:00Z"). property :consent_expiration_time ## # :attr_reader: # Public: The String update type. property :update_type end # Public: A representation of Item webhook status class ItemStatusLastWebhook < BaseModel ## # :attr_reader: # Public: The String last code sent (or nil). # (e.g. "HISTORICAL_UPDATE"). property :code_sent ## # :attr_reader: # Public: the String sent at date (or nil). # (e.g. "2019-04-22T00:00:00Z"). property :sent_at end # Public: A representation of Item transaction update status class ItemStatusTransactions < BaseModel ## # :attr_reader: # Public: the String last failed update date (or nil). # (e.g. "2019-04-22T00:00:00Z"). property :last_failed_update ## # :attr_reader: # Public: the String last successful update date (or nil). # (e.g. "2019-04-22T00:00:00Z"). property :last_successful_update end # Public: A representation of Item investments update status class ItemStatusInvestments < BaseModel ## # :attr_reader: # Public: the String last failed update date (or nil). # (e.g. "2019-04-22T00:00:00Z"). property :last_failed_update ## # :attr_reader: # Public: the String last successful update date (or nil). # (e.g. "2019-04-22T00:00:00Z"). property :last_successful_update end # Public: A representation of Item status class ItemStatus < BaseModel ## # :attr_reader: # Public: The ItemStatusLastWebhook for this ItemStatus. property :last_webhook, coerce: ItemStatusLastWebhook ## # :attr_reader: # Public: The ItemStatusTransactions for this ItemStatus. property :transactions, coerce: ItemStatusTransactions ## # :attr_reader: # Public: The ItemStatusInvestments for this ItemStatus. property :investments, coerce: ItemStatusInvestments end # Public: A representation of account balances. class Balances < BaseModel ## # :attr_reader: # Public: The Numeric available balance (or nil). property :available ## # :attr_reader: # Public: The Numeric current balance (or nil). property :current ## # :attr_reader: # Public: The Numeric limit (or nil). property :limit ## # :attr_reader: # Public: The String ISO currency code for the amount property :iso_currency_code ## # :attr_reader: # Public: The String unofficial currency code for the amount property :unofficial_currency_code end # Public: A representation of an account. class Account < BaseModel ## # :attr_reader: # Public: The String account ID, e.g. # "QKKzevvp33HxPWpoqn6rI13BxW4awNSjnw4xv". property :account_id ## # :attr_reader: # Public: Balances for this account. property :balances, coerce: Balances ## # :attr_reader: # Public: The String mask, e.g. "0000". property :mask ## # :attr_reader: # Public: The String account name, e.g. "Plaid Checking". property :name ## # :attr_reader: # Public: The String official account name, e.g. "Plaid Gold Checking". property :official_name ## # :attr_reader: # Public: The String type, e.g. "depository". property :type ## # :attr_reader: # Public: The String subtype, e.g. "checking". property :subtype ## # :attr_reader: # Public: The String verification status, # e.g "manually_verified" (optional). property :verification_status end # Public: A representation of an ACH account number. class NumberACH < BaseModel ## # :attr_reader: # Public: The String account number. E.g. "1111222233330000". property :account ## # :attr_reader: # Public: The String account ID. E.g. # "vzeNDwK7KQIm4yEog683uElbp9GRLEFXGK98D". property :account_id ## # :attr_reader: # Public: The String routing number. E.g. "011401533". property :routing ## # :attr_reader: # Public: The String wire routing number. E.g. "021000021". property :wire_routing end # Public: A representation of an EFT (Canadian) account number. class NumberEFT < BaseModel ## # :attr_reader: # Public: The String account number. E.g. "1111222233330000". property :account ## # :attr_reader: # Public: The String account ID. E.g. # "vzeNDwK7KQIm4yEog683uElbp9GRLEFXGK98D". property :account_id ## # :attr_reader: # Public: The String branch number. E.g. "021". property :branch ## # :attr_reader: # Public: The String institution number. E.g. "01140". property :institution end # Public: A representation of an International account number. class NumberInternational < BaseModel ## # :attr_reader: # Public: The String account ID. E.g. # "vzeNDwK7KQIm4yEog683uElbp9GRLEFXGK98D". property :account_id ## # :attr_reader: # Public: The String International Bank Account Number (IBAN). E.g. # "GB33BUKB20201555555555". property :iban ## # :attr_reader: # Public: The String Bank Identifier Code (BIC). E.g. "BUKBGB22". property :bic end # Public: A representation of a BACS (British) account number. class NumberBACS < BaseModel ## # :attr_reader: # Public: The String account ID. E.g. # "vzeNDwK7KQIm4yEog683uElbp9GRLEFXGK98D". property :account_id ## # :attr_reader: # Public: The String account number. E.g. "66374958". property :account ## # :attr_reader: # Public: The String sort code. E.g. "089999". property :sort_code end # Public: A representation of a Auth Numbers response class Numbers < BaseModel ## # :attr_reader: # Public: The Array of NumberACH. property :ach, coerce: Array[NumberACH] ## # :attr_reader: # Public: The Array of NumberEFT. property :eft, coerce: Array[NumberEFT] ## # :attr_reader: # Public: The Array of NumberInternational. property :international, coerce: Array[NumberInternational] ## # :attr_reader: # Public: The Array of NumberBACS. property :bacs, coerce: Array[NumberBACS] end # Public: A representation of a transaction category. class Category < BaseModel ## # :attr_reader: # Public: The String category ID. E.g. "10000000". property :category_id ## # :attr_reader: # Public: The Array of Strings category hierarchy. # E.g. ["Recreation", "Arts & Entertainment", "Circuses and Carnivals"]. property :hierarchy ## # :attr_reader: # Public: The String category group. E.g. "place". property :group end # Public: A representation of a single Credit Details APR. class CreditDetailsAPR < BaseModel ## # :attr_reader: # Public: The Numeric APR (e.g. 0.125). property :apr ## # :attr_reader: # Public: The Numeric balance subject to APR (e.g. 1200). property :balance_subject_to_apr ## # :attr_reader: # Public: The Numeric interest charge amount (e.g. 150). property :interest_charge_amount end # Public: A representation of Credit Details APRs data. class CreditDetailsAPRs < BaseModel ## # :attr_reader: # Public: Balance transfers APR property :balance_transfers, coerce: CreditDetailsAPR ## # :attr_reader: # Public: Cash advances APR property :cash_advances, coerce: CreditDetailsAPR ## # :attr_reader: # Public: Purchases APR property :purchases, coerce: CreditDetailsAPR end # Public: A representation of Credit Details data. class CreditDetails < BaseModel ## # :attr_reader: # Public: The String account ID. E.g. # "vzeNDwK7KQIm4yEog683uElbp9GRLEFXGK98D". property :account_id ## # :attr_reader: # Public: The APRs. property :aprs, coerce: CreditDetailsAPRs ## # :attr_reader: # Public: The Numeric last payment amount (e.g. 875). property :last_payment_amount ## # :attr_reader: # Public: The String last payment date. E.g. "2016-09-13T00:00:00Z". property :last_payment_date ## # :attr_reader: # Public: The Numeric last statement balance (e.g. 3450). property :last_statement_balance ## # :attr_reader: # Public: The String last statement date. E.g. "2016-10-01T00:00:00Z". property :last_statement_date ## # :attr_reader: # Public: The Numeric minimum payment amount (e.g. 800). property :minimum_payment_amount ## # :attr_reader: # Public: The String next bill due date. E.g. "2016-10-15T00:00:00Z". property :next_bill_due_date end # Public: A representation of Identity address details. class IdentityAddressData < BaseModel ## # :attr_reader: # Public: The String street name. property :street ## # :attr_reader: # Public: The String name. property :city ## # :attr_reader: # Public: The String region or state name. property :region ## # :attr_reader: # Public: The String postal code. property :postal_code ## # :attr_reader: # Public: The String country code. property :country end # Public: A representation of Identity address data. class IdentityAddress < BaseModel ## # :attr_reader: # Public: The Boolean primary flag (true if it's the primary address). property :primary ## # :attr_reader: # Public: The address data. property :data, coerce: IdentityAddressData end # Public: A representation of Identity email data. class IdentityEmail < BaseModel ## # :attr_reader: # Public: The String data, i.e. the address itself. E.g. # "[email protected]". property :data ## # :attr_reader: # Public: The Boolean primary flag. property :primary ## # :attr_reader: # Public: The String type. E.g. "primary", or "secondary", or "other". property :type end # Public: A representation of Identity phone number data. class IdentityPhoneNumber < BaseModel ## # :attr_reader: # Public: The String data, i.e. the number itself. E.g. # "4673956022". property :data ## # :attr_reader: # Public: The Boolean primary flag. property :primary ## # :attr_reader: # Public: The String type. E.g. "home", or "work", or "mobile1". property :type end # Public: A representation of Identity data. class Identity < BaseModel ## # :attr_reader: # Public: Addresses: Array of IdentityAddress. property :addresses, coerce: Array[IdentityAddress] ## # :attr_reader: # Public: Emails: Array of IdentityEmail. property :emails, coerce: Array[IdentityEmail] ## # :attr_reader: # Public: The Array of String names. E.g. ["John Doe", "Ronald McDonald"]. property :names ## # :attr_reader: # Public: Phone numbers: Array of IdentityPhoneNumber. property :phone_numbers, coerce: Array[IdentityPhoneNumber] end # Public: A representation of Income Stream data. class IncomeStream < BaseModel ## # :attr_reader: # Public: The Numeric monthly income associated with the income stream. property :monthly_income ## # :attr_reader: # Public: The Numeric representation of our confidence in the income data # associated with this particular income stream, with 0 being the lowest # confidence and 1 being the highest. property :confidence ## # :attr_reader: # Public: The Numeric extent of data found for this income stream. property :days ## # :attr_reader: # Public: The String name of the entity associated with this income # stream. property :name end # Public: A representation of an account with owners class AccountWithOwners < Account ## # :attr_reader: # Public: The Array of owners. property :owners, coerce: Array[Identity] end # Public: A representation of Income data. class Income < BaseModel ## # :attr_reader: # Public: An Array of IncomeStream with detailed information. property :income_streams, coerce: Array[IncomeStream] ## # :attr_reader: # Public: The Numeric last year income, i.e. the sum of the Item's # income over the past 365 days. If Plaid has less than 365 days of data # this will be less than a full year's income. property :last_year_income ## # :attr_reader: # Public: The Numeric last_year_income interpolated to value before # taxes. This is the minimum pre-tax salary that assumes a filing status # of single with zero dependents. property :last_year_income_before_tax ## # :attr_reader: # Public: The Numeric income extrapolated over a year based on current, # active income streams. Income streams become inactive if they have not # recurred for more than two cycles. For example, if a weekly paycheck # hasn't been seen for the past two weeks, it is no longer active. property :projected_yearly_income ## # :attr_reader: # Public: The Numeric projected_yearly_income interpolated to value # before taxes. This is the minimum pre-tax salary that assumes a filing # status of single with zero dependents. property :projected_yearly_income_before_tax ## # :attr_reader: # Public: The Numeric max number of income streams present at the same # time over the past 365 days. property :max_number_of_overlapping_income_streams ## # :attr_reader: # Public: The Numeric total number of distinct income streams received # over the past 365 days. property :number_of_income_streams end # Public: A representation of an institution login credential. class InstitutionCredential < BaseModel @ignored_properties = ['flexible_input_spec'] ## # :attr_reader: # Public: The String label. E.g. "User ID". property :label ## # :attr_reader: # Public: The String name. E.g. "username". property :name ## # :attr_reader: # Public: The String type. E.g. "text", or "password". property :type end # Public: A representation of Institution status breakdown. class InstitutionStatusBreakdown < BaseModel ## # :attr_reader: # Public: The Numeric success percentage. # (e.g. 0.970) property :success ## # :attr_reader: # Public: The Numeric Plaid error percentage. # (e.g. 0.010) property :error_plaid ## # :attr_reader: # Public: The Numeric Institution error percentage. # (e.g. 0.020) property :error_institution end # Public: A representation of Institution item logins status. class InstitutionStatusItemLogins < BaseModel ## # :attr_reader: # Public: The String last status change date. # (e.g. "2019-04-22T20:52:00Z") property :last_status_change ## # :attr_reader: # Public: The String status. # (e.g. one of "HEALTHY"|"DEGRADED"|"DOWN") property :status ## # :attr_reader: # Public: The breakdown for this Institution status. property :breakdown, coerce: InstitutionStatusBreakdown end # Public: A representation of Institution status. class InstitutionStatus < BaseModel ## # :attr_reader: # Public: The Item logins status for this InstitutionStatus. property :item_logins, coerce: InstitutionStatusItemLogins end # Public: A representation of standing order metadata for an institution. class StandingOrderMetadata < BaseModel ## # :attr_reader: # Public: The Boolean flag indicating if the institution supports # end date for standing orders. property :supports_standing_order_end_date ## # :attr_reader: # Public: The Boolean flag indicating if the institution supports # negative execution days for standing orders. property :supports_standing_order_negative_execution_days ## # :attr_reader: # Public: The Array of valid standing order intervals for # this institution. # E.g. ["WEEKLY", "MONTHLY"]. property :valid_standing_order_intervals end # Public: A representation of an institution's payment initiation metadata. class InstitutionPaymentInitiationMetadata < BaseModel ## # :attr_reader: # Public: The map of maximum payment amount per currency for this # institution. # E.g. {"GBP"=>"1000000"}. property :maximum_payment_amount ## # :attr_reader: # Public: The standing order metadata for this institution. property :standing_order_metadata, coerce: StandingOrderMetadata ## # :attr_reader: # Public: The Boolean flag indicating if the institution supports # international payments. property :supports_international_payments ## # :attr_reader: # Public: The Boolean flag indicating if the institution supports # refund details. property :supports_refund_details end # Public: A representation of Institution. class Institution < BaseModel @ignored_properties = ['input_spec'] ## # :attr_reader: # Public: The Array of InstitutionCredential, presenting information on # login credentials used for the institution. property :credentials, coerce: Array[InstitutionCredential] ## # :attr_reader: # Public: The Boolean flag indicating if the institution uses MFA. property :has_mfa ## # :attr_reader: # Public: The String reflecting the MFA code type ("numeric" / # "alphanumeric") property :mfa_code_type ## # :attr_reader: # Public: The String institution ID (e.g. "ins_109512"). property :institution_id ## # :attr_reader: # Public: The String institution name (e.g. "Houndstooth Bank"). property :name ## # :attr_reader: # Public: The Array of String MFA types. # E.g. ["code", "list", "questions", "selections"]. property :mfa ## # :attr_reader: # Public: The Array of String product names supported by this institution. # E.g. ["auth", "balance", "identity", "transactions"]. property :products ## # :attr_reader: # Public: The Array of String country codes supported by this institution. # E.g. ["US", "GB"]. property :country_codes ## # :attr_reader: # Public: The String primary color for this institution (e.g. "#095aa6"). property :primary_color ## # :attr_reader: # Public: The String base 64 encoded logo for this institution. property :logo ## # :attr_reader: # Public: The String base 64 encoded url for this institution # E.g. "https://www.plaid.com"). property :url ## # :attr_reader: # Public: The Status for this Institution (or nil). property :status, coerce: InstitutionStatus ## # :attr_reader: # Public: The Array of String country codes supported by this institution. property :country_codes ## # :attr_reader: # Public: The array of routing numbers associated with this institution. property :routing_numbers ## # :attr_reader: # Public: Indicates that the institution has an OAuth login flow. property :oauth ## # :attr_reader: # Public: Specifies metadata related to the payment_initiation product # (or nil). property :payment_initiation_metadata, coerce: InstitutionPaymentInitiationMetadata end module MFA # Public: A representation of an MFA device. class Device < BaseModel ## # :attr_reader: # Public: The String message related to sending code to the device. property :display_message end # Public: A representation of a single element in a device list. class DeviceListElement < BaseModel ## # :attr_reader: # Public: The String device ID. property :device_id ## # :attr_reader: # Public: The String device mask. property :mask ## # :attr_reader: # Public: The String device type. property :type end # Public: A representation of MFA selection. class Selection < BaseModel ## # :attr_reader: # Public: The String question. property :question ## # :attr_reader: # Public: The Array of String answers. property :answers end end # Public: A representation of Transaction location. class TransactionLocation < BaseModel ## # :attr_reader: # Public: The String address (or nil). property :address ## # :attr_reader: # Public: The String city name (or nil). property :city ## # :attr_reader: # Public: The Numeric latitude of the place (or nil). property :lat ## # :attr_reader: # Public: The Numeric longitude of the place (or nil). property :lon ## # :attr_reader: # Public: The String region or state name (or nil). property :region ## # :attr_reader: # Public: The String store number (or nil). property :store_number ## # :attr_reader: # Public: The String postal code (or nil). property :postal_code ## # :attr_reader: # Public: The country code (or nil). property :country end # Public: A representation of Transaction Payment meta information. class TransactionPaymentMeta < BaseModel ## # :attr_reader: property :by_order_of ## # :attr_reader: property :ppd_id ## # :attr_reader: property :payee ## # :attr_reader: property :payer ## # :attr_reader: property :payment_method ## # :attr_reader: property :payment_processor ## # :attr_reader: property :reason ## # :attr_reader: property :reference_number end # Public: A representation of Transaction. class Transaction < BaseModel ## # :attr_reader: # Public: The String transaction ID. property :transaction_id ## # :attr_reader: # Public: The String account ID. property :account_id ## # :attr_reader: # Public: The String account owner (or nil). property :account_owner ## # :attr_reader: # Public: The Numeric amount (or nil). property :amount ## # :attr_reader: # Public: The Array of String category (or nil). # E.g. ["Payment", "Credit Card"]. property :category ## # :attr_reader: # Public: The String category_id (or nil). # E.g. "16001000". property :category_id ## # :attr_reader: # Public: The String transaction date. E.g. "2017-01-01". property :date ## # :attr_reader: # Public: The location where transaction occurred (TransactionLocation). property :location, coerce: TransactionLocation ## # :attr_reader: # Public: The String merchant name (or nil). # E.g. "Burger King". property :merchant_name ## # :attr_reader: # Public: The String transaction name (or nil). # E.g. "CREDIT CARD 3333 PAYMENT *//". property :name ## # :attr_reader: # Public: The String original description (or nil). property :original_description ## # :attr_reader: # Public: The payment meta information (TransactionPaymentMeta). property :payment_meta, coerce: TransactionPaymentMeta ## # :attr_reader: # Public: The Boolean pending flag (or nil). property :pending ## # :attr_reader: # Public: The String pending transaction ID (or nil). property :pending_transaction_id ## # :attr_reader: # Public: The String transaction type (or nil). E.g. "special", or # "place". property :transaction_type ## # :attr_reader: # Public: The String ISO currency code for the amount property :iso_currency_code ## # :attr_reader: # Public: The String unofficial currency code for the amount property :unofficial_currency_code ## # :attr_reader: # Public: The String channel used to make a payment, e.g. # "online", "in store", or "other". property :payment_channel ## # :attr_reader: # Public: The String date that the transaction was authorized, # e.g. "2017-01-01". property :authorized_date ## # :attr_reader: # Public: The String transaction code, e.g. "direct debit". property :transaction_code end # Public: A representation of an InvestmentTransaction in an investment # account. class InvestmentTransaction < BaseModel ## # :attr_reader: # Public: The String investment transaction ID. property :investment_transaction_id ## # :attr_reader: # Public: The String account ID. property :account_id ## # :attr_reader: # Public: The String security ID. property :security_id ## # :attr_reader: # Public: The String transaction date. E.g. "2017-01-01". property :date ## # :attr_reader: # Public: The String transaction name (or nil). # E.g. "CREDIT CARD 3333 PAYMENT *//". property :name ## # :attr_reader: # Public: The Numeric quantity of the security involved (if applicable). property :quantity ## # :attr_reader: # Public: The Numeric amount (or nil). property :amount ## # :attr_reader: # Public: The Numeric price of the security that was used for the trade # (if applicable). property :price ## # :attr_reader: # Public: The Numeric fee amount. property :fees ## # :attr_reader: # Public: The String transaction type (or nil). E.g. "buy" or "sell". property :type ## # :attr_reader: # Public: The String transaction type (or nil). E.g. "buy" or "sell". property :subtype ## # :attr_reader: # Public: The ISO currency code of the transaction, either USD or CAD. # Always nil if unofficial_currency_code is non-nil. property :iso_currency_code ## # :attr_reader: # Public: The unofficial currency code associated with the transaction. # Always nil if iso_currency_code is non-nil. property :unofficial_currency_code ## # :attr_reader: # Public: Present if the transaction class is cancel, and indicates the # ID of the transaction which was cancelled. property :cancel_transaction_id end # Public: A representation of a Holding in an investment account. class Holding < BaseModel ## # :attr_reader: # Public: The String account ID. property :account_id ## # :attr_reader: # Public: The String security ID. property :security_id ## # :attr_reader: # Public: The Numeric value of the holding (price * quantity) as reported # by the institution. property :institution_value ## # :attr_reader: # Public: The Numeric price of the holding as reported by the institution. property :institution_price ## # :attr_reader: # Public: The Numeric quantity. property :quantity ## # :attr_reader: # Public: The String date when the price reported by the institution was # current. E.g. "2017-01-01". property :institution_price_as_of ## # :attr_reader: # Public: The Numeric cost basis. property :cost_basis ## # :attr_reader: # Public: The ISO currency code of the holding, either USD or CAD. # Always nil if unofficial_currency_code is non-nil. property :iso_currency_code ## # :attr_reader: # Public: The unofficial currency code associated with the holding. # Always nil if iso_currency_code is non-nil. property :unofficial_currency_code end # Public: A representation of a Security. class Security < BaseModel ## # :attr_reader: # Public: The String security ID. property :security_id ## # :attr_reader: # Public: The String CUSIP identitfier of this security. property :cusip ## # :attr_reader: # Public: The String SEDOL identifier of this security. property :sedol ## # :attr_reader: # Public: The String ISIN identifier of this security. property :isin ## # :attr_reader: # Public: The String ID of this security as reported by the institution. property :institution_security_id ## # :attr_reader: # Public: The String institution ID (if institution_security_id is set). property :institution_id ## # :attr_reader: # Public: The String security ID of the proxied security. property :proxy_security_id ## # :attr_reader: # Public: The String security name. property :name ## # :attr_reader: # Public: The String ticker symbol. property :ticker_symbol ## # :attr_reader: # Public: The Boolean flag indicating whether this security is # cash-equivalent. property :is_cash_equivalent ## # :attr_reader: # Public: The String Type. property :type ## # :attr_reader: # Public: The Numeric close price. property :close_price ## # :attr_reader: # Public: The String date when the close price was current. property :close_price_as_of ## # :attr_reader: # Public: The ISO currency code of the security, either USD or CAD. # Always nil if unofficial_currency_code is non-nil. property :iso_currency_code ## # :attr_reader: # Public: The unofficial currency code associated with the security. # Always nil if iso_currency_code is non-nil. property :unofficial_currency_code end # Public: A representation of an asset report owner. class AssetReportOwner < BaseModel ## # :attr_reader: # Public: A list of names associated with the account by the financial # institution. property :names, coerce: Array[String] ## # :attr_reader: # Public: A list of phone numbers associated with the account by the # financial institution; see IdentityPhoneNumber number object for # fields. property :phone_numbers, coerce: Array[IdentityPhoneNumber] ## # :attr_reader: # Public: A list of emails associated with the account by the financial # institution; see IdentityEmail object for fields. property :emails, coerce: Array[IdentityEmail] ## # :attr_reader: # Public: Data about the various addresses associated with the account # by the financial institution; see IdentityAddress object for fields. property :addresses, coerce: Array[IdentityAddress] end # Public: A representation of an asset report balance. class AssetReportBalance < BaseModel ## # :attr_reader: # Public: The available balance as reported by the financial institution. # This is usually, but not always, the current balance less any # outstanding holds or debits that have not yet posted to the account. property :available ## # :attr_reader: # Public: The total amount of funds in the account. property :current ## # :attr_reader: # Public: The ISO currency code of the transaction, either USD or CAD. # Always nil if unofficial_currency_code is non-nil. property :iso_currency_code ## # :attr_reader: # Public: The unofficial currency code associated with the transaction. # Always nil if iso_currency_code is non-nil. property :unofficial_currency_code end # Public: A representation of an asset report historical balance. class AssetReportHistoricalBalance < BaseModel ## # :attr_reader: # Public: The date of the calculated historical balance. property :date ## # :attr_reader: # Public: The total amount of funds in the account, calculated from the # current balance in the balance object by subtracting inflows and adding # back outflows according to the posted date of each. property :current ## # :attr_reader: # Public: The ISO currency code of the transaction, either USD or CAD. # Always nil if unofficial_currency_code is non-nil. property :iso_currency_code ## # :attr_reader: # Public: The unofficial currency code associated with the transaction. # Always nil if iso_currency_code is non-nil. property :unofficial_currency_code end # Public: A representation of an asset report transaction. class AssetReportTransaction < BaseModel ## # :attr_reader: # Public: Plaid's unique identifier for the account. property :account_id ## # :attr_reader: # Public: Plaid's unique identifier for the transaction. property :transaction_id ## # :attr_reader: # Public: For pending transactions, Plaid returns the date the # transaction occurred; for posted transactions, Plaid returns the date # the transaction posts; both dates are returned in an ISO 8601 format # (YYYY-MM-DD). property :date ## # :attr_reader: # Public: The string returned by the financial institution to describe # the transaction. property :original_description ## # :attr_reader: # Public: When true, identifies the transaction as pending or unsettled; # pending transaction details (description, amount) may change before # they are settled. property :pending ## # :attr_reader: # Public: The settled dollar value; positive values when money moves out # of the account, negative values when money moves in. property :amount ## # :attr_reader: # Public: The ISO currency code of the transaction, either USD or CAD. # Always nil if unofficial_currency_code is non-nil. property :iso_currency_code ## # :attr_reader: # Public: The unofficial currency code associated with the transaction. # Always nil if iso_currency_code is non-nil. property :unofficial_currency_code ## # :attr_reader: Public: The String account owner (or nil). This field # only appears in an Asset Report with Insights. property :account_owner ## # :attr_reader: Public: The Array of String category (or nil). This field # only appears in an Asset Report with Insights. E.g. ["Payment", "Credit # Card"]. property :category ## # :attr_reader: Public: The String category_id (or nil). This field only # appears in an Asset Report with Insights. E.g. "16001000". property :category_id ## # :attr_reader: Public: The String date of the transaction (or nil). This # field only appears in an Asset Report with Insights. property :date_transacted ## # :attr_reader: Public: The location where transaction occurred # (TransactionLocation). This field only appears in an Asset Report with # Insights. property :location, coerce: TransactionLocation ## # :attr_reader: Public: The String transaction name (or nil). This field # only appears in an Asset Report with Insights. E.g. "CREDIT CARD 3333 # PAYMENT *//". property :name ## # :attr_reader: Public: The payment meta information # (TransactionPaymentMeta). This field only appears in an Asset Report # with Insights. property :payment_meta, coerce: TransactionPaymentMeta ## # :attr_reader: Public: The String pending transaction ID (or nil). This # field only appears in an Asset Report with Insights. property :pending_transaction_id ## # :attr_reader: Public: The String transaction type (or nil). E.g. # "special", or "place". This field only appears in an Asset Report with # Insights. property :transaction_type end # Public: A representation of an asset report account. class AssetReportAccount < BaseModel ## # :attr_reader: # Public: Plaid's unique identifier for the account. property :account_id ## # :attr_reader: # Public: The last 2-5 digits of the account's number. property :mask ## # :attr_reader: # Public: The name of the account, either assigned by the user or by the # financial institution itself. property :name ## # :attr_reader: # Public: The official name of the account as given by the financial # institution. property :official_name ## # :attr_reader: # Public: The primary type of the account (e.g., "depository"). property :type ## # :attr_reader: # Public: The secondary type of the account (e.g., "checking"). property :subtype ## # :attr_reader: # Public: Data returned by the financial institution about the account # owner or owners; see AssetReportOwner object for fields. property :owners, coerce: Array[AssetReportOwner] ## # :attr_reader: # Public: Data about the various balances on the account; see # AssetReportBalance object for fields. property :balances, coerce: AssetReportBalance ## # :attr_reader: # Public: Calculated data about the historical balances on the account; # see AssetReportHistoricalBalance object for fields. property :historical_balances, coerce: Array[AssetReportHistoricalBalance] ## # :attr_reader: # Public: Data about the transactions. property :transactions, coerce: Array[AssetReportTransaction] ## # :attr_reader: # Public: The duration of transaction history available for this Item, # typically defined as the time since the date of the earliest # transaction in that account. property :days_available end # Public: A representation of an asset report item. class AssetReportItem < BaseModel ## # :attr_reader: # Public: Plaid's unique identifier for the Item. property :item_id ## # :attr_reader: # Public: The full financial institution name associated with the Item. property :institution_name ## # :attr_reader: # Public: The financial institution associated with the Item. property :institution_id ## # :attr_reader: # Public: The date and time when this Item's data was retrieved from the # financial institution. property :date_last_updated ## # :attr_reader: # Public: Data about each of the accounts open on the Item; see Account # object for fields. property :accounts, coerce: Array[AssetReportAccount] end # Public: A representation of an asset report user. class AssetReportUser < BaseModel ## # :attr_reader: # Public: An identifier you determine and submit for the user. property :client_user_id ## # :attr_reader: # Public: The user's first name. property :first_name ## # :attr_reader: # Public: The user's middle name. property :middle_name ## # :attr_reader: # Public: The user's last name. property :last_name ## # :attr_reader: # Public: The user's social security number. Format: # "\d\d\d-\d\d-\d\d\d\d". property :ssn ## # :attr_reader: # Public: The user's phone number Format: # "+{country_code}{area code and subscriber number}", e.g. # "+14155555555" (known as E.164 format) property :phone_number ## # :attr_reader: # Public: The user's email address. property :email end # Public: A representation of an asset report. class AssetReport < BaseModel ## # :attr_reader: # Public: Plaid's unique identifier for this asset report. property :asset_report_id ## # :attr_reader: # Public: An identifier you determine and submit for the Asset Report. property :client_report_id ## # :attr_reader: # Public: The date and time when the Asset Report was created. property :date_generated ## # :attr_reader: # Public: The duration of transaction history you requested. property :days_requested ## # :attr_reader: # Public: Data submitted by you about the user whose Asset Report is # being compiled; see AssetReportUser object for fields. property :user, coerce: AssetReportUser ## # :attr_reader: # Public: Data returned by Plaid about each of the Items included in the # Asset Report; see AssetReportItem object for fields. property :items, coerce: Array[AssetReportItem] end # Public: A representation of an eligibility for the Public Service Loan # Forgiveness program. class PSLFStatus < BaseModel ## # :attr_reader: # Public: The estimated date borrower will have completed 120 qualifying # monthly payments. property :estimated_eligibility_date ## # :attr_reader: # Public: The number of qualifying payments that have been made. property :payments_made ## # :attr_reader: # Public: The number of qualifying payments that are remaining. property :payments_remaining end # Public: A representation of the status of a student loan. class StudentLoanStatus < BaseModel ## # :attr_reader: # Public: The status of the loan, e.g. "repayment", "deferment", # "forbearance". property :type ## # :attr_reader: # Public: The date the status expires. property :end_date end # Public: A representation of a student loan repayment plan. class StudentLoanRepaymentPlan < BaseModel ## # :attr_reader: # Public: The type of repayment plan, e.g., "standard", "income". property :type ## # :attr_reader: # Public: The full name of the repayment plan, e.g. "Standard Repayment". property :description end # Public: A representation of a student loan servicer address. class StudentLoanServicerAddress < BaseModel ## # :attr_reader: # Public: The full city name property :city ## # :attr_reader: # Public: The ISO 3166-1 alpha-2 country code property :country ## # :attr_reader: # Public: The postal code. property :postal_code ## # :attr_reader: # Public: The region or state. property :region ## # :attr_reader: # Public: The full street address. property :street end # Public: A representation of a student loan liability. class StudentLoanLiability < BaseModel ## # :attr_reader: # Public: The String account ID. E.g. # "vzeNDwK7KQIm4yEog683uElbp9GRLEFXGK98D". property :account_id ## # :attr_reader: # Public: The account number of the loan. property :account_number ## # :attr_reader: # Public: The dates on which loaned funds were disbursed or will be # disbursed. These are often in the past. property :disbursement_dates ## # :attr_reader: # Public: The date when the student loan is expected to be paid off. property :expected_payoff_date ## # :attr_reader: # Public: The guarantor of the student loan. property :guarantor ## # :attr_reader: # Public: The interest rate on loans shown as a percentage. property :interest_rate_percentage ## # :attr_reader: # Public: True if a payment is currently overdue. property :is_overdue ## # :attr_reader: # Public: The amount of the last payment. property :last_payment_amount ## # :attr_reader: # Public: The date of the last payment. property :last_payment_date ## # :attr_reader: # Public: The outstanding balance on the last statement. property :last_statement_balance ## # :attr_reader: # Public: The date the last statement was issued. property :last_statement_issue_date ## # :attr_reader: # Public: The status of the loan, e.g. "Repayment", "Deferment", # "Forbearance". property :loan_status, coerce: StudentLoanStatus ## # :attr_reader: # Public: The type of loan, e.g., "Consolidation Loans". property :loan_name ## # :attr_reader: # Public: The minimum payment due for the next billing cycle. property :minimum_payment_amount ## # :attr_reader: # Public: The due date for the next payment. property :next_payment_due_date ## # :attr_reader: # Public: The date on which the loan was initially lent. property :origination_date ## # :attr_reader: # Public: The original principal balance of the loan. property :origination_principal_amount ## # :attr_reader: # Public: The dollar amount of the accrued interest balance. property :outstanding_interest_amount ## # :attr_reader: # Public: The relevant account number that should be used to reference # this loan for payments. This is sometimes different from # account_number. property :payment_reference_number ## # :attr_reader: # Public: Information about the student's eligibility in the Public # Service Loan Forgiveness program. property :pslf_status, coerce: PSLFStatus ## # :attr_reader: # Public: Information about the repayment plan. property :repayment_plan, coerce: StudentLoanRepaymentPlan ## # :attr_reader: # Public: The sequence number of the student loan. property :sequence_number ## # :attr_reader: # Public: The servicer address for which payments should be sent. property :servicer_address, coerce: StudentLoanServicerAddress ## # :attr_reader: # Public: The year to date (YTD) interest paid. property :ytd_interest_paid ## # :attr_reader: # Public: The year to date (YTD) principal paid. property :ytd_principal_paid end # Public: A representation of a credit card liability APR class CreditCardLiabilityAPRs < BaseModel ## # :attr_reader: # Public: Annual Percentage Rate applied. property :apr_percentage ## # :attr_reader: # Public: Enumerated response from the following options: # "balance_transfer_apr", "cash_apr", "purchase_apr", or # "special". property :apr_type ## # :attr_reader: # Public: Amount of money that is subjected to the APR if a # balance was carried beyond payment due date. How it is # calculated can vary by card issuer. It is often calculated as # an average daily balance. property :balance_subject_to_apr ## # :attr_reader: # Public: Amount of money charged due to interest from last # statement. property :interest_charge_amount end # Public: A representation of a credit card liability class CreditCardLiability < BaseModel ## # :attr_reader: # Public: The ID of the account that this liability belongs to. property :account_id ## # :attr_reader: # Public: See the APR object schema property :aprs, coerce: Array[CreditCardLiabilityAPRs] ## # :attr_reader: # Public: true if a payment is currently overdue. property :is_overdue ## # :attr_reader: # Public: The amount of the last payment. property :last_payment_amount ## # :attr_reader: # Public: The date of the last payment. property :last_payment_date ## # :attr_reader: # Public: The outstanding balance on the last statement. property :last_statement_balance ## # :attr_reader: # Public: The date of the last statement. property :last_statement_issue_date ## # :attr_reader: # Public: The minimum payment due for the next billing cycle. property :minimum_payment_amount ## # :attr_reader: # Public: The due date for the next payment. The due date is null # if a payment is not expected. property :next_payment_due_date end # Public: A representation of someone's liabilities of all types. class Liabilities < BaseModel include Hashie::Extensions::IgnoreUndeclared ## # :attr_reader: # Public: Student loan liabilities associated with the item. property :student, coerce: Array[StudentLoanLiability] ## # :attr_reader: # Public: Credit card liabilities associated with the item. property :credit, coerce: Array[CreditCardLiability] end # Public: A representation of a payment amount. class PaymentAmount < BaseModel ## # :attr_reader: # Public: Currency for the payment amount. property :currency ## # :attr_reader: # Public: Value of the payment amount. property :value end # Public: A representation of a payment amount. class PaymentSchedule < BaseModel ## # :attr_reader: # Public: Interval for the standing order. property :interval ## # :attr_reader: # Public: Day or the week or day of the month to execute # the standing order. property :interval_execution_day ## # :attr_reader: # Public: Start date for the standing order. property :start_date end # Public: A representation of a payment amount. class PaymentRecipientAddress < BaseModel ## # :attr_reader: # Public: Street name. property :street ## # :attr_reader: # Public: City. property :city ## # :attr_reader: # Public: Postal code. property :postal_code ## # :attr_reader: # Public: Country. property :country end # Public: A representation of a payment recipient BACS number. class PaymentRecipientBACS < BaseModel ## # :attr_reader: # Public: The String account number. E.g. "66374958". property :account ## # :attr_reader: # Public: The String sort code. E.g. "089999". property :sort_code end # Public: A representation of a payment recipient. class PaymentRecipient < BaseModel ## # :attr_reader: # Public: The recipient ID. property :recipient_id ## # :attr_reader: # Public: The recipient name. property :name ## # :attr_reader: # Public: The recipient IBAN. property :iban ## # :attr_reader: # Public: The recipient BACS number . property :bacs, coerce: PaymentRecipientBACS ## # :attr_reader: # Public: The recipient address. property :address, coerce: PaymentRecipientAddress end # Public: A representation of a payment. class Payment < BaseModel ## # :attr_reader: # Public: The payment ID. property :payment_id ## # :attr_reader: # Public: The payment token. property :payment_token ## # :attr_reader: # Public: The payment reference. property :reference ## # :attr_reader: # Public: The payment amount. property :amount, coerce: PaymentAmount ## # :attr_reader: # Public: The payment schedule. property :schedule, coerce: PaymentSchedule ## # :attr_reader: # Public: The payment's status. property :status ## # :attr_reader: # Public: The last status update time for payment. property :last_status_update ## # :attr_reader: # Public: The payment token's expiration time. property :payment_token_expiration_time ## # :attr_reader: # Public: The recipient ID for payment. property :recipient_id end # Public: Metadata associated with a link token. class LinkTokenMetadata < BaseModel ## # :attr_reader: # Public: List of products associated with the link token. property :initial_products ## # :attr_reader: # Public: The webhook associated with the link token. property :webhook ## # :attr_reader: # Public: The country codes associated with the link token. property :country_codes ## # :attr_reader: # Public: The language associated with the link token. property :language ## # :attr_reader: # Public: The account filters associated with the link token. property :account_filters ## # :attr_reader: # Public: The redirect URI associated with the link token. property :redirect_uri ## # :attr_reader: # Public: The client name associated with the link token. property :client_name end # Public: A representation of a payment amount. class WebhookVerificationKey < BaseModel ## # :attr_reader: # Public: alg. property :alg ## # :attr_reader: # Public: created_at. property :created_at ## # :attr_reader: # Public: crv. property :crv ## # :attr_reader: # Public: expired_at. property :expired_at ## # :attr_reader: # Public: kid. property :kid ## # :attr_reader: # Public: kty. property :kty ## # :attr_reader: # Public: use. property :use ## # :attr_reader: # Public: x. property :x ## # :attr_reader: # Public: y. property :y end end end
26.998191
80
0.616756
bfeeb0e15ea12f449c0af88bc70c30e31cfac44e
1,278
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "png/version" Gem::Specification.new do |spec| spec.name = "libpng-ruby" spec.version = PNG::VERSION spec.authors = ["Hiroshi Kuwagata"] spec.email = ["[email protected]"] spec.summary = %q{libpng interface for ruby} spec.description = %q{libpng interface for ruby} spec.homepage = "https://github.com/kwgt/libpng-ruby" spec.license = "MIT" if spec.respond_to?(:metadata) spec.metadata["homepage_uri"] = spec.homepage else raise "RubyGems 2.0 or newer is required to protect against " \ "public gem pushes." end spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } end spec.bindir = "exe" spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.extensions = ["ext/png/extconf.rb"] spec.require_paths = ["lib"] spec.required_ruby_version = ">= 2.4.0" spec.add_development_dependency "bundler", ">= 2.1" spec.add_development_dependency "rake", ">= 10.0" spec.add_development_dependency "rake-compiler", "~> 1.1.0" end
31.170732
74
0.63615