text
stringlengths
10
2.61M
class DashboardController < ApplicationController filter_resource_access layout "dashboard" def index if params[:stream_id].blank? @messages = Message.all_paginated else @messages = Message.by_stream(params[:stream_id]).all_with_blacklist end end end
class User < ApplicationRecord devise :database_authenticatable, :registerable, :recoverable, :rememberable, :lockable, :validatable has_many :posts, dependent: :destroy has_many :active_relationships, class_name: 'Relationship', foreign_key: 'follower_id', ...
require 'sunspot' namespace :services do namespace :solr do task :run do path = File.expand_path(File.dirname(__FILE__) + '/../../config') + '/sunspot.yml' log_path = File.expand_path(File.dirname(__FILE__) + '/../../log') rails_environment = ENV['RAILS_ENV'] || 'development' solr_confi...
require "colorize" class Piece attr_accessor :pos def initialize(pos, color) @pos = pos @color = color @moves = [] end def moves(pos) end def valid_move?(pos, end_pos) #reference board end def inspect "#{self.class}" end end
# encoding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |gem| gem.name = "toc" gem.version = "0.0.3" gem.platform = Gem::Platform::RUBY gem.homepage = "https://github.com/totothink/toc" gem.descri...
class Api::V1::PostEventsController < Api::V1::ApplicationController before_action :set_post_event, only: [:destroy] def index @post_events = PostEvent.all end def search_filter @post_events = PostEvent.where(category: params[:category]).includes(:user) @post_events = @post_events.where(archive: f...
#!/usr/bin/env ruby VERSION='1.0.0' $:.unshift File.expand_path('../../lib', __FILE__) require 'hashie' require 'devops_api' require 'pry' require 'awesome_print' require 'csv' require 'httparty' class ArinApi include HTTParty base_uri 'http://whois.arin.net/rest' format :json headers 'Accept' => 'applicatio...
FactoryBot.define do factory :code do association :organization name { "Test Code" } value { "1234" } trait :disabled do disabled_at { Time.now } end trait :anytime do allowed_time { nil } end end end
class User < ActiveRecord::Base include ActiveModel::Dirty include UserBehavior has_many :translations, dependent: :destroy has_many :authentications, dependent: :destroy acts_as_authentic mount_uploader :avatar, AvatarUploader attr_accessible :login, :avatar, :as => :user_update attr_accessible :login,...
class Note < ApplicationRecord belongs_to :workshop belongs_to :user end
require 'csv' class GameCSVImporter HEADER_YEAR = 'year' HEADER_GAME_NUMBER = 'game_number' HEADER_AWAY_TEAM = 'away_team' HEADER_HOME_TEAM = 'home_team' HEADER_GAME_DATE = 'game_date' HEADER_IS_PLAYOFFS = 'is_playoffs' attr_reader :file_path, :success_count, :failure_count def initiali...
require 'test_helper' class DeprecatedTest < ActionView::TestCase include Gretel::ViewHelpers fixtures :all helper :application setup do Gretel.reset! Gretel.suppress_deprecation_warnings = true end test "show root alone" do breadcrumb :root assert_equal %{<div class="breadcrumbs"><span c...
FactoryBot.define do factory :shop do name { "#{Faker::Address.city}店" } location { Faker::Address.state } phone_number { Faker::PhoneNumber.phone_number.gsub(/-/, '') } prefecture_id { rand(1..Prefecture.all.length) } opening_time { '10:00:00' } closing_time { '20:00:00' } parking_id { ra...
class ServiceResult attr_reader :value def initialize(value) @value = value end def success? true end def fail? !success? end end
# frozen_string_literal: true # rubocop:todo all require 'spec_helper' describe 'Versioned API examples' do # Until https://jira.mongodb.org/browse/RUBY-1768 is implemented, limit # the tests to simple configurations require_no_auth require_no_tls min_server_version("5.0") let(:uri_string) do "mongo...
require 'rails_helper' RSpec.describe "Contracts", type: :request do describe "GET /contracts/:id" do let(:params) { {} } subject { get contract_url(params) } context 'when contract exists' do let!(:contract) { FactoryBot.create(:contract, :free, users_quantity: 5) } let(:params) { { id: con...
# frozen_string_literal: true RSpec.describe StorageOperation, type: :operation do subject(:storage_operation) { described_class.new } context '.call' do subject(:call) { storage_operation.call(result, storages) } let(:result) { [] } context 'when storages is empty' do let(:storages) { [] } ...
require 'spec_helper' describe User do before(:each) do @attr = { :name => "Example User" , :email =>"example@example.com", :password => "foobar", :password_confirmation => "foobar", :salt => "deneme" } end it "should create a new user with give attributes" do User.cr...
require 'rails_helper' RSpec.describe Issue, type: :model do let(:issue) { create(:existing_issue) } let(:user) { create(:user) } describe 'trigger_synchronization' do it 'enqueues a SynchronizeIssueWorker' do expect do issue.trigger_synchronization end.to change(SynchronizeIssueWorker....
class Label < ActiveRecord::Base belongs_to :repo has_many :issues_labels has_many :issues, through: :issues_labels end
# frozen_string_literal: true require_dependency "think_feel_do_dashboard/application_controller" module ThinkFeelDoDashboard # Allows for the creation, updating, and deletion of users class UsersController < ApplicationController load_and_authorize_resource except: [:create] before_action :set_roles ...
require "test_helper" class DashTest < MiniTest::Test def setup @bob = Person.new(name: "Bob") end def test_fail_init_without_required assert_raises(ArgumentError) { Person.new } end def test_success_init p1 = Person.new(name: "John") assert_equal "Bob", @bob.name assert_equal "John", p...
class CreateAddressesCustomers < ActiveRecord::Migration def self.up create_table :addresses_customers, :id => false do |t| t.references :address, :null => false t.references :customer, :null => false end end def self.down drop_table :addresses_customers end end
require "spec_helper" describe Highrise::Authorization do describe ".retrieve" do context "when authorized" do subject do VCR.use_cassette "highrise_authorization", :record => :none do described_class.retrieve end end it { should be_a(Highrise::Authorization) } ...
require 'base64' require 'openssl' module ActiveMerchant module Fulfillment class AmazonService < Service OUTBOUND_URL = "https://fba-outbound.amazonaws.com" OUTBOUND_XMLNS = 'http://fba-outbound.amazonaws.com/doc/2007-08-02/' VERSION = "2007-08-02" SUCCESS, FAILURE, ERROR =...
@transactions.each do |transaction| json.set! transaction.id do json.partial! 'api/tickers/transaction', transaction: transaction end end
class FindUserSubscriber < RabbitmqPubSub::BaseSubscriber include Singleton attr_reader :sub_queue_name def initialize super @sub_queue_name = 'rpc_AU_find_user_request' end private def action(request_payload) FindUserService.new.call(request_payload) end end
# Code your prompts here! # First, puts out a string asking where the tourist would like to stay. puts "Let's plan your trip! Where would you like to stay?" # Then, set a variable called stay to get the user's input. Make sure to capitilize that input. stay = gets.chomp.split.map(&:capitalize).join(' ') #don't forg...
class GoodDog @@number_of_dogs = 0 DOG_YEARS = 7 attr_accessor :name, :height, :weight, :age def initialize(n, h, w, a) self.name = n self.height = h self.weight = w self.age = a * DOG_YEARS @@number_of_dogs += 1 end def self.total_number_of_dogs @@number_of_dogs end def speak ...
class BaseStatisticDaily < ActiveRecord::Base belongs_to :player belongs_to :playlist def self.update_or_create(attributes) (obj = assign_or_new(attributes)).save return obj end def self.assign_or_new(attributes) obj = first || new obj.assign_attributes(attributes) return obj end end
class MeetingTasksController < ApplicationController # GET /meeting_tasks # GET /meeting_tasks.json def index @meeting_tasks = MeetingTask.all respond_to do |format| format.html # index.html.erb format.json { render json: @meeting_tasks } end end # GET /meeting_tasks/1 # GET /meeti...
class Chat < ActiveRecord::Base belongs_to :initiator, class_name: "User" belongs_to :responder, class_name: "User" has_many :messages def other_person(user_id) if self.initiator_id == user_id self.responder elsif self.responder_id == user_id self.initiator end end end
class LikesController < ApplicationController before_action :set_comment def create @comment.likes.where(user_id: current_user.id).first_or_create respond_to do |format| format.html {redirect_back fallback_location: root_path} format.js end end def destroy @comment.likes.where(us...
require "yaml" module Snapit class Script attr_reader :script attr_reader :storage def initialize(path, storage) @script = YAML.load_file(path) storage.set_script_name!(self.name) @storage = storage end def name @script["name"] end def urls @script["urls"]...
class ShippingAddress < ApplicationRecord has_one :buy extend ActiveHash::Associations::ActiveRecordExtensions belongs_to_active_hash :shipping_area end
# Don't need to load native mysql adapter $LOADED_FEATURES << "active_record/connection_adapters/mysql_adapter.rb" class ActiveRecord::Base class << self def mysql_connection(config) require "arjdbc/mysql" config[:port] ||= 3306 url_options = "zeroDateTimeBehavior=convertToNull&jdbcCompliantTru...
# makes sure user cant sign up without name, email, and pw class User < ActiveRecord::Base validates_presence_of :name, :email, :password end
require 'rake' plugins = { "boxgrinder-build-local-delivery-plugin" => { :dir => "delivery/local", :desc => 'Local Delivery Plugin' }, "boxgrinder-build-s3-delivery-plugin" => { :dir => "delivery/s3", :desc => 'Amazon Simple Storage Service (Amazon S3) Delivery Plugin', :deps => { 'aws-s3' => '~>0...
require 'rails_helper' RSpec.describe PensController, type: :routing do describe 'routing' do it 'routes to #index' do expect(get: '/pens').to route_to('pens#index') end it 'routes to #new' do expect(get: '/pens/new').to route_to('pens#new') end it 'routes to #show' do expect...
# frozen_string_literal: true # rubocop:todo all # Copyright (C) 2021 MongoDB Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
module Endeca class TopMembersQuery < Endeca::Query endeca_param(:N) { |ns| build_N ns } endeca_param(:N, :N) # { |ns| build_N ns } endeca_param(:Ne, :Ne) endeca_param(:Nu, :Nu) endeca_param(:Xrc) { |ns| "id+#{ns[:Ne]}+dynrank+enabled+dynorder+default+dyncount+#{ns[:show]}"} # unique to t...
#!/usr/bin/ruby if ARGV.length != 3 then puts "Usage:./rb_match.rb pattern in-file out-file" exit(1) end pattern = ARGV[0] inFile = ARGV[1] outFile = ARGV[2] r = Regexp::new(pattern) inp = IO.read(inFile) outFile = IO.open(IO.sysopen(outFile, "w")) cnt = 0 inp.to_enum(:scan, r).map{ Regexp.last_match }.each do...
class InvitationController < ApplicationController before_filter :signed_in?, only: [:create] before_filter :correct_user_for_invite, only: [:accept, :decline] def create #Check to see if User is already in the system. invitee_user = User.where(email: params[:invitation][:invitee_email]); if invitee_user....
class SessionsController < ApplicationController def create @session = Session.create params[:session] if @session.new_record? render :json => { :errors => @session.errors }, :status => 400 else render :json => { :id => @session.id } end end def destroy ...
module Auth0Helper private # Is the user signed in? # @return [Boolean] def user_signed_in? session[:userinfo].present? end def authenticate_user! # Redirect to page that has the login here if user_signed_in? @current_user = session[:userinfo] else redirect_to login_path en...
# coding: utf-8 module SearchHelper def scope_by(string) case string when "most_liked" return "最多喜欢" when "most_commented" return "最多评论" else return "最新" end end def breadcrumb(*args) options = args.extract_options! out = [] if options[:tag] out << link_to(op...
require 'rails_helper' feature 'Deleting sample groups', :js do let!(:user) { create(:user) } let!(:audit) { create(:audit, user: user) } let!(:building_type) do create(:building_audit_strc_type, parent_structure_type: audit.audit_structure.audit_strc_type) end let!(:apartment_type) do cre...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :omniauth_providers => [:faceb...
#!/usr/bin/env ruby ##################################################################################### # Copyright 2015 Kenneth Evensen <kenneth.evensen@redhat.com> # # 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 ...
require "spec_helper" require 'timecop' describe Workspace do describe "associations" do it { should have_many(:members) } it { should have_many(:activities) } it { should have_many(:events) } it { should belong_to(:sandbox) } it { should have_many(:owned_notes).class_name('Events::Base').conditi...
class Api::V1::AdvertisementsController < ApiController def index @advertisements = Advertisement.all.sort_by(&:rank) end end
class StudySubjectsController < ApplicationController before_action :set_subject, only: [:show, :edit, :update, :destroy] def index @subjects = StudySubject.all end def new @subject = StudySubject.new end def create @subject = StudySubject.new(study_subject_params) if @subject.save fla...
class AddUserNotesToFavoriteVideos < ActiveRecord::Migration def change add_column :favorite_videos, :user_notes, :text end end
##########################GO-LICENSE-START################################ # Copyright 2016 ThoughtWorks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
class User < ActiveRecord::Base include Enums has_many :lists, dependent: :destroy has_many :api_keys, dependent: :destroy validates :username, presence: true validates :password, presence: true after_update :lists_archived after_update :keys_archived private def lists_archived return false un...
require "test_helper" feature "Editing Comment" do scenario "Update comment" do visit comment_path(comments(:one)) click_on 'Edit' fill_in 'Full name', with: 'Jane Doe' fill_in 'Email', with: 'JaneDoe@gmail.com' fill_in 'New Comment', with: 'Death star is almost complete' click_on 'Save' ...
require 'spec_helper' describe 'gdm::set' do let(:title) { 'daemon_chooser' } let(:params) { {:section => 'daemon', :key => 'Chooser', :value => false } } it do is_expected.to contain_augeas('gdm_set_daemon_chooser').with({ 'incl' => '/etc/gdm/custom.conf', 'lens' => 'Gdm.lns', 'ch...
require "spec_helper" describe Hdfs::FilesController do let(:hadoop_instance) { hadoop_instances(:hadoop) } let(:entry) do HdfsEntry.create!({:is_directory => true, :path => '/data', :modified_at => Time.now.to_s, :hadoop_instance => hadoop_instance}, :without_protection => true) end before do log_in ...
module Types class ItemType < BaseObject field :id, ID, null: false field :sku, Integer, null: false field :name, String, null: false field :description, String, null: false field :cost, Float, null: false field :size, String, null: true field :manufacturer, String, null: true field :p...
class CreateDocumentations < ActiveRecord::Migration def change create_table :documentations do |t| t.string :title t.string :author t.string :origin_location t.text :description_of_procedure t.integer :user_id t.boolean :deleted t.timestamps end end end
class Person attr_accessor :name, :caffeine_level, :life, :experience def initialize(name) @name = name @caffeine_level = 0 @life = 100 @experience = 0 puts "Welcome #{name}! Your caffeine level is at #{caffeine_level}. Fuel up with coffee." end def stats puts "Caffeine level: #{@caf...
require './lib/sasstojs' Gem::Specification.new do |s| s.version = Sasstojs::VERSION s.date = Sasstojs::DATE s.name = "sasstojs" s.rubyforge_project = "sasstojs" s.description = %q{Provides a way to output settings to a javascript file from SASS} s.summary = %q{Allows your javascript to access settings de...
require 'spec_helper' describe "slug for existing_column", :integration => true do before(:all) do @user = User.create!(:name => "a user name", :slug => "slug") end describe "to_param" do it "should equal to combined slugs" do @user.seofy_param.should == "a-user-name-slug" end end des...
# @param {Integer} x # @return {Boolean} def is_palindrome(x) return false if x < 0 x.to_s == x.to_s.reverse end # @param {String} num1 # @param {String} num2 # @return {String} def add_strings(num1, num2) (num1.to_i + num2.to_i).to_s end # @param {Integer[]} nums # @return {Integer} def single_n...
class RemoveTimeFromSpeakers < ActiveRecord::Migration def up remove_column :speakers, :start_time remove_column :speakers, :end_time end def down add_column :speakers, :end_time, :time add_column :speakers, :start_time, :time end end
require 'binary_struct' module Ext4 # //////////////////////////////////////////////////////////////////////////// # // Data definitions. HASH_TREE_HEADER = BinaryStruct.new([ 'L', 'unused1', # Unused. 'C', 'hash_ver', # Hash version. 'C', 'length', # Length of this structure. 'C', ...
require 'spec_helper' describe RSpec::Matchers::Sequel::HaveEnum do before :all do @enum_name = Faker::Lorem.word @values = %w(admin manager user inspector) DB.create_enum(@enum_name, @values) end after :all do DB.drop_enum(@enum_name) end describe '#have_enum' do it 'return true if en...
class AddIsImportantToViewpoint < ActiveRecord::Migration def change add_column :viewpoints, :is_important, :bool, default: false end end
class AddNationToUsers < ActiveRecord::Migration def up add_column :users, :nation, :string end def down remove_column :users, :admin end end
class ServiceSerializer < ActiveModel::Serializer attributes :id, :name, :description, :from, :ports, :expose, :default_exposed_ports, :environment, :volumes, :command, :load_state, :active_state, :sub_state, :type, :errors, :docker_status has_one :app, serializer: AppLiteSerializer has_many :categories...
class UsersController < ApplicationController before_action :authenticate_user! def index @users = User.all end def show @user = User.find(params[:id]) @posts = @user.posts.ordered_by_most_recent end def invite_to_friendship @friend = Friend.find_by(user_id: current_user.id, pal_id: param...
#!/usr/bin/ruby # vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2: require 'logger' @log = Logger.new('./pomodoro.log', 7, 100*1024*1024) @log.level = Logger::DEBUG Signal.trap(:INT){ @log.warn "!!!! Task Interruputed !!!!" exit(0) } def input print "Please input task description. : " @task = STDIN....
class DictionariesController < ApplicationController before_action :set_dictionary, only: [:show, :edit, :update, :destroy] before_action :load_parent before_action :load_tag, only: [:new, :edit, :update] # GET /dictionaries # GET /dictionaries.json def index if params[:search] && params[:search].strip ...
FactoryBot.define do factory :city do name { "MyString" } prefecture { nil } end end
module Peatio module Ndex module Hooks BLOCKCHAIN_VERSION_REQUIREMENT = "~> 1.0.0" WALLET_VERSION_REQUIREMENT = "~> 1.0.0" class << self def check_compatibility unless Gem::Requirement.new(BLOCKCHAIN_VERSION_REQUIREMENT) .satisfied_by?(Gem::Ver...
class TwitterRecord < ApplicationRecord self.abstract_class = true CRAWL_STATES = { pending: 0, crawling: 1, stay: 2, completed: 3 } CRAWL_RESET_TIME_SPAN = 12.hours def self.sanitized(text) sanitized_word = ApplicationRecord.basic_sanitize(text) #返信やハッシュタグを除去 sanitized_word = s...
require_relative '../fill_from_exclusions' require 'test/unit' class TestFillFromExclusions < Test::Unit::TestCase def test_fill grid = Grid.new(4) grid[0, 0].value = 1 grid[0, 1].value = 2 grid[3, 3].value = 3 filler = FillFromExclusions.new(grid) filler.fill_grid assert_equal(4, grid[0, 3].value)...
require 'test_helper' class ActiveValueTest < Minitest::Test class TestRank < ActiveValue::Base attr_accessor :id, :symbol, :name GOLD = new id: 1, symbol: :gold, name: "Gold" SILVER = new id: 2, symbol: :silver, name: "Silver" BRONZE = new id: 3, symbol: :bronze, name: "Bronze" end class T...
require "rails_helper" RSpec.describe ImplementingOrganisationPresenter do describe "#organisation_type" do it "takes the code and changes it to the name of the organisation type" do organisation = Organisation.new( name: "This organisation", organisation_type: "70", iati_reference:...
module Bouncer module Tokens class Plain delegate :payload, :header, to: :jwt attr_reader :token def initialize(token) @token = token end def valid? decoded_token.present? end def as_json(*) { token: @token, type: :plain ...
module ActiveSupport class Deprecated class DeprecatedConstantProxy < Module # Remove "SourceAnnotationExtractor is deprecated" warnings that were # interfering with pry's tab complete # # REMOVE AFTER Rails 6.0.4 RELEASE (https://github.com/rails/rails/pull/37468) delegate :hash, :i...
class User < ActiveRecord::Base has_many :ratings, -> { order("score desc") } has_many :rated_items, -> { uniq }, source: :item, through: :ratings has_many :user_similarities, ->(user) { where("target_id IS NOT ?", user.id).order("value desc") } has_many :similar_users, ->(user) { where("user_similarities.value...
require 'spec_helper' Run.neo4j do use_simple_graph_data describe '#vertex' do it 'should not raise an exception for invalid key type' do graph.vertex('bad id').should be_nil end end describe '#edge' do it 'should not raise an exception for invalid key type' do graph.edge('bad id').sh...
module ActiveObject class ActivationQueue MAX_METHOD_REQUEST = 100 def initialize @queue = Array.new(MAX_METHOD_REQUEST) @head = 0 @tail = 0 @count = 0 @mutex = Thread::Mutex.new @full_cond = Thread::ConditionVariable.new @empty_cond = Thread::ConditionVariable.new ...
class CategoriesController < ApplicationController def show @category = Category.find(params[:id]) @foods= Food.where(category_id: params[:id] ) end def index @categories = Category.all end def new @category = Category.new end def edit @category = Category.find(params[:id]) end ...
# frozen_string_literal: true RecordsApiSchema = GraphQL::Schema.define do mutation Types::MutationType query Types::QueryType use GraphQL::Batch rescue_from Pundit::NotAuthorizedError, &:message resolve_type(lambda do |type, _obj, _ctx| case type when Challenge Types::ChallengeType when...
# See GitHubV3API documentation in lib/github_v3_api.rb class GitHubV3API # Provides access to the GitHub Repos API (http://developer.github.com/v3/repos/) # class CommitsAPI def initialize(connection) @connection = connection end def list(user, repo_name) @connection.get("/repos/#...
# frozen_string_literal: true class ApplicationController < ActionController::Base # throwing the error here, after catching it in our routes, # means our normal error handler process will be used # to log the error and display a message to the user def error_404 raise ActionController::RoutingError, "Path...
require 'spec_helper' feature 'Visitor resets password' do scenario 'with valid email' do user = user_with_reset_password page_should_display_change_password_message reset_notification_should_be_sent_to user end scenario 'with non-user account' do reset_password_for 'unknown.email@example.com' ...
# This class stores numbers with multiple decimal points, a format # commonly used for version numbers. For example '2.5.1'. class Version include Comparable def initialize(version) @version = version.to_s end def to_s @version end def <=>(other) ourfields = @version.split('.') ot...
class EasyQuerySettingsController < ApplicationController layout 'admin' menu_item :easy_query_settings before_filter :require_admin helper :easy_query_settings include EasyQuerySettingsHelper helper :custom_fields include CustomFieldsHelper helper :entity_attribute include EntityAttributeHelper h...
class Review < ActiveRecord::Base belongs_to :project belongs_to :user validates :comment, presence: true end
class User < ActiveRecord::Base attr_accessible :name, :email, :password, :password_confirmation #, :avatar attr_accessor :password has_many :photos, dependent: :destroy has_many :likes, dependent: :destroy has_many :comments, dependent: :destroy has_many :relationships, foreign_key: "follower_id", depende...
class CreateSpeciesVocabularies < ActiveRecord::Migration def self.up create_table :species_vocabularies do |t| t.integer :species_id t.integer :vocabulary_entry_id t.timestamps end end def self.down drop_table :species_vocabularies end end
#!/usr/bin/env ruby require "jyk_palindrome" require "open-uri" require "nokogiri" # return paragraphs from wikipedia link, stripped of ref numbers # useful for text-to-speech. # read wiki url url = ARGV[0] if url.nil? || url.empty? puts 'hey, you did not give me a url. bye!' end abort # parse with nokogiri d...
# frozen_string_literal: true require 'rakuten_web_service/resource' module RakutenWebService module Kobo class Ebook < RakutenWebService::Resource endpoint 'https://app.rakuten.co.jp/services/api/Kobo/EbookSearch/20170426' attribute :title, :titleKana, :subTitle, :seriesName, :author, :aut...
class A0500a attr_reader :title, :options, :name, :field_type, :node def initialize @title = "Resident Information" @name = "First Name (A0500a)" @field_type = TEXT @node = "A0500A" @options = [] @options << FieldOption.new("") end def set_values_for_type(klass) return "John" e...
module SimpleOAuth class Header def attributes matching_keys, extra_keys = options.keys.partition { |key| ATTRIBUTE_KEYS.include?(key) } if options[:ignore_extra_keys] || extra_keys.empty? Hash[options.select { |key, _value| matching_keys.include?(key) }.collect { |key, value| [:"oauth_#{key}"...
require 'test_helper' class AccessProjectUseCaseTest < ActionDispatch::IntegrationTest def setup @use_case = create(:use_case) user_sign_in visit root_path find('ul#projects', text: 'Test Project').click_link(@use_case.project.name) end def teardown end test 'access project specific page w...
class Player < ActiveRecord::Base has_many: Sketch_players validates :fname, :lname, :hiredate, presence: true end