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
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_entry.rb
Ruby
mit
90
master
654
module SugarCRM; class Connection # Retrieves a single SugarBean based on the ID. def get_entry(module_name, id, opts={}) login! unless logged_in? options = { :fields => [], :link_fields => [], }.merge! opts json = <<-EOF { "session": "#{@sugar_session_id}", ...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/set_document_revision.rb
Ruby
mit
90
master
1,068
module SugarCRM; class Connection # Sets a new revision for a document. def set_document_revision(document_id, revision_number, opts={}) options = { :file => '', :file_name => '', :document_name => nil }.merge! opts # Raise an exception of we try to pass :file, but not :file_nam...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/set_entry.rb
Ruby
mit
90
master
402
module SugarCRM; class Connection # Creates or updates a single SugarBean. def set_entry(module_name, name_value_list) login! unless logged_in? json = <<-EOF { "session": "#{@sugar_session_id}", "module_name": "#{module_name}", "name_value_list": #{name_value_list.to_json} ...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_document_revision.rb
Ruby
mit
90
master
372
module SugarCRM; class Connection # Downloads a particular revision of a document. def get_document_revision(id) login! unless logged_in? json = <<-EOF { "session": "#{@sugar_session_id}", "id": "#{id}" } EOF json.gsub!(/^\s{6}/,'') SugarCRM::Response.handle(send!(:ge...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_report_entries.rb
Ruby
mit
90
master
479
module SugarCRM; class Connection # Retrieves a list of report entries based on specified report IDs. def get_report_entries(ids, opts={}) login! unless logged_in? options = {:select_fields => ''}.merge! opts json = <<-EOF { "session": "#{@sugar_session_id}", "ids": #{ids.to_json}...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_relationships.rb
Ruby
mit
90
master
1,310
module SugarCRM; class Connection # Retrieves a collection of beans that are related # to the specified bean and, optionally, returns # relationship data # Ajay Singh --> changed as per our equirment. # "related_fields": #{resolve_related_fields(module_name, related_to)}, def get_relationships(module_nam...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/set_relationship.rb
Ruby
mit
90
master
1,057
module SugarCRM; class Connection # Sets a single relationship between two SugarBeans. def set_relationship(module_name, module_id, link_field_name, related_ids, opts={}) login! unless logged_in? options = { :name_value_list => [], :delete => 0, }.merge! opts raise ArgumentError, "rel...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/set_campaign_merge.rb
Ruby
mit
90
master
407
module SugarCRM; class Connection # Performs a mail merge for the specified campaign. def set_campaign_merge(targets, campaign_id) login! unless logged_in? json = <<-EOF { "session": "#{@sugar_session_id}", "targets": #{targets.to_json}, "campaign-id": "#{campaign_id}" } ...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_entries_count.rb
Ruby
mit
90
master
503
module SugarCRM; class Connection # Retrieves the specified number of records in a module. def get_entries_count(module_name, query, opts={}) login! unless logged_in? options = { :deleted => 0 }.merge! opts json = <<-EOF { "session": "#{@sugar_session_id}", "module_name"...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/set_relationships.rb
Ruby
mit
90
master
740
module SugarCRM; class Connection # Sets multiple relationships between two SugarBeans. def set_relationships(module_names, module_ids, link_field_names, related_ids) login! unless logged_in? [module_names, module_ids, link_field_names, related_ids].each do |arg| raise ArgumentError, "argument mu...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/set_note_attachment.rb
Ruby
mit
90
master
697
module SugarCRM; class Connection # Creates or updates an attachment on a note def set_note_attachment(id, filename, file, opts={}) options = { :module_id => '', :module_name => '' }.merge! opts login! unless logged_in? json = <<-EOF { "session": "#{@sugar_session_i...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/seamless_login.rb
Ruby
mit
90
master
308
module SugarCRM; class Connection # Performs a seamless login during synchronization. def seamless_login login! unless logged_in? json = <<-EOF { "session": "#{@sugar_session_id}" } EOF json.gsub!(/^\s{6}/,'') response = send!(:seamless_login, json) end end; end
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/login.rb
Ruby
mit
90
master
443
module SugarCRM; class Connection # Logs the user into the Sugar application. def login connect! unless connected? json = <<-EOF { "user_auth": { "user_name": "#{@user}", "password": "#{OpenSSL::Digest::MD5.new(@pass)}", "version": 2 }, "app...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_module_fields.rb
Ruby
mit
90
master
444
module SugarCRM; class Connection # Retrieves the vardef information of the specified bean. def get_module_fields(module_name) login! unless logged_in? json = <<-EOF { "session": "#{@sugar_session_id}", "module_name": "#{module_name}" } EOF json.gsub!(/^\s{6}/,'') ...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_entries.rb
Ruby
mit
90
master
701
module SugarCRM; class Connection # Retrieve a list of SugarBeans by ID. This method will not # work with the report module. def get_entries(module_name, ids, opts={}) login! unless logged_in? options = { :fields => [], :link_fields => [], }.merge! opts json = <<-EOF { ...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/search_by_module.rb
Ruby
mit
90
master
727
module SugarCRM; class Connection # Returns the ID, module name and fields for specified modules. # Supported modules are Accounts, Bugs, Calls, Cases, Contacts, # Leads, Opportunities, Projects, Project Tasks, and Quotes. def search_by_module(search_string, modules, opts={}) login! unless logged_in? ...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_server_info.rb
Ruby
mit
90
master
228
module SugarCRM; class Connection # Returns server information such as version, flavor, and gmt_time. def get_server_info login! unless logged_in? Response.handle(send!(:get_server_info, ""), @session) end end; end
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/sugarcrm/connection/api/get_available_modules.rb
Ruby
mit
90
master
523
module SugarCRM; class Connection # Retrieves the list of modules available to the current user logged into the system. def get_available_modules login! unless logged_in? json = <<-EOF { "session": "#{@sugar_session_id}" } EOF json.gsub!(/^\s{6}/,'') mods = send!(:get_...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/rails/generators/sugarcrm/config/config_generator.rb
Ruby
mit
90
master
615
# encoding: utf-8 module Sugarcrm module Generators class ConfigGenerator < Rails::Generators::Base desc 'Creates a SugarCRM gem configuration file at config/sugarcrm.yml, and an initializer at config/initializers/sugarcrm.rb' def self.source_root @_sugarcrm_source_root ||= File.expand_path(...
github
chicks/sugarcrm
https://github.com/chicks/sugarcrm
lib/rails/generators/sugarcrm/config/templates/initializer.rb
Ruby
mit
90
master
290
# Load the values in config/sugarcrm.yml into a hash config_values = SugarCRM::Session.parse_config_file(File.join(Rails.root, 'config', 'sugarcrm.yml')) # Connect to appropriate SugarCRM instance (depending on Rails environment) SugarCRM::Session.from_hash(config_values[Rails.env.to_sym])
github
cookrn/chrome_logger
https://github.com/cookrn/chrome_logger
chrome_logger.gemspec
Ruby
mit
90
master
1,027
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'chrome_logger/version' Gem::Specification.new do |spec| spec.name = 'chrome_logger' spec.version = ChromeLogger::VERSION spec.authors = ['Ryan Cook'] spec.email ...
github
cookrn/chrome_logger
https://github.com/cookrn/chrome_logger
example/config.ru
Ruby
mit
90
master
632
require 'chrome_logger' use ChromeLogger app = lambda do | env | env['console'].group 'BIG GROUP' env['console'].log 'hi' , 'there' env['console'].log [ 'now' , 'what' ] env['console'].log( { :key => 1234 } ) env['console'].group_end # Optionally use either signature env['console'].groupCollapsed 'ANOTH...
github
cookrn/chrome_logger
https://github.com/cookrn/chrome_logger
test/chrome_logger_test.rb
Ruby
mit
90
master
497
require 'test_helper' class ChromeLoggerTest < Minitest::Test def test_env_name_is_configurable assert_respond_to \ ChromeLogger, :env_name= end def test_env_name_has_default assert_equal \ ChromeLogger::DEFAULT_ENV_NAME, ChromeLogger.env_name end def test_accepts_an_app_on_...
github
cookrn/chrome_logger
https://github.com/cookrn/chrome_logger
lib/chrome_logger.rb
Ruby
mit
90
master
556
require 'chrome_logger/console' require 'chrome_logger/serializer' class ChromeLogger attr_accessor :app DEFAULT_ENV_NAME = 'console' HEADER = 'X-ChromeLogger-Data' class << self attr_accessor :env_name end @env_name ||= DEFAULT_ENV_NAME def initialize( app ) @app = app end def call( env ...
github
cookrn/chrome_logger
https://github.com/cookrn/chrome_logger
lib/chrome_logger/console.rb
Ruby
mit
90
master
970
class ChromeLogger class Console attr_reader :log_items def self.logger_for( *kinds ) kinds.each do | kind | class_eval <<-___ def #{ kind }( *args ) add_log_items '#{ kind }' , *args end ___ end end def initialize @log_items = [] ...
github
cookrn/chrome_logger
https://github.com/cookrn/chrome_logger
lib/chrome_logger/serializer.rb
Ruby
mit
90
master
574
require 'base64' require 'multi_json' class ChromeLogger class Serializer attr_reader :console def self.serialize( console ) serializer = new console serializer.serialize end def initialize( console ) @console = console end def serialize to_base64 to_utf8( to_json c...
github
cookrn/chrome_logger
https://github.com/cookrn/chrome_logger
lib/chrome_logger/railtie.rb
Ruby
mit
90
master
230
require 'chrome_logger' require 'rails/railtie' class ChromeLogger class Railtie < ::Rails::Railtie initializer 'chrome_logger.rails_initialization' do | app | app.config.middleware.use ChromeLogger end end end
github
flavorjones/tailwindcss-ruby
https://github.com/flavorjones/tailwindcss-ruby
tailwindcss-ruby.gemspec
Ruby
mit
90
main
1,022
# frozen_string_literal: true require_relative "lib/tailwindcss/ruby/version" Gem::Specification.new do |spec| spec.name = "tailwindcss-ruby" spec.version = Tailwindcss::Ruby::VERSION spec.authors = ["Mike Dalessio", "David Heinemeier Hansson"] spec.email = ["mike.dalessio@gmail.com", "david@loudthinking.com"...
github
flavorjones/tailwindcss-ruby
https://github.com/flavorjones/tailwindcss-ruby
Gemfile
Ruby
mit
90
main
208
# frozen_string_literal: true source "https://rubygems.org" # Specify your gem's dependencies in tailwindcss-ruby.gemspec gemspec gem "rake", "~> 13.0" gem "minitest", "~> 5.16" gem "standard", "~> 1.3"
github
flavorjones/tailwindcss-ruby
https://github.com/flavorjones/tailwindcss-ruby
rakelib/package.rake
Ruby
mit
90
main
5,617
# coding: utf-8 # # Rake tasks to manage native gem packages with binary executables from tailwindlabs/tailwindcss # # TL;DR: run "rake package" # # The native platform gems (defined by Tailwindcss::Ruby::Upstream::NATIVE_PLATFORMS) will each contain # two files in addition to what the vanilla ruby gem contains: # ...
github
flavorjones/tailwindcss-ruby
https://github.com/flavorjones/tailwindcss-ruby
lib/tailwindcss/ruby.rb
Ruby
mit
90
main
3,086
# frozen_string_literal: true require_relative "ruby/version" require_relative "ruby/upstream" module Tailwindcss module Ruby DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "..", "exe")) GEM_NAME = "tailwindcss-ruby" # raised when the host platform is not supported by upstream tailwindcss's bi...
github
flavorjones/tailwindcss-ruby
https://github.com/flavorjones/tailwindcss-ruby
lib/tailwindcss/ruby/upstream.rb
Ruby
mit
90
main
650
module Tailwindcss module Ruby module Upstream VERSION = "v4.2.4" # rubygems platform name => upstream release filename NATIVE_PLATFORMS = { "arm64-darwin" => "tailwindcss-macos-arm64", "x64-mingw32" => "tailwindcss-windows-x64.exe", "x64-mingw-ucrt" => "tailwindcss-wind...
github
flavorjones/tailwindcss-ruby
https://github.com/flavorjones/tailwindcss-ruby
test/tailwindcss/test_ruby.rb
Ruby
mit
90
main
4,010
# frozen_string_literal: true require "test_helper" class Tailwindcss::TestRuby < Minitest::Spec def mock_exe_directory(platform) Dir.mktmpdir do |dir| FileUtils.mkdir(File.join(dir, platform)) path = File.join(dir, platform, "tailwindcss") FileUtils.touch(path) stub_gem_platform_match_g...
github
dhampik/rails-admin-scaffold
https://github.com/dhampik/rails-admin-scaffold
rails-admin-scaffold.gemspec
Ruby
mit
90
master
1,098
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "rails-admin-scaffold/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "rails-admin-scaffold" s.version = RailsAdminScaffold::VERSION s.platfo...
github
dhampik/rails-admin-scaffold
https://github.com/dhampik/rails-admin-scaffold
Gemfile
Ruby
mit
90
master
545
source "https://rubygems.org" # Declare your gem's dependencies in rails_admin_scaffold.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here in...
github
dhampik/rails-admin-scaffold
https://github.com/dhampik/rails-admin-scaffold
test/test_helper.rb
Ruby
mit
90
master
2,095
require 'rubygems' require 'minitest/autorun' require 'rails/all' require 'rails/generators' require 'rails/generators/test_case' class TestApp < Rails::Application config.root = File.dirname(__FILE__) end Rails.application = TestApp module Rails def self.root @root ||= File.expand_path(File.join(File.dirname...
github
dhampik/rails-admin-scaffold
https://github.com/dhampik/rails-admin-scaffold
test/lib/generators/admin/scaffold_controller_generator_test.rb
Ruby
mit
90
master
5,309
require 'test_helper' require 'lib/generators/admin/testing_helper' class Admin::Generators::ScaffoldControllerGeneratorTest < Rails::Generators::TestCase destination File.join(Rails.root) tests Admin::Generators::ScaffoldControllerGenerator arguments %w(User name:string age:integer) setup :prepare_destinatio...
github
dhampik/rails-admin-scaffold
https://github.com/dhampik/rails-admin-scaffold
lib/generators/admin/scaffold_controller/scaffold_controller_generator.rb
Ruby
mit
90
master
6,073
require 'rubygems/specification' require 'rails/generators/named_base' require 'rails/generators/resource_helpers' module Admin module Generators class ScaffoldControllerGenerator < Rails::Generators::NamedBase include Rails::Generators::ResourceHelpers source_root File.expand_path('../templates', _...
github
chendo/lifx-http
https://github.com/chendo/lifx-http
lifx-http.gemspec
Ruby
mit
90
master
1,264
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'lifx-http/version' Gem::Specification.new do |spec| spec.name = "lifx-http" spec.version = LIFXHTTP::VERSION spec.authors = ["Jack Chen (chendo)"] spec.email ...
github
chendo/lifx-http
https://github.com/chendo/lifx-http
lib/lifx-http.rb
Ruby
mit
90
master
5,806
require 'grape' require 'grape-entity' require 'grape-swagger' require 'lifx' LIFX::Client.lan.discover module LIFXHTTP class API < Grape::API module Entities class Light < Grape::Entity format_with(:iso_timestamp) { |dt| dt.iso8601 } expose :id expose :label do |light, options| ...
github
chendo/lifx-http
https://github.com/chendo/lifx-http
lib/lifx-http/method_override.rb
Ruby
mit
90
master
737
module LIFXHTTP class MethodOverride HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS PATCH LINK UNLINK) METHOD_OVERRIDE_PARAM_KEY = "_method".freeze HTTP_METHOD_OVERRIDE_HEADER = "HTTP_X_HTTP_METHOD_OVERRIDE".freeze def initialize(app) @app = app end def call(env) method = me...
github
charles-l/koona
https://github.com/charles-l/koona
tests.rb
Ruby
mit
90
master
1,273
require './lib/compiler.rb' require 'tempfile' require 'test/unit' class TestVarDecl < Test::Unit::TestCase def result_test(input, exp_result) begin c = Koona::Compiler.new input_file = Tempfile.new('TestFile') input_file << input exp_result = exp_result input_file.read # ? Dunno w...
github
charles-l/koona
https://github.com/charles-l/koona
lib/ast.rb
Ruby
mit
90
master
4,645
module Koona module AST class Node # Superclass to keep track of token info def initialize(token) @filename = token.filename @lineno = token.lineno end attr_reader :filename, :lineno, :offset end class NBlock def initialize(list) @statementlist = lis...
github
charles-l/koona
https://github.com/charles-l/koona
lib/generator.rb
Ruby
mit
90
master
8,837
# TODO: split out semantic analysis pass # TODO: add proper type check/inferance pass module Koona OP_FUNCS = { "+" => "_op_do_add", "-" => "_op_do_sub", "*" => "_op_do_mul", "/" => "_op_do_div" } class CompileError < Exception def initialize(message, options={}) message = "#{options[:no...
github
charles-l/koona
https://github.com/charles-l/koona
lib/lexer.rb
Ruby
mit
90
master
4,758
module Koona class Token def initialize(value, filename, lineno) @value = value @filename = filename @lineno = lineno end attr_reader :value, :filename, :lineno end class Lexer require 'strscan' attr_reader :lineno attr_reader :filename def action &block yield...
github
charles-l/koona
https://github.com/charles-l/koona
lib/compiler.rb
Ruby
mit
90
master
453
require_relative './parser.rb' require_relative './generator.rb' module Koona class Compiler def compile(input, debug=false) lexer = Koona::Lexer.new parser = Koona::Parser.new generator = Koona::Generator.new ast = parser.parse(lexer.scan_file(input)) if debug then puts '-'...
github
mattwynne/ssh-forever
https://github.com/mattwynne/ssh-forever
ssh-forever.gemspec
Ruby
mit
90
master
1,184
Gem::Specification.new do |s| s.name = %q{ssh-forever} s.version = "0.3.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Matt Wynne"] s.date = %q{2009-09-27} s.default_executable = %q{ssh-forever} s.description = %q{Provides a replac...
github
mattwynne/ssh-forever
https://github.com/mattwynne/ssh-forever
lib/ssh-forever.rb
Ruby
mit
90
master
4,553
require 'pathname' require "rubygems" require "bundler" Bundler.setup Bundler.require module SshForever VERSION = '0.3.0' class SecureShellForever def initialize(login, options = {}) @login = login @options = options local_key_path end def run unless File.exists?(public_key_...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
google_assistant.gemspec
Ruby
mit
90
master
994
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "google_assistant/version" Gem::Specification.new do |spec| spec.name = "google_assistant" spec.version = GoogleAssistant::VERSION spec.authors = ["Aaron Milam"] spec....
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant.rb
Ruby
mit
90
master
256
# frozen_string_literal: true Dir["#{File.dirname(__FILE__)}/google_assistant/**/*.rb"].each { |file| require file } module GoogleAssistant def self.respond_to(params, response, &block) Assistant.new(params, response).respond_to(&block) end end
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/errors.rb
Ruby
mit
90
master
363
module GoogleAssistant InvalidIntent = Class.new(StandardError) InvalidMessage = Class.new(StandardError) InvalidInputPrompt = Class.new(StandardError) InvalidPermission = Class.new(StandardError) InvalidPermissionContext = Class.new(StandardError) MissingRequestInputs = Class.new(StandardError) MissingRe...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/dialog_state.rb
Ruby
mit
90
master
1,100
# frozen_string_literal: true require "json" module GoogleAssistant class DialogState DEFAULT_STATE = { "state" => nil, "data" => {} }.freeze def initialize(state_hash_or_conversation_token = nil) if state_hash_or_conversation_token.is_a?(String) @raw_token = state_hash_or_conversation_token ...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/argument.rb
Ruby
mit
90
master
670
# frozen_string_literal: true module GoogleAssistant class Argument attr_reader :name, :raw_text, :text_value def self.from(opts) case opts["name"] when "permission_granted" PermissionArgument.new(opts) when "text" TextArgument.new(opts) else Argument.new(opts...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/intent.rb
Ruby
mit
90
master
977
# frozen_string_literal: true module GoogleAssistant class StandardIntents # Assistant fires MAIN intent for queries like [talk to $action]. MAIN = "assistant.intent.action.MAIN" # Assistant fires TEXT intent when action issues ask intent. TEXT = "assistant.intent.action.TEXT" # Assistant fire...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/device.rb
Ruby
mit
90
master
498
module GoogleAssistant class Device attr_reader :location, :coordinates def initialize(opts) @location = opts["location"] || {} @coordinates = @location["coordinates"] || {} end def city location["city"] end def zip_code location["zip_code"] end def formatte...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/permission.rb
Ruby
mit
90
master
423
# frozen_string_literal: true module GoogleAssistant module Permission NAME = "NAME" DEVICE_PRECISE_LOCATION = "DEVICE_PRECISE_LOCATION" DEVICE_COARSE_LOCATION = "DEVICE_COARSE_LOCATION" def self.valid?(permissions) permissions = [*permissions] permissions.all? do |permission| [N...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/user.rb
Ruby
mit
90
master
440
# frozen_string_literal: true module GoogleAssistant class User attr_reader :id, :profile, :access_token def initialize(opts) @id = opts["user_id"] @profile = opts["profile"] || {} @access_token = opts["access_token"] end def display_name profile["display_name"] end ...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/assistant.rb
Ruby
mit
90
master
1,813
# frozen_string_literal: true require "json" module GoogleAssistant class Assistant attr_reader :params, :response def initialize(params, response) @params = params @response = response end def respond_to(&block) yield(self) response.headers["Google-Assistant-API-Version"...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/conversation.rb
Ruby
mit
90
master
627
# frozen_string_literal: true module GoogleAssistant class Conversation class Type TYPE_UNSPECIFIED = 0 NEW = 1 ACTIVE = 2 EXPIRED = 3 ARCHIVED = 4 end attr_reader :id, :type, :dialog_state def initialize(opts) @id = opts["conversation_id"] @type = opts["ty...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/response/ask_for_permission.rb
Ruby
mit
90
master
692
# frozen_string_literal: true require "google_assistant/response/base" module GoogleAssistant module Response class AskForPermission < Base attr_accessor :context, :permissions def initialize(context, permissions, conversation) @context = context @permissions = [*permissions].compa...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/response/input_prompt.rb
Ruby
mit
90
master
727
# frozen_string_literal: true require "google_assistant/response/base" module GoogleAssistant module Response class InputPrompt < Base attr_accessor :prompt, :no_input_prompts def initialize(prompt, no_input_prompts, conversation) @prompt = prompt @no_input_prompts = [*no_input_pro...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/response/base.rb
Ruby
mit
90
master
2,182
# frozen_string_literal: true module GoogleAssistant module Response class Base attr_reader :conversation def initialize(conversation = nil) @conversation = conversation end def to_json(expect_user_response) response = {} response[:conversation_token] = conversa...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
lib/google_assistant/response/speech_response.rb
Ruby
mit
90
master
650
# frozen_string_literal: true require "google_assistant/response/base" module GoogleAssistant module Response class SpeechResponse < Base attr_accessor :message def initialize(message) @message = message super() end def to_json raise GoogleAssistant::InvalidMes...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/test_google_assistant.rb
Ruby
mit
90
master
847
require "minitest/autorun" require "test_helper" require "google_assistant" require "google_assistant/intent" require "google_assistant/dialog_state" describe GoogleAssistant do include TestHelper describe "::respond_to" do it "creates a new Assistant and calls respond_to on it" do params = load_json_f...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_argument.rb
Ruby
mit
90
master
2,178
require "minitest/autorun" require "google_assistant/argument" describe GoogleAssistant::Argument do let(:params) { { "name" => "a name", "raw_text" => "some raw text", "text_value" => "some text value" } } subject { GoogleAssistant::Argument.new(params) } describe "#from" do subject { GoogleAssistant::Argu...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_permission.rb
Ruby
mit
90
master
2,241
require "minitest/autorun" require "google_assistant/permission" describe GoogleAssistant::Permission do describe "::valid?" do describe "when given a single valid permission" do it "returns true" do permissions = [ GoogleAssistant::Permission::NAME, GoogleAssistant::Permissi...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_conversation.rb
Ruby
mit
90
master
1,457
require "minitest/autorun" require "google_assistant/conversation" describe GoogleAssistant::Conversation do let(:conversation_params) { { "conversation_id" => "abc123", "type" => 1, "conversation_token" => { "state" => "some state", "data" => { "some data" => "a value" } } } } subject { GoogleAssistant::Conversat...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_user.rb
Ruby
mit
90
master
1,175
require "minitest/autorun" require "google_assistant/user" describe GoogleAssistant::User do let(:params) do { "user_id" => "some user id", "access_token" => "iuaweLJ7igJgkyUGl7gujy52i8Iu609unjBJbk6", "profile" => { "display_name" => "Johnny", "given_name" => "John", "fa...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_intent.rb
Ruby
mit
90
master
2,414
require "minitest/autorun" require "google_assistant/intent" describe GoogleAssistant::Intent do let(:intent_string) { "any old string" } subject { GoogleAssistant::Intent.new(intent_string) } describe "#initialize" do it "sets the class's attributes" do assert_equal(intent_string, subject.intent_str...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_dialog_state.rb
Ruby
mit
90
master
2,308
require "minitest/autorun" require "google_assistant/dialog_state" describe GoogleAssistant::DialogState do let(:state_hash) { { "state" => "some state", "data" => { "some data" => "a value" } } } subject { GoogleAssistant::DialogState.new(state_hash) } describe "#initialize" do describe "when given a stri...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_device.rb
Ruby
mit
90
master
1,547
require "minitest/autorun" require "google_assistant/device" describe GoogleAssistant::Device do let(:params) do { "location" => { "coordinates" => { "latitude" => 37.422, "longitude" => -122.084 }, "formatted_address" => "1600 Amphitheatre Parkway, Mountain View...
github
armilam/google-assistant-ruby
https://github.com/armilam/google-assistant-ruby
test/google_assistant/test_assistant.rb
Ruby
mit
90
master
12,383
# frozen_string_literal: true require "minitest/autorun" require "test_helper" require "google_assistant/assistant" require "google_assistant/intent" require "google_assistant/dialog_state" describe GoogleAssistant::Assistant do include TestHelper let(:response) { FakeResponse.new } let(:params) { load_json_fi...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
Gemfile
Ruby
mit
90
master
628
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Declare your gem's dependencies in fastentry.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare a...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
fastentry.gemspec
Ruby
mit
90
master
860
$:.push File.expand_path("lib", __dir__) # Maintain your gem's version: require "fastentry/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |spec| spec.name = "fastentry" spec.version = Fastentry::VERSION spec.authors = ["Tiago Alves"] spec.email = ["al...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
Rakefile
Ruby
mit
90
master
715
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Fastentry' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.md') rdo...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
config/routes.rb
Ruby
mit
90
master
346
require 'awesome_print' Fastentry::Engine.routes.draw do root to: "dashboard#index" get "cache_item/:key" => "cache#show", as: "cache" delete "invalidate/:key" => "cache#invalidate", as: "invalidate_key" delete "invalidate_multiple" => "cache#invalidate_multiple", as: "invalidate_multiple_keys" resources :...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
spec/rails_helper.rb
Ruby
mit
90
master
228
require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../dummy/config/environment.rb', __FILE__) abort("The Rails environment is running in production mode!") if Rails.env.production? require 'rspec/rails'
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
spec/lib/fastentry_spec.rb
Ruby
mit
90
master
335
require 'rails_helper' describe Fastentry do it "should return a default Fastentry cache instance" do expect(Fastentry.cache).to be_a_kind_of(Fastentry::DefaultCache) end it "should return the correct number of cached keys" do Rails.cache.write("city", "Porto") expect(Fastentry.cache.keys.size).to e...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
spec/dummy/config/application.rb
Ruby
mit
90
master
563
require_relative 'boot' require 'rails/all' Bundler.require(*Rails.groups) require "fastentry" module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* take precedence ov...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
spec/dummy/config/environments/test.rb
Ruby
mit
90
master
2,031
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suit...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
lib/memcached.rb
Ruby
mit
90
master
1,014
require 'net/telnet' module Memcached def self.items(*_servers) servers = _servers.collect {|s| s.split(':')} all_rows = servers.collect do |server| server_rows = server_items(*server) do |slab_id, expires_time, bytes, cache_key, cache_key_length, host, port| {:id=>slab_id, :expires=>expires_ti...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
lib/fastentry.rb
Ruby
mit
90
master
2,760
require 'fastentry/engine' require 'awesome_print' require 'memcached' module Fastentry class Cache < SimpleDelegator alias cache __getobj__ def number_of_keys keys.size end def select(from: 0, amount: 20) count = adjusted_amount(from, amount) keys.try(:[], from, count) || [] ...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
lib/fastentry/engine.rb
Ruby
mit
90
master
331
module Fastentry class Engine < ::Rails::Engine isolate_namespace Fastentry initializer "engine_name.assets.precompile" do |app| app.config.assets.precompile += %w( fastentry/logo.png fastentry/applications.css application.js ) end config.generators do |g| g.test_framework :rspec end...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
app/controllers/fastentry/dashboard_controller.rb
Ruby
mit
90
master
943
module Fastentry class DashboardController < Fastentry::ApplicationController before_action :set_page, only: [:index] def index total_keys = 0 if params[:query].present? @keys = Fastentry.cache.search(query: params[:query]) total_keys = @keys.count @keys = @keys.try(:[], ...
github
alvesjtiago/fastentry
https://github.com/alvesjtiago/fastentry
app/controllers/fastentry/cache_controller.rb
Ruby
mit
90
master
623
module Fastentry class CacheController < Fastentry::ApplicationController def show @key = params[:key] expiration = Fastentry.cache.expiration_for(@key) @expiration = expiration.strftime("%a, %e %b %Y %H:%M:%S %z") if expiration @cache_item = Fastentry.cache.read(@key) end def i...
github
pragmarb/pragma
https://github.com/pragmarb/pragma
pragma.gemspec
Ruby
mit
90
master
1,397
# frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pragma/version' Gem::Specification.new do |spec| spec.name = 'pragma' spec.version = Pragma::VERSION spec.authors = ['Alessandro Desantis'] spec.email ...
github
pragmarb/pragma
https://github.com/pragmarb/pragma
Gemfile
Ruby
mit
90
master
424
# frozen_string_literal: true source 'https://rubygems.org' # Specify your gem's dependencies in pragma.gemspec gemspec gem 'pry' gem 'pragma-contract', github: 'pragmarb/pragma-contract' gem 'pragma-operation', github: 'pragmarb/pragma-operation' gem 'pragma-decorator', github: 'pragmarb/pragma-decorator' gem 'pra...
github
pragmarb/pragma
https://github.com/pragmarb/pragma
spec/spec_helper.rb
Ruby
mit
90
master
268
require 'coveralls' Coveralls.wear! require 'pry' $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'pragma' module API module V1 module Post class Decorator < Pragma::Decorator::Base property :title end end end end
github
pragmarb/pragma
https://github.com/pragmarb/pragma
lib/pragma.rb
Ruby
mit
90
master
1,308
# frozen_string_literal: true require 'adaptor' require 'pragma/operation' require 'pragma/policy' require 'pragma/contract' require 'pragma/decorator' require 'pragma/version' require 'pragma/decorator/error' require 'pragma/filter/base' require 'pragma/filter/equals' require 'pragma/filter/like' require 'pragma/...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
Gemfile
Ruby
apache-2.0
90
main
1,432
# frozen_string_literal: true source ENV['GEM_SOURCE'] || "https://rubygems.org" gemspec def location_for(place_or_version, fake_version = nil) git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?} file_url_regex = %r{\Afile:\/\/(?<path>.*)} if place_or_version && (git_url = place_or_version.ma...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
puppet-strings.gemspec
Ruby
apache-2.0
90
main
747
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'puppet-strings/version' Gem::Specification.new do |s| s.name = 'puppet-strings' s.author = 'Puppet Inc.' s.version = PuppetStrings::VERSION s.license = 'Apache-2.0' s.summary...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
Rakefile
Ruby
apache-2.0
90
main
1,196
# frozen_string_literal: true require 'bundler/gem_tasks' require 'puppet-lint/tasks/puppet-lint' require 'rspec/core/rake_task' require 'puppetlabs_spec_helper/tasks/fixtures' begin require 'puppet_litmus/rake_tasks' rescue LoadError # Gem not present end RSpec::Core::RakeTask.new(:spec) do |t| t.exclude_patt...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/spec_helper_acceptance_local.rb
Ruby
apache-2.0
90
main
400
# frozen_string_literal: true def sut_module_path(module_regex) modules = JSON.parse(run_shell('bundle exec puppet module list --modulepath spec/fixtures/modules --render-as json').stdout) test_module_info = modules['modules_by_path'].values.flatten.find { |mod_info| mod_info =~ module_regex } test_module_info.m...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/markdownlint_style.rb
Ruby
apache-2.0
90
main
256
# frozen_string_literal: true all # Update line length to 120 chars. rule 'MD013', line_length: 120 # Allow duplicate headings. exclude_rule 'MD024' # Allow trailing punctuation in headings. exclude_rule 'MD026' # Allow html tags exclude_rule 'MD033'
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/spec_helper.rb
Ruby
apache-2.0
90
main
2,509
# frozen_string_literal: true if ENV['COVERAGE'] == 'yes' require 'simplecov' require 'simplecov-console' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::Console ] SimpleCov.start do track_files 'lib/**/*.rb' add_filter 'lib/puppet-strings/version.rb' ...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/acceptance/running_strings_generate_spec.rb
Ruby
apache-2.0
90
main
4,044
# frozen_string_literal: true require 'spec_helper_acceptance' include PuppetLitmus describe 'Generating module documentation using generate action' do let(:sut_work_dir) do PuppetLitmus::PuppetHelpers.run_shell('pwd').stdout.chomp end before :all do # TODO: Linux only test_module_path = sut_module...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/acceptance/generate_json_spec.rb
Ruby
apache-2.0
90
main
2,033
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'Generating JSON' do let(:test_module_path) do sut_module_path(/Module test/) end let(:remote_tmp_path) do sut_tmp_path end let(:expected) do { 'puppet_classes' => [], 'data_types' => [], 'data_type_alias...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/acceptance/generate_markdown_spec.rb
Ruby
apache-2.0
90
main
1,274
# frozen_string_literal: true require 'spec_helper_acceptance' describe 'Generating Markdown' do let(:test_module_path) do sut_module_path(/Module test/) end let(:remote_tmp_path) do sut_tmp_path end expected = <<~EOF # Reference ## Classes * [`test`](#test): This class exists to serv...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/unit/puppet-strings/describe_spec.rb
Ruby
apache-2.0
90
main
4,620
# frozen_string_literal: true require 'spec_helper' require 'puppet-strings/describe' require 'tempfile' # TODO: basic describe # params from other files (e.g. file content) #--providers - list providers in detail # X--list - list all providers summary #--meta - List all metaparameters #--short - only list params de...
github
puppetlabs/puppet-strings
https://github.com/puppetlabs/puppet-strings
spec/unit/puppet-strings/markdown_spec.rb
Ruby
apache-2.0
90
main
10,156
# frozen_string_literal: true require 'spec_helper' require 'puppet-strings/markdown' require 'tempfile' describe PuppetStrings::Markdown do describe 'rendering fixtures' do let(:fixture_path) do File.expand_path('../../fixtures', __dir__) end let(:output) { described_class.generate } def fix...