text
stringlengths
10
2.61M
class OrderTransferor def initialize(order) @order = order end def transfer(new_email, new_name) contact = LeadContact.find_by_email(new_email) if contact && contact.contactable && contact.contactable.user user_id = contact.contactable.user.id else user = User.create_with_dummy_pass...
class LoginController < ApplicationController skip_before_action :authorized?, only: [:new, :create, :welcome] def new end def create @user = User.find_by(username: params[:username]) if @user && @user.authenticate(params[:password]) session[:user_id] = @user.id redirect_to @user else...
class Api::V1::DebitNoteItemsController < Api::V1::BaseController before_action :set_debit_note before_action :set_debit_note_item, only: [:show, :update, :destroy] def index json_response(@debit_note.debit_note_items) end def show json_response(@debit_note_item) end def create @debit_note....
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Segmentation class Cursor attr_reader :text, :codepoints attr_accessor :position def initialize(text) @text = text @codepoints = text.codepoints reset...
module Localizable extend ActiveSupport::Concern module ClassMethods def localize(attr) localized_attr = [attr, I18n.locale].join('_') unless column_names.include? localized_attr localized_attr = [attr, I18n.default_locale].join('_') end define_method attr do self[loc...
class AddColumnsToUsers < ActiveRecord::Migration[6.0] def change add_column :users, :mode, :string add_column :users, :start_time, :string end end
require_relative 'build_max_heap' def heap_sort(arr) build_max_heap(arr) heap_size = arr.length (arr.length - 1).downto(1) do |idx| # swaps next highest element to front of sorted elements after the heap arr[idx], arr[0] = arr[0], arr[idx] # decrement heap_size for max_heapify call heap_size...
# frozen_string_literal: true module Validators class Base < ActiveModel::Validator VALIDATORS = { 'checklist' => Validators::Checklists, 'checklist_option' => Validators::ChecklistOptions, 'checklist_option_due_time' => Validators::ChecklistOptionsDueTime, 'due_time' => Validators::DueTi...
FactoryGirl.define do factory :winner do prize Prize::REQUIRED_PRIZES.sample category Photo::CATEGORIES.sample association :photo, factory: :photo end end
require_relative 'visitor' class VacationVisitor < Visitor def visit(element) element.vacation_days += 3 puts "#{element.class.name} #{element.name}'s new vacation days: "\ "#{format('%.2f', element.vacation_days)}" end end
class CritiquesController < ApplicationController before_action :set_critique, only: [:show, :edit, :update, :destroy] before_action :set_review, only: [:index] # GET /critiques # GET /critiques.json def index @critiques = @review.critiques end # GET /critiques/1 # GET /critiques/1.json def show...
class RemoveBookingDateFromBooking < ActiveRecord::Migration[6.1] def change remove_column :bookings, :booking_date, :datetime end end
name 'twindb-xtrabackup-80' default_version '8.0.6' skip_transitive_dependency_licensing true dependency 'libffi' dependency 'libboost' whitelist_file 'bin/xtrabackup' whitelist_file 'bin/xbstream' source path: '/twindb-xtrabackup-80/percona-xtrabackup-8.0.6/' build do env = with_standard_compiler_flags(with_embe...
require_relative('car') class PassengerCar < Car attr_reader :taken_places def initialize(all_places) @all_places = all_places @taken_places = 0 end def take_place @taken_places += 1 end def liberal_places @all_places - @taken_places end end
require 'test/unit' require 'rubygems' require 'active_record' require 'action_controller' require 'action_controller/test_process' require 'action_view' require File.dirname(__FILE__) + '/../lib/live_validations' require File.dirname(__FILE__) + '/../lib/form_helpers' require File.dirname(__FILE__) + '/../test/resourc...
class ProductNamesController < ApplicationController before_action :set_product_name, only: [:show, :update, :destroy] # GET /product_names def index @product_names = ProductName.all render json: @product_names end # GET /product_names/1 def show render json: @product_name end # POST /pr...
class Transaction < ApplicationRecord mount_uploader :excel_file, ExcelImportUploader attr_accessor :is_new has_paper_trail before_create :figure_out_target_date after_create :init #care of and trader must not be same validation belongs_to :plot_file, optional: true belongs_to :care_of, :class_name =...
unless ARGV.length == 1 puts "The file needs one or more command line arguments" puts "Usage: ruby unix2dos.rb <FILE_NAME/FOLDER_NAME>" exit end entity_to_convert = ARGV[0] unless File.exists?(entity_to_convert) puts "The specified file or directory does not exist" exit end # method to convert the line endin...
# This exports all attachments found in a CSV export of proposals # (as created by the Report UI) from their S3 bucket, and stores # them locally in a set of folders numbered by proposal ID. require "optparse" require "pry" require "csv" require "net/http" require "tempfile" require "uri" require "restclient" require ...
require 'rails_helper' RSpec.describe Relationship, :type => :model do before do @relationship = Relationship.new(follower_id: 1, followed_id:2) end it "will be valid" do assert @relationship.valid? end it "should require a follower_id" do @relationship.follower_id = nil assert !@relationsh...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
require 'rails_helper' RSpec.feature "User submits a new artist" do scenario "they enter a new artist's info"do artist_name = "Caamp" artist_image_path = "https://i.ytimg.com/vi/Glf6qmJ2dm8/maxresdefault.jpg" visit artists_path click_on 'New Artist' fill_in "artist_name", with: artist_name f...
require 'rails_helper' feature "Product features" do before do @user = create(:user) @user2 = create(:user, email: "newuser@gmail.com") log_in @product = create(:product, user: @user) @product2 = create(:product, name: "Test", user: @user2) end feature "Products Dashboard" do before(:eac...
#! /usr/bin/env ruby require 'minitest/autorun' class Cake def initialize(flavour) @flavour = flavour end def tasty? @flavour == 'carrot' end def self.edible? true end end class CaseOftheMissingMethod < Minitest::Test def setup @carrot_cake = Cake.new('carrot') @mud_cake = Cake.new...
def nyc_pigeon_organizer(data) new_hash = {} # Get unique names names = data.collect do |category, list_of_catagory_items| list_of_catagory_items.values end.flatten.uniq # Create key with each name as a string pointing to empty hash names.each do |name| new_hash[name] = {} end # Create catego...
class Membership < ApplicationRecord enum membership_type: { adult: 0, senior: 1, }, _prefix: true enum status: { payment_pending: 0, active: 1, deactivated: 2, pending_approval: 3 }, _prefix: true belongs_to :family has_one :payment, as: :payable validate :require_valid_date_o...
require 'rails_helper' RSpec.describe PlayerStat do describe ".stat_abbreviation" do it 'takes a stat name as a string and returns its abbreviation' do expect(described_class.stat_abbreviation(stat_name: 'speed')).to eq('SPD') end it 'takes a stat name as a symbol and returns its abbreviation' do ...
# frozen_string_literal: true module Files class Inbox attr_reader :options, :attributes def initialize(attributes = {}, options = {}) @attributes = attributes || {} @options = options || {} end # string - User description def description @attributes[:description] end ...
class Review < ActiveRecord::Base belongs_to :provider belongs_to :client validates :rating, numericality: {only_integer: true}, inclusion: {in: 1..5} end
# frozen_string_literal: true module Sentry module Processor class PIISanitizer < Raven::Processor SANITIZED_FIELDS = Set.new( %w[city country gender phone postalCode zipCode fileNumber state street vaEauthPnid vaEauthBirthdate] ) JSON_STARTS_WITH = ['[', '{'].freeze # rubocop:d...
require 'byebug/command' module Byebug # # Save current settings to use them in another debug session. # class SaveCommand < Command self.allow_in_control = true def regexp /^\s* sa(?:ve)? (?:\s+(\S+))? \s*$/x end def execute file = File.open(@match[1] || Setting[:savefile], 'w') ...
class Product < ApplicationRecord # # validates(:title, {presence: true}) # validates :title, presence: true, uniqueness: {message: "must be unique."} # validates :body, presence: true, length: {minimum: 5} validates(:title, presence: true, uniqueness: {message: "dude, make it unique pls."}, :case_sensitive => ...
require 'cmis' ## Connecting to a CMIS repository (the simple way) # To be able to do anything useful on a CMIS repository, you must first find a repository, and create a session with it: atom_url = "http://localhost:8181/alfresco/service/cmis" user = "admin" password = "admin" @session = CMIS::create_session(atom_ur...
class InvitationsController < ApplicationController before_action :authenticate_user! def create @invite = Invitation.new(invitation_params.merge(user: current_user)) if @invite.save redirect_to :back, notice: "Invitation requested!" else redirect_to :back, alert: "Sorry, something went wro...
FactoryBot.define do factory :message do content { Faker::Lorem.sentence } generation_id { 2 } genre_id { 2 } body_parts_id { 2 } category_id { 2 } association :user end end
require "spec_helper" RSpec.describe "Day 6: Signals and Noise" do let(:runner) { Runner.new("2016/06") } let(:input) do <<~TXT eedadn drvtee eandsr raavrd atevrs tsrnev sdttsa rasrtv nssdts ntnada svetve tesnvt vntsnd vrdear ...
require 'rails_helper' feature 'User can delete link', %q{ As an authenticated user I'd like to be able to delete link of my question And no one except me can delete my question } do given(:user) {create(:user)} given(:question) {create(:question, user: user)} given!(:link) { create :link, name: 'link_nam...
# encoding: UTF-8 class Game def initialize(output = STDOUT) @output = output end # TO-DO # #<Double "output"> received unexpected message :to with def start initial_message = "Bem vindo ao jogo da forca!" @output.puts initial_message end end
class Udipity::Configuration DEFAULT_LOG_LEVEL = Logger::INFO DEFAULT_LOG_OUTPUT = STDOUT DEFAULT_LOG_FORMAT = proc { |_, date, _, msg| "#{date}: #{msg}\n" } DEFAULT_REDIS_URL = 'redis://localhost:6379' DEFAULT_TICK = 5 # Logger setting attr_accessor :log_level attr_accessor :log_output attr_acces...
class WorkshopWfinode < Kb3 hobo_model # Don't put anything above this fields do desk :integer parent :integer creator :string owner :string, :name=> true usergroup :string birthdate :date lastmodified :date permissions :integer end set_table_n...
# frozen_string_literal: true class CompaniesController < InheritedResources::Base private def company_params params.require(:company).permit(:name, :address) end end
# frozen_string_literal: true require "spec_helper" describe GraphQL::Backtrace do class LazyError def raise_err raise "Lazy Boom" end end class ErrorAnalyzer < GraphQL::Analysis::AST::Analyzer def on_enter_operation_definition(node, parent_node, visitor) if node.name == "raiseError" ...
class AddRecipeUserIdToTriedRecipes < ActiveRecord::Migration def change add_column :tried_recipes, :recipe_user_id, :integer end end
namespace :trans do require 'yaml' require 'ftools' require 'net/http' RAILS_API_KEY = '72719952057' desc "Uploads translation files to the server." task :upload do config = load_config abort("Unable to open config") unless config api_key = config['api_key'] abort( "...
FactoryBot.define do factory :condition do id {'1'} name {"新品未使用"} end end
class CreateLaws < ActiveRecord::Migration[6.0] def change create_table :laws do |t| t.integer :num t.text :title t.text :description t.integer :representative_id t.timestamps end end end
class OrangeTree def initialize @height = 1 @orange_count = 0 end def height @height end def one_year_passes if @orange_count == 1 puts 'The tree loses ' + @orange_count.to_s + 'unpicked orange at the end of the year' elsif @orange_count > 1 puts 'The tree loses ' + @orang...
class RackEnvironment attr_reader :app, :options def initialize(app, options={}) @app = app @options = options end def call(env) update_environment! app.call(env) end def update_environment! environment.each do |key, value| ENV[key] = value end end private ##########...
require 'rspec' require 'rack/test' require_relative '../service.rb' describe "service" do include Rack::Test::Methods def app Sinatra::Application end it "should return a user by id" do get '/api/v1/users/1' last_response.should be_ok attributes = JSON.parse(last_response.body) attribu...
module InfobloxClient class Client module Records def all_records_in_zone(zone) get("allrecords?_return_fields=zone,address&zone=#{zone}") end def record(ref) get(ref) end def create_record(attrs={}) type = attrs.delete(:type) body = JSON.dump(attrs...
# require 'test_helper' # class TicketTest < ActiveSupport::TestCase # # setup do # @new_ticket = Ticket.new # end # # test 'Ticket class exists' do # assert class_exists?(Ticket) # end # # test 'A ticket has title' do # assert ticket_has_attribute?(:title) # end # # test 'A ticket has a defau...
class AggregateGenerator < Rails::Generators::MigrationGenerator source_root File.expand_path('templates', __dir__) end
class Goal < ActiveRecord::Base include Serializeable include Likeable include Commentable DEFAULT_SERIALIZER = Api::GoalSerializer DAYS_PREVIOUS = 7 DAYS_PREVIOUS_SINGLE_GOAL = 8 belongs_to :creator, class_name: "User" belongs_to :category has_many :goal_sessions, dependent: :destroy enu...
module Hemp module Orm class DatabaseError < StandardError def initialize(custom_message = "") super "Error while creating database. "\ "#{custom_message}" end end end end
# Write a program that prompts the user for two positive integers, and then prints # the results of the following operations on those two numbers: addition, subtraction, # product, quotient, remainder, and power. Do not worry about validating the input. # Understand the problem: # Prompt for 2 separate positive in...
require 'helper' module Rdomino describe 'Rdomino#connect' do it 'shows Domino version when verbose' do refute Rdomino.connected? out, err = capture_io {Rdomino.connect :env => 'local',:user => 'Frank', :verbose => true} assert_match /^<Rdomino\.connect>\s*(?<user>.+)@local.*Release 8/, out ...
require "#{File.dirname(__FILE__)}/default_adapter" require "#{File.dirname(__FILE__)}/cancan_adapter" require "#{File.dirname(__FILE__)}/pundit_adapter" module Lolita class NoAuthorizationDefinedError < ArgumentError ; end module Extensions module Authorization class Proxy attr_accessor :adapt...
module Concerns::Projected extend ActiveSupport::Concern included do before_action :check_authenticated_project end private def valid_project!(obj) raise AppError.new I18n.t "errors.access" unless obj.project_id.presence == current_project.id end end
class AddDisplayUsersToImages < ActiveRecord::Migration def change add_column :images, :display_user_id, :integer end end
# frozen_string_literal: true Sequel.migration do change do create_table :videos do primary_key :id String :name, null: false String :content, null: false String :description, null: false String :duration DateTime :created_at, null: false DateTime :updated_at, null: fa...
input_file = ARGV.first #define a function print_all, it takes a file object as a parameter def print_all(f) #print the content of the file object (a string) puts f.read end #define a function rewind, it takes a file object as a parameter def rewind(f) # the seek(procurar) method of classIO, moves the file poin...
require 'test/unit' require 'soap/wsdlDriver' require 'RAA.rb' require 'RAAServant.rb' require 'RAAService.rb' module WSDL module RAA class TestRAA < Test::Unit::TestCase DIR = File.dirname(File.expand_path(__FILE__)) Port = 17171 def setup setup_server setup_client end def setup_server @se...
class UndoRow < ActiveRecord::Migration def change remove_column :eostoredats, :eorow end end
require 'file_list' class TweetList < FileList def initialize(file) @store ||= [] super file end def parse(line) matches = line.chomp.match(/^([^>]+)> ?(.*)/) return if matches.nil? store << { user: matches[1], tweet: matches[2][0..139] } end end
# frozen_string_literal: true require_relative "../spec_helper" module CheckstyleReports::Entity ERROR_NODE_SAMPLE_1 = <<NODE <error line="144" column="108" severity="error" message="&apos;+&apos; should be on a new line." source="com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck" /> NOD...
require 'thor' module CloudConductorCli module Models class Blueprint < Thor include Models::Base desc 'list', 'List blueprints' def list response = connection.get('/blueprints') output(response) end desc 'show BLUEPRINT', 'Show blueprint details' def show(bl...
#!/usr/bin/env ruby # frozen_string_literal: true if ARGV.size < 2 puts 'usage: queue name CMD' exit 1 end def ask?(message) print message puts " (Y/n)" !!(gets.chop =~ /^y/i) end def require_with_install(name) unless require name if ask? "install #{name} gem?" system("gem install #{name}") ...
class Item < ActiveRecord::Base include Rails.application.routes.url_helpers WHITE = 1 GREEN = 2 BLUE = 3 PURPLE = 4 ORANGE = 5 TYPE_MASTERS = { "white" => WHITE, "green" => GREEN, "blue" => BLUE, "purple" => PURPLE, "orange" => ORANGE } IMG_PATH = "assets/items/" IMAGES = Dir.g...
# frozen_string_literal: true namespace :lint do require "rubocop/rake_task" RuboCop::RakeTask.new(:ruby) end task lint: %i[lint:ruby] namespace :test do require "cucumber/rake/task" Cucumber::Rake::Task.new(:acceptance) end task test: %i[test:acceptance] task default: %i[lint test]
require 'rails_helper' RSpec.describe "/tasks", type: :request do describe "POST" do context "when title is present" do let(:valid_attrs) {{title: Faker::Superhero.name}} before {post '/api/v1/tasks', params: {data: {attributes: valid_attrs}}} it "returns status code 201" do expe...
class GenresController < ApplicationController def index genres = Genre.load_genres() render json: genres, root: "data" end end
class Message < ActiveRecord::Base belongs_to :sender, class_name: 'Profile', foreign_key: :sender_id belongs_to :recipient, class_name: 'Profile', foreign_key: :recipient_id belongs_to :profile_pic validates :sender_id, :recipient_id, :body, presence: true validates :subject, length: { maximum: 120 } ...
require 'rspec/core/bisect/example_minimizer' require 'rspec/core/formatters/bisect_formatter' require 'rspec/core/bisect/server' require 'support/fake_bisect_runner' module RSpec::Core RSpec.describe Bisect::ExampleMinimizer do let(:fake_runner) do FakeBisectRunner.new( %w[ ex_1 ex_2 ex_3 ex_4 ex_...
class Image < ActiveRecord::Base belongs_to :site has_many :votes # in percent def average_vote sum = 0 self.votes.collect(&:value).each do |v| sum += v end if self.votes.length > 0 ((1.00*sum / self.votes.length)/0.02).round #deinteger, percentize else 0 end end ...
class NotificationService RABBIT = Rails.application.config.rabbit_mq def self.article_created(article) Rails.logger.info "Notifying - creating article: #{article.id}" notify("create", article) end def self.article_modified(article) Rails.logger.info "Notifying - updating article: #{article.id}" ...
require 'unicode' require 'test/unit' class TestConvert < Test::Unit::TestCase def utf8_count(value) EncodeUTF8.count_bytes(value) end def utf8_to_ucs4(input) DecodeUTF8.slice_one_char(input) end def ucs4_to_utf8(input) EncodeUTF8.one_char(input) end def encode_utf8_decode(input) s = EncodeUTF8.string(i...
class PaymentConfirmationUploader < CarrierWave::Uploader::Base include CarrierWave::RMagick def store_dir "assets/media/#{model.class.to_s.underscore}/#{model.created_at.year}/#{model.created_at.month}/" end def default_url "https://sribu-sg.s3.amazonaws.com/assets/media/contest/no-attachment.jpg" ...
class MakeChangesToBooleanDefaults < ActiveRecord::Migration[5.2] def change remove_column :channels, :is_private remove_column :channels, :is_starred add_column :channels, :is_private, :boolean, default:false add_column :channels, :is_starred, :boolean, default:false remove_column :direct_messa...
class Restaurant attr_accessor :name attr_reader :reviews ALL = [] def initialize(name) @name = name @reviews = [] ALL << self end def self.all ALL end def self.find_by_name(name) ALL.find{|restaurant| restaurant.name == name} end def customers self.reviews.map{|review| rev...
# frozen_string_literal: true require "faker" FactoryBot.define do factory :product, class: Hash do name { Faker::Name.name } description { Faker::Lorem.paragraph } manufacturer { Faker::Company.name } essential_features { Faker::Lorem.paragraph } tags { Faker::Lorem.words(number: 3).push("beyon...
class AddPropertyForeignKeys < ActiveRecord::Migration def up add_column :refinery_properties, :city_id, :integer add_column :refinery_properties, :area_code_id, :integer end def down remove_column :refinery_properties, :city_id remove_column :refinery_properties, :area_code_id end end
# frozen_string_literal: true class ImagesController < ApplicationController before_action :set_image, only: %i[show edit update destroy crop] before_action :authenticate_user! # GET /images # GET /images.json def index @images = Image.all end def current @current_images = Image.current_images ...
require 'mongoid' require_relative 'record' # Class representing Product embedded-collection class Product < Record include Mongoid::Document include Mongoid::Timestamps::Created include Mongoid::Timestamps::Updated embedded_in :cart field :seller_identifier, type: String field :code, type: String fiel...
# movies hash didn't we do this at code academy? in_loop = true movie_hash = {} while in_loop puts "Please enter a movie title or type QUIT" title = gets.chomp if title == "QUIT" in_loop = false break end valid = false while !valid do puts "Please enter it's release year" i = gets.chomp ...
module FacilitiesManagement class PostcodesToNutsWorker include Sidekiq::Worker sidekiq_options queue: 'fm', retry: false, backtrace: 20 def perform(data_file) logger.info 'Starting PostodesNutsRegions import' CSV.foreach(data_file) do |row| logger.info "Importing #{row}" Acti...
require "test/unit" require './config/env_config_provider' class EnvConfigProviderTest < Test::Unit::TestCase def test_optimal_count env = {"OPTIMAL_COUNT_CONFIG" => "1s: 5"} config_provider = EnvConfigProvider.new(env) config_provider.set_optimal_count_config expected = [OptimalCountAgo.new(1, 5)] ...
# frozen_string_literal: true class DistanceCalculator EARTH_RADIUS_KM = 6371 def distance_between(first_location, second_location) lat1 = degrees_to_radians(first_location.latitude) lat2 = degrees_to_radians(second_location.latitude) lon1 = degrees_to_radians(first_location.longitude) lon2 = degr...
# frozen_string_literal: true module RuboCop module Cop module InSpecStyle # @example EnforcedStyle: InSpecStyle (default) # `proto` property for `host` resource is deprecated for `protocol` and will be removed in InSpec5 # # # bad # describe host('my_host.txt') do # ...
class GovernmentUsers::RegistrationsController < RegistrationsController respond_to :html, :json layout "minimal" def create if user_has_gov_email?(params[:government_user][:email]) super else flash[:error] = I18n.t("government_users.failures.no_gov_email") redirect_to new_government_us...
module CapybaraHelpers # This helper *shouldn't* be necessary because Capybara provides # select("value", from: "form_element_name") # # For some very frustrating reason, that randomly seems to fail to # find the dropdown and value on a page even though it clearly exists on # the page. # # The workaro...
module Viewerjs module Rails # the version of the gem will follow the one of the ViewerJS project VERSION = '0.2.1' end end
require 'rails_helper' describe UsersController do describe "#new" do context "with coupon code" do let(:coupon) { create(:coupon, coupon_code: 'foobar') } it "user.coupon is set" do get :new, coupon: coupon.coupon_code expect(assigns(:user).coupon_code).to eq coupon.coupon_code ...
class FormSubmissionsController < ApplicationController before_filter :login_required filter_access_to :all def show # @form = Form.find(params[:id],:conditions=>["form_fields.field_type <> ?",'hr'], # :include => {:form_template=>{:form_fields => :form_field_options }}, # :order=>"form_fields.place...
class CreateTccs < ActiveRecord::Migration def change create_table :tccs do |t| t.string :titulo t.string :resumo t.date :data t.string :orientador t.string :local t.string :coorientador t.timestamps end end end
class AddVoteQuotaToUsers < ActiveRecord::Migration def change add_column :users, :vote_quota, :integer, default: 5; end end
module Network module Operator class Tigo < Stub # Old credit @@credit=[ {cost: 250, volume: 10_000_000, code: 250}, {cost: 600, volume: 30_000_000, code: 600}, {cost: 1_200, volume: 70_000_000, code: 1200}, {cost: 2_000, volume: 120_000_000, code: 2000}, ...
# frozen_string_literal: true class AddWidthAndHeightToImages < ActiveRecord::Migration[5.0] def change add_column :images, :width, :integer, null: false add_column :images, :height, :integer, null: false end end
# frozen_string_literal: true module Zafira module Concerns module Apiable def initialize(client) self.client = client # init env just not to make the code spagetty self.environment = client.environment end private def api_endpoint(path) environment.zafir...
require 'active_resource' module Datamine::Redmine module REST # Copied directly from the ActiveResource examples of how to handle # non-standard data in a REST API response: # # https://github.com/rails/activeresource/blob/v4.0.0/lib/active_resource/collection.rb#L12-L45 class IssueCollection ...
#prompt: # Write a program that prints the lyrics to 99 bottles # example output: # 99 bottles of beer on the wall # 99 bottles of beer # Take one down pass it around # 98 bottles of beer on the wall # 98 bottles of beer on the wall # Take one down, pass it around # outline solution # have N number of bottles number_...