repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/netflix_token.rb | lib/authlogic_connect/oauth/tokens/netflix_token.rb | class NetflixToken < OauthToken
key :user_id
settings "http://api.netflix.com",
:request_token_path => "/oauth/request_token",
:access_token_path => "/oauth/access_token",
:authorize_path => "/oauth/login"
end | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/linked_in_token.rb | lib/authlogic_connect/oauth/tokens/linked_in_token.rb | # http://developer.linkedin.com/docs/DOC-1008
# https://www.linkedin.com/secure/developer
# http://github.com/pengwynn/linkedin/tree/master/lib/linked_in/
class LinkedInToken < OauthToken
key do |access_token|
body = access_token.get("https://api.linkedin.com/v1/people/~:(id)").body
id = body.gsub("<id>([^... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/yahoo_token.rb | lib/authlogic_connect/oauth/tokens/yahoo_token.rb | # https://developer.apps.yahoo.com/dashboard/createKey.html
# https://developer.apps.yahoo.com/projects
# http://developer.yahoo.com/oauth/guide/oauth-accesstoken.html
# http://developer.yahoo.com/oauth/guide/oauth-auth-flow.html
# http://code.google.com/apis/gadgets/docs/oauth.html
# http://developer.yahoo.com/social/... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/ohloh_token.rb | lib/authlogic_connect/oauth/tokens/ohloh_token.rb | # https://www.ohloh.net/
# http://www.ohloh.net/api/oauth
class OhlohToken < OauthToken
key :user_id
settings "http://www.ohloh.net"
end
| ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/github_token.rb | lib/authlogic_connect/oauth/tokens/github_token.rb | class GithubToken < OauthToken
version 2
key do |access_token|
user = JSON.parse(access_token.get("/api/v2/json/user/show"))
user["id"]
end
settings "https://github.com",
:authorize_path => "/login/oauth/authorize",
:access_token_path => "/login/oauth/access_token"
end
| ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/oauth_token.rb | lib/authlogic_connect/oauth/tokens/oauth_token.rb | class OauthToken < AccessToken
def client
unless @client
if oauth_version == 1.0
@client = OAuth::AccessToken.new(self.consumer, self.token, self.secret)
else
@client = OAuth2::AccessToken.new(self.consumer, self.token)
end
end
@client
end
def clear
@cl... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/aol_token.rb | lib/authlogic_connect/oauth/tokens/aol_token.rb | # http://dev.aol.com/openauth_gettingstarted
# https://my.screenname.aol.com/_cqr/login/login.psp?sitedomain=dev.aol.com&authLev=1&lang=en&locale=us&siteState=OrigUrl%3Dhttp%253A%252F%252Fdev.aol.com%252Fkeys | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/oauth/tokens/opensocial_token.rb | lib/authlogic_connect/oauth/tokens/opensocial_token.rb | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false | |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/session.rb | lib/authlogic_connect/openid/session.rb | module AuthlogicConnect::Openid
# This module is responsible for adding all of the OpenID goodness to the Authlogic::Session::Base class.
module Session
# Add a simple openid_identifier attribute and some validations for the field.
def self.included(klass)
klass.class_eval do
include InstanceM... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/variables.rb | lib/authlogic_connect/openid/variables.rb | module AuthlogicConnect::Openid::Variables
include AuthlogicConnect::Openid::State
# openid_provider = "blogger", "myopenid", etc.
# openid_identifier = "viatropos.myopenid.com", etc.
# openid_key = "viatropos"
# def openid_attributes
# [:openid_provider, :openid_identifier, :openid_key]
# end
def ... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/state.rb | lib/authlogic_connect/openid/state.rb | # all these methods must return true or false
module AuthlogicConnect::Openid::State
# 1. to call
def openid_request?
!openid_identifier.blank? && auth_session[:auth_attributes].nil?
end
def openid_identifier?
openid_request?
end
def openid_provider?
end
# 2. from call
# better ... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/process.rb | lib/authlogic_connect/openid/process.rb | module AuthlogicConnect::Openid::Process
include AuthlogicConnect::Openid::Variables
def start_openid
save_openid_session
call_openid
end
def complete_openid
restore_attributes
call_openid
end
def call_openid
options = {}
options[:return_to] = auth_callback_url
# this i... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/user.rb | lib/authlogic_connect/openid/user.rb | module AuthlogicConnect::Openid
module User
def self.included(base)
base.class_eval do
add_acts_as_authentic_module(AuthlogicConnect::Openid::Process, :prepend)
add_acts_as_authentic_module(InstanceMethods, :append)
end
end
module InstanceMethods
def self.incl... | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/tokens/my_openid_token.rb | lib/authlogic_connect/openid/tokens/my_openid_token.rb | class MyOpenidToken < OpenidToken
end | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/tokens/blogger_token.rb | lib/authlogic_connect/openid/tokens/blogger_token.rb | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false | |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/tokens/openid_token.rb | lib/authlogic_connect/openid/tokens/openid_token.rb | class OpenidToken < AccessToken
before_save :format_identifier
def format_identifier
self.key = self.key.to_s.normalize_identifier unless self.key.blank?
end
end | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/tokens/flickr_token.rb | lib/authlogic_connect/openid/tokens/flickr_token.rb | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false | |
lancejpollard/authlogic-connect | https://github.com/lancejpollard/authlogic-connect/blob/3b1959ec07f1a9c4164753fea5a5cb1079b88257/lib/authlogic_connect/openid/tokens/aol_token.rb | lib/authlogic_connect/openid/tokens/aol_token.rb | ruby | MIT | 3b1959ec07f1a9c4164753fea5a5cb1079b88257 | 2026-01-04T17:34:23.062865Z | false | |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app.rb | app.rb | # frozen_string_literal: true
require_relative "config/application"
require "refinements/string_io"
module TRMNL
# The web application.
# rubocop:todo Metrics/ClassLength
class Application < Sinatra::Base
include Dependencies[:log_keys, :logger]
include Views::Dependencies[
device_edit_view: "de... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/dependencies.rb | app/dependencies.rb | # frozen_string_literal: true
require "infusible"
Dependencies = Infusible[Container]
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/container.rb | app/container.rb | # frozen_string_literal: true
require "cogger"
require "containable"
# The application container.
module Container
extend Containable
register :log_keys do
YAML.safe_load_file(Bundler.root.join("config/log_keys.yml"), symbolize_names: true)
.fetch :allowed
end
register :logger do
Cogger.add_... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/models/device.rb | app/models/device.rb | # frozen_string_literal: true
# The device model.
class Device < ActiveRecord::Base
DEFAULT_DEVICE_NAME = "My TRMNL"
MODEL = [{name: "og", width: 800, height: 480, color_depth: 1}].freeze
attribute :name, default: DEFAULT_DEVICE_NAME
validates :name, :mac_address, presence: true
before_create :generate_frie... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/view.rb | app/views/view.rb | # frozen_string_literal: true
require "hanami/view"
module Views
# The base view.
class View < Hanami::View
config.part_namespace = Parts
config.paths = Bundler.root.join "app/templates"
config.layout = "application"
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/dependencies.rb | app/views/dependencies.rb | # frozen_string_literal: true
require "infusible"
module Views
Dependencies = Infusible[Container]
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/container.rb | app/views/container.rb | # frozen_string_literal: true
require "containable"
module Views
# Contains view related dependencies.
module Container
extend Containable
namespace :devices do
register(:edit) { Devices::Edit.new }
register(:index) { Devices::Index.new }
register(:new) { Devices::New.new }
regist... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/parts/device.rb | app/views/parts/device.rb | # frozen_string_literal: true
require "hanami/view"
module Views
module Parts
# The device presentation logic.
class Device < Hanami::View::Part
end
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/home/show.rb | app/views/home/show.rb | # frozen_string_literal: true
require "hanami/view"
module Views
module Home
# The show view.
class Show < View
config.template = "home/show"
end
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/devices/index.rb | app/views/devices/index.rb | # frozen_string_literal: true
require "hanami/view"
module Views
module Devices
# The index view.
class Index < View
config.template = "devices/index"
expose :devices
end
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/devices/new.rb | app/views/devices/new.rb | # frozen_string_literal: true
require "hanami/view"
module Views
module Devices
# The new view.
class New < View
config.template = "devices/new"
expose :device
end
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/devices/show.rb | app/views/devices/show.rb | # frozen_string_literal: true
require "hanami/view"
module Views
module Devices
# The show view.
class Show < View
config.template = "devices/show"
expose :device
end
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/app/views/devices/edit.rb | app/views/devices/edit.rb | # frozen_string_literal: true
require "hanami/view"
module Views
module Devices
# The edit view.
class Edit < View
config.template = "devices/edit"
expose :device
end
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/db/seeds.rb | db/seeds.rb | # frozen_string_literal: true
puts "No seeds. Skipped."
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/db/schema.rb | db/schema.rb | # frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define yo... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/db/migrate/20241212172428_create_devices.rb | db/migrate/20241212172428_create_devices.rb | # frozen_string_literal: true
class CreateDevices < ActiveRecord::Migration[8.0]
def change
create_table :devices do |table|
table.string :name
table.string :mac_address
table.string :api_key
table.string :friendly_id
table.integer :refresh_interval, default: 900, null: false
... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/sinatra_helper.rb | spec/sinatra_helper.rb | # frozen_string_literal: true
ENV["APP_ENV"] = "test"
ENV["RACK_ENV"] = "test"
require "active_record"
require "capybara/cuprite"
require "capybara/rspec"
require "database_cleaner/active_record"
require "rack/test"
require "spec_helper"
require_relative "../app"
ActiveRecord::Base.establish_connection :test
Active... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require "simplecov"
unless ENV["NO_COVERAGE"]
SimpleCov.start do
add_filter %r(^/spec/)
enable_coverage :branch
minimum_coverage_by_file line: 95, branch: 95
end
end
Bundler.require :tools
require "refinements"
SPEC_ROOT = Pathname(__dir__).realpath.freeze
using Refin... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/support/shared_contexts/sinatra/with_api.rb | spec/support/shared_contexts/sinatra/with_api.rb | # frozen_string_literal: true
RSpec.shared_context "with API" do
let(:payload) { JSON last_response.body, symbolize_names: true }
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/support/shared_contexts/ruby/temp_dir.rb | spec/support/shared_contexts/ruby/temp_dir.rb | # frozen_string_literal: true
RSpec.shared_context "with temporary directory" do
let(:temp_dir) { Bundler.root.join "tmp/rspec" }
around do |example|
temp_dir.mkpath
example.run
temp_dir.rmtree
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/requests/setup_spec.rb | spec/requests/setup_spec.rb | # frozen_string_literal: true
require "sinatra_helper"
RSpec.describe "API setup path tests" do
subject(:app) { TRMNL::Application }
include_context "with API"
it "answers not registered when MAC address is invalid" do
get "/api/setup/"
expect(payload).to eq(
status: 404,
api_key: nil,
... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/requests/image_spec.rb | spec/requests/image_spec.rb | # frozen_string_literal: true
require "sinatra_helper"
RSpec.describe "Images" do
subject(:app) { TRMNL::Application }
include_context "with API"
let(:path) { Bundler.root.join "public/images/generated/rspec_test.bmp" }
let(:body) { {image: {content: "<p>Test</p>", file_name: "rspec_test"}} }
after { pat... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/requests/display_spec.rb | spec/requests/display_spec.rb | # frozen_string_literal: true
require "sinatra_helper"
RSpec.describe "Display path tests" do
subject(:app) { TRMNL::Application }
include_context "with API"
it "answers not found for index with invalid access token" do
get "/api/display/", format: :json
expect(payload[:status]).to eq(404)
end
it... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/features/device_spec.rb | spec/features/device_spec.rb | # frozen_string_literal: true
require "sinatra_helper"
RSpec.describe "Devices" do
subject(:app) { TRMNL::Application }
let(:device) { Device.create! name: "Test", mac_address: "aa:bb:cc:01:02:03" }
it "displays index" do
device
visit "/devices"
expect(page).to have_content(device.friendly_id)
... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/features/app_spec.rb | spec/features/app_spec.rb | # frozen_string_literal: true
require "sinatra_helper"
RSpec.describe "Routes" do
subject(:app) { TRMNL::Application }
describe ".loader" do
it "eager loads" do
expectation = proc { app.loader.eager_load force: true }
expect(&expectation).not_to raise_error
end
it "answers unique tag" do... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/lib/images/toucher_spec.rb | spec/lib/images/toucher_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Images::Toucher do
using Refinements::Pathname
subject(:toucher) { described_class }
include_context "with temporary directory"
describe "#call" do
let(:one) { temp_dir.join "one.png" }
let(:two) { temp_dir.join "two.png" }
let(... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/lib/images/creator_spec.rb | spec/lib/images/creator_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Images::Creator do
subject(:creator) { described_class.new }
include_context "with temporary directory"
describe "#call" do
let :content do
<<~CONTENT
<html>
<head>
<style>
color: black;
... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/lib/images/greyscaler_spec.rb | spec/lib/images/greyscaler_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Images::Greyscaler do
subject(:greyscaler) { described_class.new randomizer: proc { "abc123" } }
include_context "with temporary directory"
describe "#call" do
let(:input_path) { SPEC_ROOT.join "support/fixtures/test.png" }
let(:output... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/lib/images/rotator_spec.rb | spec/lib/images/rotator_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Images::Rotator do
using Refinements::Pathname
subject(:rotator) { described_class.new fetcher: Images::Fetcher.new(environment:) }
include_context "with temporary directory"
let(:environment) { {"APP_URL" => "https://test.io"} }
describ... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/lib/images/randomizer_spec.rb | spec/lib/images/randomizer_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Images::Randomizer do
subject(:randomizer) { described_class }
it "answers UUID by default" do
expect(randomizer.call).to match(/\h{8}-\h{4}-\h{4}-\h{4}-\h{12}/)
end
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/lib/images/fetcher_spec.rb | spec/lib/images/fetcher_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Images::Fetcher do
using Refinements::Pathname
subject(:fetcher) { described_class.new environment: }
include_context "with temporary directory"
let(:environment) { {"APP_URL" => "https://test.io"} }
describe "#call" do
let(:fixture_... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/spec/lib/images/screensaver_spec.rb | spec/lib/images/screensaver_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Images::Screensaver do
subject(:screensaver) { described_class.new }
include_context "with temporary directory"
describe "#call" do
let :content do
<<~CONTENT
<html>
<head>
<style>
color: b... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/lib/images/creator.rb | lib/images/creator.rb | # frozen_string_literal: true
module Images
# Creates device image.
class Creator
def initialize screensaver: Screensaver.new, greyscaler: Greyscaler.new
@screensaver = screensaver
@greyscaler = greyscaler
end
def call content, output_path = Bundler.root.join("public/images/generated/%<nam... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/lib/images/greyscaler.rb | lib/images/greyscaler.rb | # frozen_string_literal: true
require "mini_magick"
module Images
# Converts image to greyscale BMP image.
class Greyscaler
def initialize randomizer: Randomizer, client: MiniMagick
@randomizer = randomizer
@client = client
end
def call input_path, output_path
uniquify(output_path).... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/lib/images/rotator.rb | lib/images/rotator.rb | # frozen_string_literal: true
module Images
# Rotates and fetches images for rendering on a device.
class Rotator
def initialize toucher: Toucher, fetcher: Fetcher.new
@toucher = toucher
@fetcher = fetcher
end
def call root, encryption: nil
toucher.call root
fetcher.call root, ... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/lib/images/randomizer.rb | lib/images/randomizer.rb | # frozen_string_literal: true
require "securerandom"
module Images
Randomizer = proc { SecureRandom.uuid }
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/lib/images/fetcher.rb | lib/images/fetcher.rb | # frozen_string_literal: true
require "base64"
require "refinements/pathname"
module Images
# Fetches image for rendering on device screen.
class Fetcher
using Refinements::Pathname
ALLOWED_ENCRYPTIONS = %i[base_64].freeze
def initialize allowed_encryptions: ALLOWED_ENCRYPTIONS, environment: ENV
... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/lib/images/screensaver.rb | lib/images/screensaver.rb | # frozen_string_literal: true
require "ferrum"
module Images
# Saves web page as screenshot.
class Screensaver
SETTINGS = {
browser_options: {
"disable-dev-shm-usage" => nil,
"disable-gpu" => nil,
"hide-scrollbar" => nil,
"no-sandbox" => nil
},
js_errors: true... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/lib/images/toucher.rb | lib/images/toucher.rb | # frozen_string_literal: true
require "refinements/pathname"
# Touches the oldest file to make it the latest file.
module Images
using Refinements::Pathname
Toucher = -> root { Pathname(root).files.min_by(&:ctime).touch }
end
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/config/application.rb | config/application.rb | # frozen_string_literal: true
require "dotenv/load"
require "sinatra"
require "sinatra/activerecord"
require "zeitwerk"
Zeitwerk::Loader.new.then do |loader|
loader.push_dir "#{__dir__}/../app"
loader.push_dir "#{__dir__}/../app/models"
loader.push_dir "#{__dir__}/../lib"
loader.tag = "trmnl-application"
lo... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/config/puma.rb | config/puma.rb | # frozen_string_literal: true
development = ENV.fetch("RACK_ENV", "development") == "development"
require "concurrent"
require "localhost" if development
Bundler.require :tools if development
Bundler.root.join("tmp").then { |path| path.mkdir unless path.exist? }
max_threads = ENV.fetch "APP_MAX_THREADS", 5
min_thre... | ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
usetrmnl/byos_sinatra | https://github.com/usetrmnl/byos_sinatra/blob/a82837352011a42f55afeb507500b7fa3380db94/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
config.active_record.maintain_test_schema = true
| ruby | MIT | a82837352011a42f55afeb507500b7fa3380db94 | 2026-01-04T17:34:24.195931Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/spec_helper.rb | spec/spec_helper.rb | require "paperclip-dropbox"
require "vcr"
I18n.enforce_available_locales = true
Dir[File.join(Bundler.root, "spec/support/**/*.rb")].each &method(:require)
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
end
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/paperclip.rb | spec/support/paperclip.rb | require "paperclip"
require_relative "credentials"
Paperclip.options[:log] = false
Paperclip::Attachment.default_options.merge!(
storage: :dropbox,
processors: [:noop],
)
module Paperclip
class Noop < Processor
def make
file
end
end
end
Paperclip.configure do |config|
config.register_processo... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/matchers.rb | spec/support/matchers.rb | require "rest-client"
RSpec::Matchers.define :be_an_existing_url do
match do |url|
RestClient.get(url) do |response|
case response.code
when 200 then true
when 404 then false
else
raise "Wrong error code: #{response.code}"
end
end
end
end
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/rails.rb | spec/support/rails.rb | require "paperclip"
module Paperclip
module Interpolations
module Rails
def self.root
end
end
end
end
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/file_helpers.rb | spec/support/file_helpers.rb | require "delegate"
module FileHelpers
def uploaded_file(filename)
file = File.open(File.join(Bundler.root, "spec/fixtures/files/#{filename}"))
UploadedFile.new(file)
end
class UploadedFile < SimpleDelegator
def content_type
"text/plain"
end
def original_filename
File.basename(pa... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/vcr.rb | spec/support/vcr.rb | VCR.configure do |config|
config.cassette_library_dir = "spec/fixtures/vcr_cassettes"
config.hook_into :webmock
config.default_cassette_options = {record: :new_episodes}
config.configure_rspec_metadata!
end
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/dropbox-sdk.rb | spec/support/dropbox-sdk.rb | require "dropbox_sdk"
require_relative "vcr"
class DropboxSession
attr_reader :consumer_key, :consumer_secret
end
class DropboxClient
attr_reader :session, :root
def self.uploaded_files
@uploaded_files ||= []
end
alias normal_put_file put_file
def put_file(path, file, *args)
self.class.uploaded_... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/credentials.rb | spec/support/credentials.rb | require "vcr"
require "yaml"
require "erb"
require "active_support/core_ext/string/strip"
require "active_support/core_ext/hash/except"
require "active_support/core_ext/hash/keys"
CREDENTIAL_FILES = [:dropbox, :app_folder].inject({}) do |hash, access_type|
hash.update(access_type => File.join(Bundler.root, "spec/#{a... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/support/post.rb | spec/support/post.rb | require "active_record"
require "nulldb"
require "paperclip"
class Post < ActiveRecord::Base
include Paperclip::Glue
def dynamic_dropbox_credentials
{
app_key: self.object_id,
app_secret: self.object_id,
access_type: 'dropbox',
access_token: self.object_id,
access_token_secret: s... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/fixtures/schema.rb | spec/fixtures/schema.rb | require "active_record"
require "paperclip"
ActiveRecord::Schema.define do
create_table :posts, force: true do |t|
t.attachment :attachment
end
end
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/lib/paperclip/storage/dropbox_spec.rb | spec/lib/paperclip/storage/dropbox_spec.rb | require "spec_helper"
require "active_support/core_ext/object/blank"
require "active_support/core_ext/hash/except"
require "active_support/core_ext/hash/keys"
describe Paperclip::Storage::Dropbox, :vcr do
before do
@options = {}
end
def new_post(options = {})
Post.has_attached_file :attachment,
{d... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/lib/paperclip/storage/dropbox/path_generator_spec.rb | spec/lib/paperclip/storage/dropbox/path_generator_spec.rb | require "spec_helper"
describe Paperclip::Storage::Dropbox::PathGenerator do
before do
@options = {dropbox_credentials: CREDENTIALS[:app_folder]}
end
def new_post(options = {})
Post.has_attached_file :attachment, @options
Post.validates_attachment_content_type :attachment, :content_type => %w(image/... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/lib/paperclip/storage/dropbox/credentials_spec.rb | spec/lib/paperclip/storage/dropbox/credentials_spec.rb | require "spec_helper"
describe Paperclip::Storage::Dropbox::Credentials do
describe "#fetch" do
before do
@it = described_class.new(CREDENTIALS[:dropbox])
end
it "parses the credentials" do
@it.should_receive(:parse!)
@it.fetch
end
it "validates the credentials" do
@it.s... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/lib/paperclip/storage/dropbox/generator_factor_spec.rb | spec/lib/paperclip/storage/dropbox/generator_factor_spec.rb | require "spec_helper"
require "paperclip/storage/dropbox/generator_factory"
describe Paperclip::Storage::Dropbox::GeneratorFactory do
it "should build a private url generator" do
described_class.build_url_generator(double(:storage), {
dropbox_credentials: {access_type: "app_folder"}}).should be_a(Paperclip... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/spec/lib/paperclip/storage/dropbox/url_generator_spec.rb | spec/lib/paperclip/storage/dropbox/url_generator_spec.rb | require "spec_helper"
require "uri"
describe Paperclip::Storage::Dropbox::UrlGenerator do
before do
@options = {dropbox_credentials: CREDENTIALS[:dropbox]}
end
def new_post(options = {})
Post.has_attached_file :attachment, @options
Post.validates_attachment_content_type :attachment, :content_type =>... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip-dropbox.rb | lib/paperclip-dropbox.rb | require "paperclip"
require "paperclip/dropbox"
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/dropbox.rb | lib/paperclip/dropbox.rb | require "paperclip/storage/dropbox"
require "paperclip/dropbox/railtie" if defined?(Rails)
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/dropbox/railtie.rb | lib/paperclip/dropbox/railtie.rb | module Paperclip
module Dropbox
class Railtie < Rails::Railtie
rake_tasks do
load "paperclip/dropbox/tasks.rake"
end
end
end
end
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/dropbox/rake.rb | lib/paperclip/dropbox/rake.rb | require "dropbox_sdk"
module Paperclip
module Dropbox
module Rake
extend self
def authorize(app_key, app_secret, access_type)
session = create_new_session(app_key, app_secret)
puts "Visit this URL: #{session.get_authorize_url}"
print "And after you approved the authorization... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/storage/dropbox.rb | lib/paperclip/storage/dropbox.rb | require "dropbox_sdk"
require "active_support/core_ext/hash/keys"
require "paperclip/storage/dropbox/path_generator"
require "paperclip/storage/dropbox/generator_factory"
require "paperclip/storage/dropbox/credentials"
module Paperclip
module Storage
module Dropbox
def self.extended(base)
base.ins... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/storage/dropbox/generator_factory.rb | lib/paperclip/storage/dropbox/generator_factory.rb | require "paperclip/storage/dropbox/private_url_generator"
require "paperclip/storage/dropbox/public_url_generator"
module Paperclip
module Storage
module Dropbox
module GeneratorFactory
def self.build_url_generator(storage, options)
credentials = storage.try(:dropbox_credentials) || option... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/storage/dropbox/public_url_generator.rb | lib/paperclip/storage/dropbox/public_url_generator.rb | require "paperclip/storage/dropbox/url_generator"
module Paperclip
module Storage
module Dropbox
class PublicUrlGenerator < UrlGenerator
def file_url(style)
url = URI.parse("https://dl.dropboxusercontent.com/u/#{user_id}/")
path = @attachment.path(style)
path = path.mat... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/storage/dropbox/path_generator.rb | lib/paperclip/storage/dropbox/path_generator.rb | require "active_support/core_ext/object/blank"
require "active_support/core_ext/string/strip"
module Paperclip
module Storage
module Dropbox
class PathGenerator
def initialize(attachment, attachment_options)
@attachment = attachment
@attachment_options = attachment_options
... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/storage/dropbox/private_url_generator.rb | lib/paperclip/storage/dropbox/private_url_generator.rb | require "paperclip/storage/dropbox/url_generator"
module Paperclip
module Storage
module Dropbox
class PrivateUrlGenerator < UrlGenerator
def file_url(style)
@attachment.dropbox_client.media(@attachment.path(style))["url"]
end
end
end
end
end
| ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/storage/dropbox/credentials.rb | lib/paperclip/storage/dropbox/credentials.rb | require "yaml"
require "erb"
require "pathname"
require "active_support/core_ext/hash/keys"
module Paperclip
module Storage
module Dropbox
class Credentials
def initialize(credentials)
@credentials = credentials
end
def fetch(namespace = nil)
parse!(namespace)
... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
janko/paperclip-dropbox | https://github.com/janko/paperclip-dropbox/blob/57153b7454650532b0f1082b50ea02cc193413d6/lib/paperclip/storage/dropbox/url_generator.rb | lib/paperclip/storage/dropbox/url_generator.rb | require "uri"
module Paperclip
module Storage
module Dropbox
class UrlGenerator
def initialize(attachment, attachment_options)
@attachment = attachment
@attachment_options = attachment_options
end
def generate(style, options)
if @attachment.present?
... | ruby | MIT | 57153b7454650532b0f1082b50ea02cc193413d6 | 2026-01-04T17:34:24.418592Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_print_linescores_for_day.rb | test/test_print_linescores_for_day.rb | $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'game'
games = Game.find_by_date('2009','09','15')
games.each do |game|
puts game.print_linescore
puts
end | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_unique_starters.rb | test/test_unique_starters.rb | # This test will print a list of the pitchers who have started at least
# one game during the 2009 season.
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.new('det')
pitchers = team.get_starters_unique('2009')
count = 1
pitchers.each do |appearance|
puts count.to_s + ' ' + ap... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_print_pitchers_for_game.rb | test/test_print_pitchers_for_game.rb | $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
def check_null(value)
return value unless value==nil
' '
end
puts 'Creating team object...'
team = Team.new('det')
puts 'Finding game objects...'
games = team.games_for_date('2009', '09', '15')
puts 'Reading pitchers...'
pitchers = games[0... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_get_all_appearances_for_robertson.rb | test/test_get_all_appearances_for_robertson.rb | # In this test we are attempting to print out all of the appearances
# for Detroit Tiger pitcher Nate Robertson during the 2009 MLB season.
# Nate pitched as both a reliever and a starter during the 2009 season.
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'pitcher'
nate_r = Pitcher.new
nate_r... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_boxscore_dump.rb | test/test_boxscore_dump.rb | $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.new('det')
games = team.games_for_date('2009', '09', '15')
games[0].get_boxscore.dump_to_file
| ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_import_tigers_pitchfx_to_db.rb | test/test_import_tigers_pitchfx_to_db.rb | $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'db_importer'
importer = DbImporter.new('localhost', 'root', '', 'pitchfx')
#importer.import_for_month('2010', '04')
importer.import_team_for_month('det', '2010', '04')
#importer.import_for_game('2009_09_09_detmlb_kcamlb_1')
| ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_get_all_appearances_for_granderson.rb | test/test_get_all_appearances_for_granderson.rb | # In this test we are attempting to print out all of the appearances
# for Curtis Granderson during the 2009 MLB season.
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.new('det')
# get the Detroit Tigers opening day game because we know that Granderson was
# on the Tigers open... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_show_scoreboard.rb | test/test_show_scoreboard.rb | # This test will print the scoreboard containing linescores for the specified date
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'scoreboard'
sb = Scoreboard.new
sb.load_for_date('2009', '09', '20')
puts 'Games played = ' + sb.games.length.to_s
sb.games.each do |game|
away_innings_string = ... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_show_home_roster.rb | test/test_show_home_roster.rb | $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.new('det')
games = team.games_for_date('2009', '09', '15')
players = games[0].get_rosters
puts 'PLAYERS'
count = 1
players[1].players.each do |player|
puts count.to_s + ' ' + player.first + ' ' + player.last + ' ' + player.posit... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_show_pitch_stats_for_game.rb | test/test_show_pitch_stats_for_game.rb | # In this test we will print out detailed pitch statistics for
# each of the pitchers who appeared in the specified game between
# Detroit and Kansas City
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'game'
def print_stats(pa)
puts pa.pitcher_name
pc = pa.pitch_count
puts " pitches: " +... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_print_batters_for_game.rb | test/test_print_batters_for_game.rb | $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.new('det')
games = team.games_for_date('2009', '09', '15')
lineups = games[0].get_lineups
visitors = lineups[0]
home = lineups[1]
puts 'Visitors'
visitors.each do |batter|
puts batter.batter_name
end
puts
puts
puts 'Home'
home.... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_print_player_card.rb | test/test_print_player_card.rb | # This test prints information and statistics for a player in a format similar
# to what you would see on the back of a baseball card
# Only the past 3 seasons of statistics are included.
# Display card data for Curtis Granderson
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_get_team_game.rb | test/test_get_team_game.rb | $: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.new('det')
games = team.games_for_date('2009', '09', '15')
games.each do |game|
puts game.print_linescore
end | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
timothyf/gameday_api | https://github.com/timothyf/gameday_api/blob/7dc1e19d41723b998fdd9c8d6767011b7c2e9673/test/test_all_closing_pitchers_for_detroit.rb | test/test_all_closing_pitchers_for_detroit.rb | # This test will print a list of the starting pitchers for each of the Detroit
# Tigers games from the 2009 season.
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
require 'team'
team = Team.new('det')
pitchers = team.get_close_pitcher_appearances_by_year('2009')
count = 1
pitchers.each do |appearance|
... | ruby | MIT | 7dc1e19d41723b998fdd9c8d6767011b7c2e9673 | 2026-01-04T17:34:15.959323Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.