source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/raise_api_error.rb | Ruby | apache-2.0 | 203 | main | 1,756 | # Allows making assertions like:
# .to raise_api_error(:UniquenessError, "some-message")
# or like:
# .to raise_api_error(:UniquenessError)
# If only the error name is given, the additional arguments will not be considered
# when matching API errors. This allows slightly more relaxed assertions.
RSpec::Matchers.def... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/validate_with_error.rb | Ruby | apache-2.0 | 203 | main | 374 | RSpec::Matchers.define :validate_with_error do |validation_result, field, error|
match do |validator|
validator.validate
@errors = validation_result.errors
field_errors = @errors.on(field)
field_errors && field_errors.include?(error)
end
failure_message do |_|
"Expected validator to fail with... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/have_nested_routes.rb | Ruby | apache-2.0 | 203 | main | 2,216 | RSpec::Matchers.define :have_nested_routes do |association_routes, _options={}|
errors = []
match do |controller|
actual_to_manies = controller.send(:to_many_relationships)
expected_to_manies = association_routes
actual_to_manies.each do |association_name, attr|
expected_actions_for_association =... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/match_object.rb | Ruby | apache-2.0 | 203 | main | 1,622 | RSpec::Matchers.define :match_object do |expected|
match do |actual|
expected == actual
end
failure_message do |actual|
break if actual == expected
object_eq(actual, expected)
@error_message.join("\n")
end
def object_eq(actual, expected, path=[])
@error_message ||= []
types = [actu... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/validate_without_error.rb | Ruby | apache-2.0 | 203 | main | 291 | RSpec::Matchers.define :validate_without_error do |validation_result|
match do |validator|
validator.validate
@errors = validation_result.errors
@errors.empty?
end
failure_message do |_|
"Expected validator to pass without errors but got #{@errors.inspect}"
end
end |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/have_annotations.rb | Ruby | apache-2.0 | 203 | main | 1,225 | RSpec::Matchers.define :have_annotations do |*expected|
actual_annotations = []
match do |actual|
actual_annotations = actual.annotations.map do |annotation|
{
prefix: annotation.key_prefix,
key_name: annotation.key_name,
value: annotation.value
}
end
if expected.an... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/be_a_deprecated_response.rb | Ruby | apache-2.0 | 203 | main | 402 | RSpec::Matchers.define :be_a_deprecated_response do |_|
match do |actual|
escaped_header = actual.headers['X-Cf-Warnings']
unescaped_header = CGI.unescape(escaped_header || '')
escaped_header && unescaped_header == 'Endpoint deprecated'
end
failure_message do |actual|
"expected that #{actual.head... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/matchers/have_queried_db_times.rb | Ruby | apache-2.0 | 203 | main | 1,082 | RSpec::Matchers.define :have_queried_db_times do |query_regex, expected_times|
match do |actual_blk|
stub = allow(Sequel::Model.db).to receive(:_execute)
stub.and_call_original
calls = stub.and_record_arguments
actual_blk.call
matched_calls = calls.select { |call| call[1] =~ query_regex }
retu... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/bootstrap/db_connection_string.rb | Ruby | apache-2.0 | 203 | main | 839 | class DbConnectionString
def initialize(connection_string: ENV.fetch('DB_CONNECTION_STRING', nil), db_type: ENV.fetch('DB', nil))
@connection_string = connection_string || default_connection_string(db_type)
end
def to_s
@connection_string
end
private
def default_connection_string(db_type)
"#{... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/bootstrap/spec_bootstrap.rb | Ruby | apache-2.0 | 203 | main | 1,543 | require 'support/bootstrap/test_config'
require 'support/bootstrap/table_recreator'
require 'cloud_controller/seeds'
require 'cloud_controller/telemetry_logger'
require 'cloud_controller/steno_configurer'
module VCAP::CloudController
module SpecBootstrap
@initialized = false
def self.init(recreate_test_tabl... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/bootstrap/db_config.rb | Ruby | apache-2.0 | 203 | main | 1,393 | require 'cloud_controller/db'
require 'cloud_controller/database_parts_parser'
require_relative 'db_connection_string'
class DbConfig
def initialize(connection_string: ENV.fetch('DB_CONNECTION_STRING', nil), db_type: ENV.fetch('DB', nil))
@connection_string = DbConnectionString.new(connection_string: connection_... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/bootstrap/table_recreator.rb | Ruby | apache-2.0 | 203 | main | 1,051 | require_relative 'fake_model_tables'
class TableRecreator
SAFE_VIEWS = [:pg_stat_statements].freeze
def initialize(db)
@db = db
end
def recreate_tables(without_fake_tables: false, without_migration: false)
prepare_database
unless without_migration
(db.views - SAFE_VIEWS).each do |view|
... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/bootstrap/test_config.rb | Ruby | apache-2.0 | 203 | main | 2,814 | require 'support/bootstrap/db_config'
require 'support/paths'
require 'cloud_controller/config'
require 'fog/core/mock'
require 'cloud_controller/dependency_locator'
module TestConfig
class << self
def context
@context || :api
end
attr_writer :context
def override(**)
@config_instance =... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/bootstrap/fake_model_tables.rb | Ruby | apache-2.0 | 203 | main | 7,373 | class FakeModelTables
def initialize(db)
@db = db
end
def create_tables
try_drop_tables
tables_for_model_controller_spec
tables_for_vcap_relations_spec
tables_for_sequel_case_insensitive_string_monkeypatch
tables_for_query_spec
tables_for_sequel_paginator_spec
end
private
def ... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/fakes/deployment_model_test_factory.rb | Ruby | apache-2.0 | 203 | main | 438 | module VCAP
module CloudController
class DeploymentModelTestFactory
class << self
def make(*)
deployment = DeploymentModel.make(*)
DeploymentProcessModel.make(
deployment: deployment,
process_guid: deployment.deploying_web_process.guid,
process... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/fakes/fake_service_broker_v2_client.rb | Ruby | apache-2.0 | 203 | main | 2,741 | class FakeServiceBrokerV2Client
attr_accessor :credentials, :syslog_drain_url, :volume_mounts, :service_name, :plan_name, :plan_schemas, :parameters
def initialize(_attrs={})
@credentials = { 'username' => 'cool_user' }
@syslog_drain_url = 'syslog://drain.example.com'
@volume_mounts = []
@service_n... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/fakes/process_model_factory.rb | Ruby | apache-2.0 | 203 | main | 3,549 | module VCAP
module CloudController
class ProcessModelFactory
APP_ATTRIBUTES = %i[name space environment_json stack enable_ssh].freeze
PACKAGE_ATTRIBUTES = %i[docker_image docker_credentials].freeze
class << self
def make(*args)
options = args.extract_options!.symbolize_key... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/fakes/blueprints.rb | Ruby | apache-2.0 | 203 | main | 25,466 | require 'securerandom'
require_relative 'process_model_factory'
require_relative 'deployment_model_test_factory'
require_relative '../test_models'
Sham.define do
email { |index| "email-#{index}@somedomain.com" }
name { |index| "name-#{index}" }
label { |index| "label-#{... |
github | cloudfoundry/cloud_controller_ng | https://github.com/cloudfoundry/cloud_controller_ng | spec/support/fakes/fake_logger.rb | Ruby | apache-2.0 | 203 | main | 280 | module VCAP::CloudController
FakeLogger = Struct.new(:log_messages) do
def info(message, _)
log_messages << message
end
def debug(message, _=nil)
log_messages << message
end
def error(message, _)
log_messages << message
end
end
end |
github | markbates/cover_me | https://github.com/markbates/cover_me | Rakefile | Ruby | mit | 203 | master | 1,258 | require 'rubygems'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfil... |
github | markbates/cover_me | https://github.com/markbates/cover_me | cover_me.gemspec | Ruby | mit | 203 | master | 2,364 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "cover_me"
s.version = "1.2.0.20110907090445"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["markbates"]
s.date = "2011-09-07"
s.description = "CoverMe - Code Coverage fo... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me.rb | Ruby | mit | 203 | master | 984 | # http://engineering.attinteractive.com/2010/08/code-coverage-in-ruby-1-9/
require 'coverage'
require 'erb'
require 'fileutils'
require 'configatron'
require 'hashie'
module CoverMe
class << self
def complete!
data_file = CoverMe.config.results.store
if File.exists?(data_file)
data =... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/generators/cover_me/install/install_generator.rb | Ruby | mit | 203 | master | 482 | require 'rails/generators/base'
module CoverMe
class InstallGenerator < Rails::Generators::Base #:nodoc:
desc 'Installs a Rake task for the CoverMe gem.'
def self.source_root
@_cover_me_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end
def self.... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/generators/cover_me/install/templates/cover_me.rake | Ruby | mit | 203 | master | 264 | namespace :cover_me do
desc "Generates and opens code coverage report."
task :report do
require 'cover_me'
CoverMe.complete!
end
end
task :test do
Rake::Task['cover_me:report'].invoke
end
task :spec do
Rake::Task['cover_me:report'].invoke
end |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/results.rb | Ruby | mit | 203 | master | 1,070 | module CoverMe
module Results
class << self
def read_results(path = CoverMe.config.results.store)
data = {}
if File.exists?(path)
data = eval(File.read(path)) || {}
end
return data
end
def merge_results!(cov_results, path = CoverMe.con... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/formatter.rb | Ruby | mit | 203 | master | 1,228 | # A base class for implementing formatters of the coverage.
#
# All subclasses must implement the following methods:
#
# def format_report(report)
# end
#
# def format_index(index)
# end
class CoverMe::Formatter
attr_accessor :options
def initialize(options = {}) # :nodoc:
self.options = option... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/processor.rb | Ruby | mit | 203 | master | 1,642 | # Processes the coverage results and then formats them.
class CoverMe::Processor
attr_accessor :coverage_results
attr_accessor :options
attr_accessor :index
def initialize(coverage_results, options = {}) # :nodoc:
self.coverage_results = coverage_results
self.options = ({:patterns => CoverMe.confi... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/directory_report.rb | Ruby | mit | 203 | master | 831 | # Used to represent the directory summary.
class CoverMe::DirectoryReport
attr_accessor :name
attr_accessor :reports
attr_accessor :lines_of_code
attr_accessor :lines_executed
def initialize(name, reports) # :nodoc:
self.name = name
self.reports = reports
self.lines_of_code = 0
self.lines_exe... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/hash.rb | Ruby | mit | 203 | master | 204 | class Hash # :nodoc:
def to_mash
h = self.dup
h.each do |k, v|
if v.is_a?(Hash) && !v.is_a?(Hashie::Mash)
h[k] = v.to_mash
end
end
Hashie::Mash.new(h)
end
end |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/global_report.rb | Ruby | mit | 203 | master | 370 | # Used to represent the module summary.
class CoverMe::GlobalReport
attr_accessor :lines_of_code
attr_accessor :lines_executed
def initialize(reports) # :nodoc:
self.lines_of_code = 0
self.lines_executed = 0
reports.each do |report|
self.lines_of_code += report.lines_of_code
self.lines_ex... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/report.rb | Ruby | mit | 203 | master | 3,819 | # Used to represent the details of a particular file.
class CoverMe::Report
attr_accessor :original_filename # full filename, "/Users/me/my/file.rb"
attr_accessor :filename # shortened relative name, "my/file.rb"
attr_accessor :coverage
attr_accessor :lines
attr_accessor :lines_of_code
attr_accessor :lines_... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/emma_formatter.rb | Ruby | mit | 203 | master | 886 | # Generates Emma-style xml coverage files.
class CoverMe::EmmaFormatter < CoverMe::Formatter
def initialize(options = {}) # :nodoc:
super
self.options = ({:output_path => CoverMe.config.emma_formatter.output_path}.merge(self.options)).to_mash
end
def format_report(report)
# nothing to do
end
# ... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/html_formatter.rb | Ruby | mit | 203 | master | 1,237 | # Generates pretty HTML of the code coverage.
class CoverMe::HtmlFormatter < CoverMe::Formatter
def initialize(options = {}) # :nodoc:
super
self.options = ({:output_path => CoverMe.config.html_formatter.output_path}.merge(self.options)).to_mash
end
# Formats a CoverMe::Report object using the _repo... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/index.rb | Ruby | mit | 203 | master | 1,212 | # Used to generate an index page for the code coverage.
class CoverMe::Index
attr_accessor :reports
def initialize(reports = []) # :nodoc:
self.reports = reports
end
# Returns the total number of lines across all files.
def total_lines
unless @total_lines
@total_lines = self.reports.inject... |
github | markbates/cover_me | https://github.com/markbates/cover_me | lib/cover_me/config.rb | Ruby | mit | 203 | master | 2,466 | module CoverMe
class << self
# Yields up a configuration object when given a block.
# Without a block it just returns the configuration object.
# Uses Configatron under the covers.
#
# Example:
# CoverMe.config do |c|
# c.foo = :bar
# end
#
# CoverMe.config.foo # =>... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/spec_helper.rb | Ruby | mit | 203 | master | 573 | require 'rubygems'
require 'rspec'
require File.join(File.dirname(__FILE__), '..', 'lib', 'cover_me')
CoverMe.config do |c|
c.at_exit = Proc.new {}
end
CoverMe.config.project.root = File.join(File.dirname(__FILE__), '..', 'fake_project')
RSpec.configure do |config|
config.before(:all) do
end
conf... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/cover_me/processor_spec.rb | Ruby | mit | 203 | master | 814 | require 'spec_helper'
describe CoverMe::Processor do
before(:each) do
@formatter = CoverMe::HtmlFormatter.new
@processor = CoverMe::Processor.new({
File.join(CoverMe.config.project.root, 'lib/foo/bar.rb') => [1, 0, nil, 69, 10, nil, 3],
File.join(CoverMe.config.project.root, 'app/models/user.r... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/cover_me/formatter_spec.rb | Ruby | mit | 203 | master | 631 | require 'spec_helper'
describe CoverMe::Formatter do
before(:each) do
@formatter = CoverMe::Formatter.new
end
describe "format" do
it "should call the appropriate method for the object" do
lambda {@formatter.format(CoverMe::Report.new('foo.rb'))}.should raise_error(NoMethodError, /format... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/cover_me/report_spec.rb | Ruby | mit | 203 | master | 3,535 | require 'spec_helper'
describe CoverMe::Report do
before(:each) do
@report = CoverMe::Report.new(File.join(CoverMe.config.project.root, '/lib/foo/bar.rb'), [1, 0, nil, 24, nil, 1])
end
describe "initialize" do
it "should clean up the file name" do
r = CoverMe::Report.new('/foo/bar.rb')
... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/cover_me/html_formatter_spec.rb | Ruby | mit | 203 | master | 1,317 | require 'spec_helper'
describe CoverMe::HtmlFormatter do
before(:each) do
@formatter = CoverMe::HtmlFormatter.new
end
describe "format_report" do
it "should generate HTML for a report" do
puts "CoverMe.config.html_formatter.output_path: #{CoverMe.config.html_formatter.output_path}"
... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/cover_me/config_spec.rb | Ruby | mit | 203 | master | 1,085 | require 'spec_helper'
describe CoverMe do
describe "config" do
it "should return the configatron.cover_me object" do
CoverMe.config.should === configatron.cover_me
end
it "should allow settings to be set via a block" do
configatron.temp do
CoverMe.config.foo.should be_nil... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/cover_me/results_spec.rb | Ruby | mit | 203 | master | 1,684 | require 'spec_helper'
describe CoverMe::Results do
before(:each) do
@idontexist_path = File.join(CoverMe.config.project.root, 'idontexist.data')
res = {'file1' => [0, nil, 1],
'file2' => [nil, 1, nil]}
File.open(CoverMe.config.results.store, 'w') do |f|
f.write(res.inspect)
e... |
github | markbates/cover_me | https://github.com/markbates/cover_me | spec/cover_me/index_spec.rb | Ruby | mit | 203 | master | 1,066 | require 'spec_helper'
describe CoverMe::Index do
before(:each) do
@bar_report = CoverMe::Report.new('/foo/bar.rb', [1, 0, nil, 24, nil, 1])
@user_report = CoverMe::Report.new('/user.rb', [10, nil, nil, 69, nil, 1, 1, 1, 0, nil])
@index = CoverMe::Index.new([@bar_report, @user_report])
end
descr... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | drivesync.rb | Ruby | mit | 203 | master | 2,066 | require_relative 'src/synchronizer'
require_relative 'src/config_manager'
require 'open-uri'
VERSION = '1.4.0'
CHANGELOG_URL = 'https://raw.githubusercontent.com/MStadlmeier/drivesync/master/CHANGELOG'
def check_for_update
#Not at all hacky way of checking for updates
begin
changelog = open(CHANGELOG_URL).rea... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/logger.rb | Ruby | mit | 203 | master | 306 | #0 = nothing, 1 = errors, 2 = messages, 3 = notices
LOG_LEVEL = 2
module Log
def log_error message
puts "ERROR : #{message}" if LOG_LEVEL > 0
end
def log_message message
puts message if LOG_LEVEL > 1
end
def log_notice message
puts "NOTICE : #{message}" if LOG_LEVEL > 2
end
end |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/config_manager.rb | Ruby | mit | 203 | master | 3,888 | class ConfigManager
require 'fileutils'
require 'yaml'
CONFIG_PATH = File.expand_path('~/.drivesync/config.yml')
CONFIG_PATH_OLD = File.expand_path("..", File.dirname(__FILE__)) + "/config.yml"
DEFAULT_CONFIG_PATH = File.dirname(__FILE__) + '/defaultconfig'
CONFIG_VERSION = 1.3
attr_accessor :config
... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/time.rb | Ruby | mit | 203 | master | 463 | require 'date'
class Time
def to_datetime
seconds = sec + Rational(usec, 10**6)
offset = Rational(utc_offset, 60*60*24)
DateTime.new year, month, day, hour, min, seconds, offset
end
end
class DateTime
#For some reason, the > operator returns true even for 2 identical DateTimes, so I guess this is neces... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/helper.rb | Ruby | mit | 203 | master | 1,083 | class Helper
def self.file_ignored? path, config
if config['inclusion'] == 'whitelist'
config['whitelist'].each do |entry|
return false if File.fnmatch entry, path
end
return true
else
config['blacklist'].each do |entry|
return true if File.fnmatch entry, path
end... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/drive_manager.rb | Ruby | mit | 203 | master | 7,849 | require 'google/apis/drive_v3'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
require_relative './file'
require_relative './logger'
require_relative './helper'
include Log
class DriveManager
OOB_URI = 'http://localhost'
SCOPE = Google::Apis::DriveV3::AUTH_DRIVE
CREDENTIAL... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/synchronizer.rb | Ruby | mit | 203 | master | 10,411 | require 'google/apis/drive_v3'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'json'
require 'yaml'
require 'fileutils'
require 'io/console'
require_relative './drive_manager'
require_relative './file'
require_relative './local_manager'
require_relative './time'
require_relative './helper'
... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/local_manager.rb | Ruby | mit | 203 | master | 906 | include Log
require 'fileutils'
require_relative './helper'
class LocalManager
attr_accessor :files
def initialize config
@root = config['drive_path']
@root += '/' if @root[-1] != '/'
@config = config
end
def get_files
@files = Helper.dir_glob(File.join(@root, '**', '*'), @config['follow_syml... |
github | MStadlmeier/drivesync | https://github.com/MStadlmeier/drivesync | src/file.rb | Ruby | mit | 203 | master | 336 | class Google::Apis::DriveV3::File
attr_accessor :path
end
#Keeps track of the difference between local and remote
class FileDiff
#Remote ahead and both are Drive::File list
#Local ahead is string list
attr_accessor :remote_ahead, :local_ahead, :both
def initialize
@remote_ahead = []
@local_ahead = []
@bo... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | ims-lti.gemspec | Ruby | mit | 203 | main | 1,398 | # coding: utf-8
# lib = File.expand_path('../lib', __FILE__)
# $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require_relative "lib/ims/lti/version"
Gem::Specification.new do |spec|
spec.name = 'ims-lti'
spec.version = IMS::LTI::VERSION
spec.authors = ['Instructure']
spec.email = 'opensource@instruct... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis.rb | Ruby | mit | 203 | main | 508 | module IMS
module LIS
require_relative 'lis/context_type/handles'
require_relative 'lis/context_type/urns'
require_relative 'lis/roles/institution/handles'
require_relative 'lis/roles/institution/urns'
require_relative 'lis/roles/system/handles'
require_relative 'lis/roles/system/urns'
req... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti.rb | Ruby | mit | 203 | main | 383 | require 'addressable/uri'
require 'builder'
require 'faraday'
require 'json'
require 'json/jwt'
require 'rexml/document'
require 'securerandom'
require 'simple_oauth'
module IMS
module LTI
require_relative 'lti/converters'
require_relative 'lti/errors'
require_relative 'lti/models'
require_relative '... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/context_type/urns.rb | Ruby | mit | 203 | main | 327 | module IMS::LIS
module ContextType
module URNs
CourseTemplate = "urn:lti:context-type:ims/lis/CourseTemplate"
CourseOffering = "urn:lti:context-type:ims/lis/CourseOffering"
CourseSection = "urn:lti:context-type:ims/lis/CourseSection"
Group = "urn:lti:context-type:ims/lis/Group"
end
e... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/context_type/handles.rb | Ruby | mit | 203 | main | 214 | module IMS::LIS
module ContextType
module Handles
CourseTemplate = "CourseTemplate"
CourseOffering = "CourseOffering"
CourseSection = "CourseSection"
Group = "Group"
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/roles/institution/handles.rb | Ruby | mit | 203 | main | 513 | module IMS::LIS
module Roles
module Institution
module Handles
Student = "Student"
Faculty = "Faculty"
Member = "Member"
Learner = "Learner"
Instructor = "Instructor"
Mentor = "Mentor"
Staff = "Staff"
Alumni = "Alumni"
ProspectiveStuden... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/roles/institution/urns.rb | Ruby | mit | 203 | main | 860 | module IMS::LIS
module Roles
module Institution
module URNs
Student = "urn:lti:instrole:ims/lis/Student"
Faculty = "urn:lti:instrole:ims/lis/Faculty"
Member = "urn:lti:instrole:ims/lis/Member"
Learner = "urn:lti:instrole:ims/lis/Learner"
Instructor = "urn:lti:instrole... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/roles/system/urns.rb | Ruby | mit | 203 | main | 477 | module IMS::LIS
module Roles
module System
module URNs
SysAdmin = "urn:lti:sysrole:ims/lis/SysAdmin"
SysSupport = "urn:lti:sysrole:ims/lis/SysSupport"
Creator = "urn:lti:sysrole:ims/lis/Creator"
AccountAdmin = "urn:lti:sysrole:ims/lis/AccountAdmin"
User = "urn:lti:sys... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/roles/system/handles.rb | Ruby | mit | 203 | main | 312 | module IMS::LIS
module Roles
module System
module Handles
SysAdmin = "SysAdmin"
SysSupport = "SysSupport"
Creator = "Creator"
AccountAdmin = "AccountAdmin"
User = "User"
Administrator = "Administrator"
None = "None"
end
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/roles/context/urns.rb | Ruby | mit | 203 | main | 4,374 | module IMS::LIS
module Roles
module Context
module URNs
Learner = "urn:lti:role:ims/lis/Learner"
Learner_Learner = "urn:lti:role:ims/lis/Learner/Learner"
Learner_NonCreditLearner = "urn:lti:role:ims/lis/Learner/NonCreditLearner"
Learner_GuestLearner = "urn:lti:role:ims/lis/Le... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/roles/context/handles.rb | Ruby | mit | 203 | main | 3,285 | module IMS::LIS
module Roles
module Context
module Handles
Learner = "Learner"
Learner_Learner = "Learner/Learner"
Learner_NonCreditLearner = "Learner/NonCreditLearner"
Learner_GuestLearner = "Learner/GuestLearner"
Learner_ExternalLearner = "Learner/ExternalLearner"
... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lis/statuses/uris.rb | Ruby | mit | 203 | main | 284 | module IMS::LIS
module Statuses
module URIs
Active = 'http://purl.imsglobal.org/vocab/lis/v2/status#Active'
Deleted = 'http://purl.imsglobal.org/vocab/lis/v2/status#Deleted'
Inactive = 'http://purl.imsglobal.org/vocab/lis/v2/status#Inactive'
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models.rb | Ruby | mit | 203 | main | 1,566 | module IMS::LTI
module Models
require_relative 'models/lti_model'
require_relative 'models/serializable'
require_relative 'models/contact'
require_relative 'models/localized_name'
require_relative 'models/localized_text'
require_relative 'models/product_family'
require_relative 'models/pro... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/services.rb | Ruby | mit | 203 | main | 422 | module IMS::LTI
module Services
require_relative 'services/oauth2_client'
require_relative 'services/tool_proxy_registration_service'
require_relative 'services/tool_config'
require_relative 'services/tool_proxy_validator'
require_relative 'services/message_authenticator'
require_relative 'ser... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/errors.rb | Ruby | mit | 203 | main | 275 | module IMS::LTI
module Errors
require_relative 'errors/invalid_lti_config_error'
require_relative 'errors/tool_proxy_registration_error'
require_relative 'errors/invalid_tool_consumer_profile'
require_relative 'errors/authentication_failed_error'
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/base_url_choice.rb | Ruby | mit | 203 | main | 413 | module IMS::LTI::Models
class BaseUrlChoice < LTIModel
add_attributes :default_base_url, :secure_base_url
add_attribute :selector, relation:'IMS::LTI::Models::BaseUrlSelector'
def default_message_url
if selector.nil? || (selector.applies_to && selector.applies_to.include?('MessageHandler'))
... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/content_item_placement.rb | Ruby | mit | 203 | main | 834 | module IMS::LTI::Models
class ContentItemPlacement < LTIModel
DOCUMENT_TARGETS = {
embed: 'http://purl.imsglobal.org/vocab/lti/v2/lti#embed',
frame: 'http://purl.imsglobal.org/vocab/lti/v2/lti#frame',
iframe: 'http://purl.imsglobal.org/vocab/lti/v2/lti#iframe',
none: 'http://purl.imsgloba... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/parameter.rb | Ruby | mit | 203 | main | 653 | module IMS::LTI::Models
class Parameter < LTIModel
add_attributes :name, :variable, :fixed
def fixed?
!fixed.nil? && fixed.to_s.strip != ''
end
def self.process_params(parameters, lookup_hash)
[*parameters].inject({}) do |hash, param|
hash[param.name] = param.fixed? ? param.fixe... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages.rb | Ruby | mit | 203 | main | 425 | module IMS::LTI::Models
module Messages
require_relative 'messages/message'
require_relative 'messages/request_message'
require_relative 'messages/registration_request'
require_relative 'messages/basic_lti_launch_request'
require_relative 'messages/content_item_selection_request'
require_relat... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/rest_service_profile.rb | Ruby | mit | 203 | main | 296 | module IMS::LTI::Models
class RestServiceProfile < LTIModel
add_attributes :service, :action
add_attribute :type, json_key: '@type'
def initialize(attributes = {})
@type = "RestServiceProfile"
super(attributes)
end
def actions
[*action]
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/tool_profile.rb | Ruby | mit | 203 | main | 1,004 | module IMS::LTI::Models
class ToolProfile < LTIModel
add_attributes :lti_version
add_attribute :id, json_key: '@id'
add_attribute :product_instance, relation:'IMS::LTI::Models::ProductInstance'
add_attribute :base_url_choice, relation: 'IMS::LTI::Models::BaseUrlChoice'
add_attribute :resource_hand... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/message_handler.rb | Ruby | mit | 203 | main | 310 | module IMS::LTI::Models
class MessageHandler < LTIModel
add_attributes :message_type, :path, :enabled_capability
add_attribute :parameter, relation:'IMS::LTI::Models::Parameter'
def enabled_capabilities
[*enabled_capability]
end
def parameters
[*parameter]
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/vendor.rb | Ruby | mit | 203 | main | 831 | module IMS::LTI::Models
class Vendor < LTIModel
add_attributes :code, :website
add_attribute :id, json_key:'@id'
add_attribute :contact, relation:'IMS::LTI::Models::Contact'
add_attribute :vendor_name, relation:'IMS::LTI::Models::LocalizedName'
add_attribute :description, relation:'IMS::LTI::Mode... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/content_item_container.rb | Ruby | mit | 203 | main | 441 | module IMS::LTI::Models
class ContentItemContainer < IMS::LTI::Models::LTIModel
add_attribute :context, json_key: '@context'
add_attribute :graph, json_key: '@graph', relation: 'IMS::LTI::Models::ContentItems::ContentItem'
CONTENT_ITEM_CONTAINER_CONTEXT = 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/lti_model.rb | Ruby | mit | 203 | main | 6,297 | require 'uri'
module IMS::LTI::Models
class LTIModel
LTI_VERSION_2P0 = 'LTI-2p0'.freeze
LTI_VERSION_2P1 = 'LTI-2p1'.freeze
def initialize(attributes = {})
@ext_attributes = {}
@unknown_attributes = {}
self.attributes = attributes
end
def self.add_attributes(attribute, *attrs)
... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/security_contract.rb | Ruby | mit | 203 | main | 477 | module IMS::LTI::Models
class SecurityContract < LTIModel
add_attributes :shared_secret, :tp_half_shared_secret
add_attribute :tool_service, relation: 'IMS::LTI::Models::RestServiceProfile'
add_attribute :end_user_service, relation: 'IMS::LTI::Models::RestServiceProfile'
def tool_services
[*to... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/product_info.rb | Ruby | mit | 203 | main | 818 | module IMS::LTI::Models
class ProductInfo < LTIModel
add_attribute :product_version
add_attribute :product_family, relation: 'IMS::LTI::Models::ProductFamily'
add_attribute :description, relation: 'IMS::LTI::Models::LocalizedText'
add_attribute :product_name, relation: 'IMS::LTI::Models::LocalizedName... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/tool_setting.rb | Ruby | mit | 203 | main | 302 | module IMS::LTI::Models
class ToolSetting < LTIModel
add_attribute :type, json_key: '@type'
add_attribute :id, json_key: '@id'
add_attributes :custom, :custom_url
TOOL_PROXY_BINDING_TYPE = 'ToolProxyBinding'
TOOL_PROXY_TYPE = 'ToolProxy'
LTI_LINK_TYPE = 'LtiLink'
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/tool_consumer_profile.rb | Ruby | mit | 203 | main | 1,310 | module IMS::LTI::Models
class ToolConsumerProfile < LTIModel
CONTEXT = "http://purl.imsglobal.org/ctx/lti/v2/ToolConsumerProfile"
TYPE = "ToolConsumerProfile"
MESSAGING_CAPABILITIES = %w(basic-lti-launch-request)
OUTCOMES_CAPABILITIES = %w(Result.autocreate)
add_attributes :lti_version, :guid, ... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/tool_proxy.rb | Ruby | mit | 203 | main | 723 | module IMS::LTI::Models
class ToolProxy < LTIModel
add_attributes :lti_version, :tool_proxy_guid, :custom, :custom_url, :enabled_capability, :tc_half_shared_secret
add_attribute :context, json_key:'@context'
add_attribute :type, json_key:'@type'
add_attribute :id, json_key:'@id'
add_attribute :too... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/membership_service.rb | Ruby | mit | 203 | main | 538 | module IMS::LTI::Models
module MembershipService
require_relative 'membership_service/agent'
require_relative 'membership_service/person'
require_relative 'membership_service/lis_person'
require_relative 'membership_service/container'
require_relative 'membership_service/lis_membership_container'... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/resource_handler.rb | Ruby | mit | 203 | main | 650 | module IMS::LTI::Models
class ResourceHandler < LTIModel
add_attribute :resource_type, relation: 'IMS::LTI::Models::ResourceType'
add_attribute :resource_name, relation: 'IMS::LTI::Models::LocalizedName'
add_attribute :description, relation: 'IMS::LTI::Models::LocalizedText'
add_attribute :message, re... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/product_instance.rb | Ruby | mit | 203 | main | 391 | module IMS::LTI::Models
class ProductInstance < LTIModel
add_attributes :guid
add_attribute :product_info, relation:'IMS::LTI::Models::ProductInfo'
add_attribute :service_owner, relation:'IMS::LTI::Models::ServiceOwner'
add_attribute :service_provider, relation:'IMS::LTI::Models::ServiceProvider'
... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/localized_text.rb | Ruby | mit | 203 | main | 235 | module IMS::LTI::Models
class LocalizedText < LTIModel
add_attributes :default_value, :key
def initialize(default_value = nil, key = nil)
super()
@default_value = default_value
@key = key
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/service_provider.rb | Ruby | mit | 203 | main | 444 | module IMS::LTI::Models
class ServiceProvider < LTIModel
add_attribute :guid
add_attribute :id, json_key:'@id'
add_attribute :service_provider_name, relation:'IMS::LTI::Models::LocalizedName'
add_attribute :description, relation:'IMS::LTI::Models::LocalizedText'
add_attribute :support, relation:'I... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/serializable.rb | Ruby | mit | 203 | main | 286 | module IMS::LTI::Models
module Serializable
def as_json(opts={})
class_name = self.class.name.gsub(/^IMS::LTI::Models/, 'IMS::LTI::Serializers') + 'Serializer'
Object.const_get(class_name).as_json(self)
end
def to_json
as_json.to_json
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/localized_name.rb | Ruby | mit | 203 | main | 235 | module IMS::LTI::Models
class LocalizedName < LTIModel
add_attributes :default_value, :key
def initialize(default_value = nil, key = nil)
@default_value = default_value
@key = key
super()
end
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/tool_setting_container.rb | Ruby | mit | 203 | main | 410 | module IMS::LTI::Models
class ToolSettingContainer < LTIModel
add_attribute :context, json_key: '@context'
add_attribute :graph, json_key: '@graph', relation: 'IMS::LTI::Models::ToolSetting'
TOOL_SETTING_CONTAINER_CONTEXT = 'http://purl.imsglobal.org/ctx/lti/v2/ToolSettings'
def initialize(opts = {}... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/service_owner.rb | Ruby | mit | 203 | main | 851 | module IMS::LTI::Models
class ServiceOwner < LTIModel
add_attribute :id, json_key:'@id'
add_attribute :description, relation: 'IMS::LTI::Models::LocalizedText'
add_attribute :timestamp, json_converter:'IMS::LTI::Converters::TimeJSONConverter'
add_attribute :service_owner_name, relation: 'IMS::LTI::Mod... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/rest_service.rb | Ruby | mit | 203 | main | 506 | module IMS::LTI::Models
class RestService < LTIModel
TYPE = 'RestService'
add_attributes :endpoint, :format, :action
add_attribute :id, json_key:'@id'
add_attribute :type, json_key: '@type'
def initialize(attributes = {})
@type = TYPE
super(attributes)
end
def profile
... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/content_items.rb | Ruby | mit | 203 | main | 204 | module IMS::LTI::Models
module ContentItems
require_relative 'content_items/content_item'
require_relative 'content_items/file_item'
require_relative 'content_items/lti_link_item'
end
end |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages/content_item_selection.rb | Ruby | mit | 203 | main | 863 | module IMS::LTI::Models::Messages
class ContentItemSelection < Message
add_optional_params :content_items, :data, :lti_msg, :lti_log, :lti_errormsg, :lti_errorlog
MESSAGE_TYPE = 'ContentItemSelection'
def initialize(attrs = {})
super(attrs)
self.lti_message_type = MESSAGE_TYPE
end
d... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages/message.rb | Ruby | mit | 203 | main | 7,289 | module IMS::LTI::Models::Messages
class Message
attr_reader :message_authenticator
class << self
def required_params
supers_params('@required_params') | (@required_params || [])
end
def add_required_params(param, *params)
add_params('@required_params', param, *params)
... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages/registration_request.rb | Ruby | mit | 203 | main | 519 | module IMS::LTI::Models::Messages
class RegistrationRequest < RequestMessage
add_required_params :reg_key, :reg_password, :tc_profile_url, :launch_presentation_return_url, :tool_proxy_guid,
:tool_proxy_url
MESSAGE_TYPE = 'ToolProxyRegistrationRequest'
def initialize(attrs = {})... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages/basic_lti_launch_request.rb | Ruby | mit | 203 | main | 1,245 | module IMS::LTI::Models::Messages
class BasicLTILaunchRequest < RequestMessage
add_required_params :resource_link_id
add_recommended_params :context_id, :launch_presentation_return_url, :tool_consumer_instance_guid
add_optional_params :context_type, :role_scope_mentor, :user_image,
... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages/content_item_selection_request.rb | Ruby | mit | 203 | main | 1,298 | module IMS::LTI::Models::Messages
class ContentItemSelectionRequest < RequestMessage
add_required_params :accept_media_types, :accept_presentation_document_targets, :content_item_return_url
add_recommended_params :context_id, :tool_consumer_instance_guid
add_optional_params :context_type, :role_scope_me... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages/request_message.rb | Ruby | mit | 203 | main | 358 | module IMS::LTI::Models::Messages
class RequestMessage < Message
add_recommended_params :user_id, :roles, :launch_presentation_document_target, :launch_presentation_width, :launch_presentation_height
add_optional_params :launch_presentation_locale, :launch_presentation_css_url
def initialize(attrs = {})... |
github | instructure/ims-lti | https://github.com/instructure/ims-lti | lib/ims/lti/models/messages/tool_proxy_update_request.rb | Ruby | mit | 203 | main | 314 | module IMS::LTI::Models::Messages
class ToolProxyUpdateRequest < RequestMessage
add_required_params :tc_profile_url, :launch_presentation_return_url
MESSAGE_TYPE = 'ToolProxyUpdateRequest'
def initialize(attrs = {})
super(attrs)
self.lti_message_type = MESSAGE_TYPE
end
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.