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 |
|---|---|---|---|---|---|---|---|---|
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/task_context.rb | lib/elevate/task_context.rb | module Elevate
# A blank slate for hosting task blocks.
#
# Because task blocks run in another thread, it is dangerous to expose them
# to the calling context. This class acts as a sandbox for task blocks.
#
# @api private
class TaskContext
def initialize(block, channel, args)
@__block = block
@__channel = channel
@__args = args
end
def execute
instance_exec(&@__block)
end
def task_args
@__args
end
def update(*args)
@__channel << args if @__channel
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http.rb | lib/elevate/http.rb | module Elevate
module HTTP
Request::METHODS.each do |m|
define_singleton_method(m) do |url, options = {}|
coordinator = IOCoordinator.for_thread
request = Request.new(m, url, options)
coordinator.signal_blocked(request) if coordinator
response = request.response
coordinator.signal_unblocked(request) if coordinator
if error = response.error
if error.code == NSURLErrorNotConnectedToInternet
raise OfflineError, error
else
raise RequestError, response.error
end
end
response
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/operation.rb | lib/elevate/operation.rb | module Elevate
# Executes an Elevate task, firing callbacks along the way.
#
class ElevateOperation < NSOperation
# Designated initializer.
#
# @return [ElevateOperation]
# newly initialized instance
#
# @api private
def initWithTarget(target, args: args, channel: channel)
if init
@coordinator = IOCoordinator.new
@context = TaskContext.new(target, channel, args)
@exception = nil
@result = nil
end
self
end
# Cancels the currently running task.
#
# @return [void]
#
# @api public
def cancel
@coordinator.cancel
super
end
# Runs the specified task.
#
# @return [void]
#
# @api private
def main
@coordinator.install
begin
unless @coordinator.cancelled?
@result = @context.execute
end
rescue => e
@exception = e
end
@coordinator.uninstall
@context = nil
end
# Returns the exception that terminated this task, if any.
#
# If the task has not finished, returns nil.
#
# @return [Exception, nil]
# exception that terminated the task
#
# @api public
attr_reader :exception
# Returns the result of the task block.
#
# If the task has not finished, returns nil.
#
# @return [Object, nil]
# result of the task block
#
# @api public
attr_reader :result
# Cancels any waiting operation with a TimeoutError, interrupting
# execution. This is not the same as #cancel.
#
# @return [void]
#
# @api public
def timeout
@coordinator.cancel(TimeoutError)
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/io_coordinator.rb | lib/elevate/io_coordinator.rb | module Elevate
# Implements task cancellation.
#
# Compliant I/O mechanisms (such as HTTP requests) register long-running
# operations with a well-known instance of this class. When a cancellation
# request is received from another thread, the long-running operation is
# cancelled.
class IOCoordinator
# Retrieves the current IOCoordinator for this thread.
#
# @return [IOCoordinator,nil]
# IOCoordinator previously installed to this thread
#
# @api public
def self.for_thread
Thread.current[:io_coordinator]
end
# Initializes a new IOCoordinator with the default state.
#
# @api private
def initialize
@lock = NSLock.alloc.init
@blocking_operation = nil
@cancelled = false
@exception_class = nil
end
# Cancels the I/O operation (if any), raising an exception of type
# +exception_class+ in the worker thread.
#
# If the thread is not currently blocked, then set a flag requesting cancellation.
#
# @return [void]
#
# @api private
def cancel(exception_class = CancelledError)
blocking_operation = nil
@lock.lock
@cancelled = true
@exception_class = exception_class
blocking_operation = @blocking_operation
@lock.unlock
if blocking_operation
blocking_operation.cancel
end
end
# Returns the cancelled flag.
#
# @return [Boolean]
# true if this coordinator has been +cancel+ed previously.
#
# @api private
def cancelled?
cancelled = nil
@lock.lock
cancelled = @cancelled
@lock.unlock
cancelled
end
# Installs this IOCoordinator to a well-known thread-local.
#
# @return [void]
#
# @api private
def install
Thread.current[:io_coordinator] = self
end
# Marks the specified operation as one that will potentially block the
# worker thread for a significant amount of time.
#
# @param operation [#cancel]
# operation responsible for blocking
#
# @return [void]
#
# @api public
def signal_blocked(operation)
check_for_cancellation
@lock.lock
@blocking_operation = operation
@lock.unlock
end
# Signals that the specified operation has completed, and is no longer
# responsible for blocking the worker thread.
#
# @return [void]
#
# @api public
def signal_unblocked(operation)
@lock.lock
@blocking_operation = nil
@lock.unlock
check_for_cancellation
end
# Removes the thread-local for the calling thread.
#
# @return [void]
#
# @api private
def uninstall
Thread.current[:io_coordinator] = nil
end
private
def check_for_cancellation
raise @exception_class if cancelled?
end
end
# Raised when a task is cancelled.
#
# @api public
class CancelledError < StandardError
end
# Raised when a task's timeout expires
#
# @api public
class TimeoutError < CancelledError
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/elevate.rb | lib/elevate/elevate.rb | module Elevate
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def task(name, options = {}, &block)
task_definitions[name.to_sym] = TaskDefinition.new(name.to_sym, options, &block)
end
def task_definitions
@task_definitions ||= {}
end
end
def cancel(name)
active_tasks.each do |task|
if task.name == name
task.cancel
end
end
end
def cancel_all
active_tasks.each do |task|
task.cancel
end
end
def launch(name, args = {})
raise ArgumentError, "args must be a Hash" unless args.is_a? Hash
definition = self.class.task_definitions[name.to_sym]
task = Task.new(definition, self, active_tasks)
task.start(args)
task
end
def task_args
@__elevate_task_args
end
def task_args=(args)
@__elevate_task_args = args
end
private
def active_tasks
@__elevate_active_tasks ||= []
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/thread.rb | lib/elevate/http/thread.rb | module Elevate
module HTTP
class NetworkThread
def self.cancel(connection)
connection.performSelector(:cancel, onThread:thread, withObject:nil, waitUntilDone:false)
end
def self.start(connection)
connection.performSelector(:start, onThread:thread, withObject:nil, waitUntilDone:false)
end
private
def self.main(_)
while true
NSRunLoop.currentRunLoop.run
end
end
def self.thread
Dispatch.once do
@thread = NSThread.alloc.initWithTarget(self, selector: :"main:", object: nil)
@thread.start
end
@thread
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/errors.rb | lib/elevate/http/errors.rb | module Elevate
module HTTP
# Raised when a request could not be completed.
class RequestError < RuntimeError
def initialize(error)
super(error.localizedDescription)
@code = error.code
end
attr_reader :code
end
# Raised when the internet connection is offline.
class OfflineError < RequestError
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/response.rb | lib/elevate/http/response.rb | module Elevate
module HTTP
# Encapsulates a response received from a HTTP server.
#
# @api public
class Response
def initialize
@body = nil
@headers = nil
@status_code = nil
@error = nil
@raw_body = NSMutableData.alloc.init
@url = nil
end
# Appends a chunk of data to the body.
#
# @api private
def append_data(data)
@raw_body.appendData(data)
end
# Returns the body of the response.
#
# If the body is JSON-encoded, it will be decoded and returned.
#
# @return [NSData, Hash, Array, nil]
# response body, if any. If the response is JSON-encoded, the decoded body.
#
# @api public
def body
@body ||= begin
if json?
NSJSONSerialization.JSONObjectWithData(@raw_body, options: 0, error: nil)
else
@raw_body
end
end
end
# Freezes this instance, making it immutable.
#
# @api private
def freeze
body
super
end
# Forwards unknown methods to +body+, enabling this object to behave like +body+.
#
# This only occurs if +body+ is a Ruby collection.
#
# @api public
def method_missing(m, *args, &block)
return super unless json?
body.send(m, *args, &block)
end
# Handles missing method queries, allowing +body+ masquerading.
#
# @api public
def respond_to_missing?(m, include_private = false)
return false unless json?
body.respond_to_missing?(m, include_private)
end
# Returns the HTTP headers
#
# @return [Hash]
# returned headers
#
# @api public
attr_accessor :headers
# Returns the HTTP status code
#
# @return [Integer]
# status code of the response
#
# @api public
attr_accessor :status_code
attr_accessor :error
# Returns the raw body
#
# @return [NSData]
# response body
#
# @api public
attr_reader :raw_body
# Returns the URL
#
# @return [String]
# URL of the response
#
# @api public
attr_accessor :url
private
def json?
headers && headers["Content-Type"] =~ %r{application/json}
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/base64.rb | lib/elevate/http/base64.rb | module Elevate
module HTTP
module Base64
def self.encode(s)
[s].pack("m0")
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/http_client.rb | lib/elevate/http/http_client.rb | module Elevate
module HTTP
class HTTPClient
def initialize(base_url)
@base_url = NSURL.URLWithString(base_url)
@credentials = nil
end
def get(path, query={}, &block)
issue(:get, path, nil, query: query, &block)
end
def post(path, body, &block)
issue(:post, path, body, &block)
end
def put(path, body, &block)
issue(:put, path, body, &block)
end
def delete(path, &block)
issue(:delete, path, nil, &block)
end
def set_credentials(username, password)
@credentials = { username: username, password: password }
end
private
def issue(method, path, body, options={}, &block)
url = url_for(path)
options[:headers] ||= {}
options[:headers]["Accept"] = "application/json"
if @credentials
options[:credentials] = @credentials
end
if body
options[:body] = NSJSONSerialization.dataWithJSONObject(body, options:0, error:nil)
options[:headers]["Content-Type"] = "application/json"
end
Elevate::HTTP.send(method, url, options)
end
def url_for(path)
path = CFURLCreateStringByAddingPercentEscapes(nil, path.to_s, "[]", ";=&,", KCFStringEncodingUTF8)
NSURL.URLWithString(path, relativeToURL:@base_url).absoluteString
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/uri.rb | lib/elevate/http/uri.rb | module Elevate
module HTTP
module URI
def self.encode_www_form(enum)
enum.map do |k,v|
if v.nil?
encode_www_form_component(k)
elsif v.respond_to?(:to_ary)
v.to_ary.map do |w|
str = encode_www_form_component(k)
if w.nil?
str
else
str + "=" + encode_www_form_component(w)
end
end.join('&')
else
encode_www_form_component(k) + "=" + encode_www_form_component(v)
end
end.join('&')
end
def self.encode_www_form_component(str)
# From AFNetworking :)
CFURLCreateStringByAddingPercentEscapes(nil,
str,
"[].",
":/?&=;+!@\#$()~',*",
CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding))
end
def self.encode_query(hash)
return "" if hash.nil? || hash.empty?
hash.map do |key, value|
"#{URI.escape_query_component(key.to_s)}=#{URI.escape_query_component(value.to_s)}"
end.join("&")
end
def self.escape_query_component(component)
component.gsub(/([^ a-zA-Z0-9_.-]+)/) do
'%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
end.tr(' ', '+')
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/request.rb | lib/elevate/http/request.rb | module Elevate
module HTTP
# Encapsulates a HTTP request.
#
# +NSURLConnection+ is responsible for fulfilling the request. The response
# is buffered in memory as it is received, and made available through the
# +response+ method.
#
# @api public
class Request
METHODS = [:get, :post, :put, :delete, :patch, :head, :options].freeze
# Initializes a HTTP request with the specified parameters.
#
# @param [String] method
# HTTP method to use
# @param [String] url
# URL to load
# @param [Hash] options
# Options to use
#
# @option options [Hash] :query
# Hash to construct the query string from.
# @option options [Hash] :headers
# Headers to append to the request.
# @option options [Hash] :credentials
# Credentials to be used with HTTP Basic Authentication. Must have a
# +:username+ and/or +:password+ key.
# @option options [NSData] :body
# Raw bytes to use as the body.
# @option options [Hash,Array] :json
# Hash/Array to be JSON-encoded as the request body. Sets the
# +Content-Type+ header to +application/json+.
# @option options [Hash] :form
# Hash to be form encoded as the request body. Sets the +Content-Type+
# header to +application/x-www-form-urlencoded+.
#
# @raise [ArgumentError]
# if an illegal HTTP method is used
# @raise [ArgumentError]
# if the URL does not start with 'http'
# @raise [ArgumentError]
# if the +:body+ option is not an instance of +NSData+
def initialize(method, url, options={})
raise ArgumentError, "invalid HTTP method" unless METHODS.include? method.downcase
raise ArgumentError, "invalid URL" unless url.start_with? "http"
raise ArgumentError, "invalid body type; must be NSData" if options[:body] && ! options[:body].is_a?(NSData)
unless options.fetch(:query, {}).empty?
url += "?" + URI.encode_query(options[:query])
end
@allow_self_sign_certificate = options.fetch(:allow_self_sign_certificate, false)
options[:headers] ||= {}
if root = options.delete(:json)
options[:body] = NSJSONSerialization.dataWithJSONObject(root, options: 0, error: nil)
options[:headers]["Content-Type"] = "application/json"
elsif root = options.delete(:form)
options[:body] = URI.encode_www_form(root).dataUsingEncoding(NSASCIIStringEncoding)
options[:headers]["Content-Type"] ||= "application/x-www-form-urlencoded"
end
@request = NSMutableURLRequest.alloc.init
@request.CachePolicy = NSURLRequestReloadIgnoringLocalCacheData
@request.HTTPBody = options[:body]
@request.HTTPMethod = method
@request.URL = NSURL.URLWithString(url)
headers = options.fetch(:headers, {})
if credentials = options[:credentials]
headers["Authorization"] = get_authorization_header(credentials)
end
headers.each do |key, value|
@request.setValue(value.to_s, forHTTPHeaderField:key.to_s)
end
#@cache = self.class.cache
@response = Response.new
@response.url = url
@connection = nil
@future = Future.new
end
# Cancels an in-flight request.
#
# This method is safe to call from any thread.
#
# @return [void]
#
# @api public
def cancel
return unless sent?
NetworkThread.cancel(@connection) if @connection
ActivityIndicator.instance.hide
@future.fulfill(nil)
end
# Returns a response to this request, sending it if necessary
#
# This method blocks the calling thread, unless interrupted.
#
# @return [Elevate::HTTP::Response, nil]
# response to this request, or nil, if this request was canceled
#
# @api public
def response
unless sent?
send
end
@future.value
end
# Sends this request. The caller is not blocked.
#
# @return [void]
#
# @api public
def send
@connection = NSURLConnection.alloc.initWithRequest(@request, delegate:self, startImmediately:false)
@request = nil
NetworkThread.start(@connection)
ActivityIndicator.instance.show
end
# Returns true if this request is in-flight
#
# @return [Boolean]
# true if this request is in-flight
#
# @api public
def sent?
@connection != nil
end
private
def self.cache
Dispatch.once do
@cache = NSURLCache.alloc.initWithMemoryCapacity(0, diskCapacity: 0, diskPath: nil)
NSURLCache.setSharedURLCache(cache)
end
@cache
end
def connection(connection, didReceiveResponse: response)
@response.headers = response.allHeaderFields
@response.status_code = response.statusCode
end
def connection(connection, didReceiveData: data)
@response.append_data(data)
end
def connection(connection, didFailWithError: error)
@connection = nil
puts "ERROR: #{error.localizedDescription} (code: #{error.code})" unless RUBYMOTION_ENV == "test"
@response.error = error
ActivityIndicator.instance.hide
response = @response
@response = nil
@future.fulfill(response)
end
def connectionDidFinishLoading(connection)
@connection = nil
ActivityIndicator.instance.hide
response = @response
@response = nil
@future.fulfill(response)
end
def connection(connection, willSendRequest: request, redirectResponse: response)
@response.url = request.URL.absoluteString
request
end
def connection(connection, canAuthenticateAgainstProtectionSpace: protectionSpace)
@allow_self_sign_certificate
end
def connection(connection, didReceiveAuthenticationChallenge: challenge)
if @allow_self_sign_certificate
credential = NSURLCredential.credentialForTrust(challenge.protectionSpace.serverTrust)
challenge.sender.useCredential(
credential,
forAuthenticationChallenge:challenge
)
challenge.sender.continueWithoutCredentialForAuthenticationChallenge(challenge)
end
end
def get_authorization_header(credentials)
"Basic " + Base64.encode("#{credentials[:username]}:#{credentials[:password]}")
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
mattgreen/elevate | https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/http/activity_indicator.rb | lib/elevate/http/activity_indicator.rb | module Elevate
module HTTP
class ActivityIndicator
def self.instance
Dispatch.once { @instance = new }
@instance
end
def initialize
@lock = NSLock.alloc.init
@count = 0
end
def hide
toggled = false
@lock.lock
@count -= 1 if @count > 0
toggled = @count == 0
@lock.unlock
update_indicator(false) if toggled
end
def show
toggled = false
@lock.lock
toggled = @count == 0
@count += 1
@lock.unlock
update_indicator(true) if toggled
end
private
def update_indicator(visible)
UIApplication.sharedApplication.networkActivityIndicatorVisible = visible
end
end
end
end
| ruby | MIT | edb3e428c9643974cdf1a747ff961c09d771aec5 | 2026-01-04T17:55:16.391428Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/spec/spec_helper.rb | spec/spec_helper.rb | $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
begin
require "byebug"
rescue LoadError
puts "Platform incompatible"
end
require "coveralls"
require "simplecov"
SimpleCov.start
Coveralls.wear!
require "five-star"
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.filter_run :focus
config.run_all_when_everything_filtered = true
config.disable_monkey_patching!
config.warnings = true
config.order = :random
if config.files_to_run.one?
config.default_formatter = 'doc'
end
Kernel.srand config.seed
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/spec/five-star/five_star_spec.rb | spec/five-star/five_star_spec.rb | require "spec_helper"
RSpec.describe FiveStar do
describe ".rateable" do
it "is the rateable module" do
expect(FiveStar.rateable).to eq(FiveStar::Rateable)
end
end
describe ".base_rater" do
it "is the base rater class" do
expect(FiveStar.base_rater).to eq(FiveStar::BaseRater)
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/spec/five-star/rateable_spec.rb | spec/five-star/rateable_spec.rb | require "spec_helper"
RSpec.describe FiveStar::Rateable do
class Rater
def self.build(_); self; end
def self.description; end
end
subject(:dummy_class) {
Class.new do
include FiveStar::Rateable
rate_with(Rater, Rater, Rater)
end
}
describe ".rate_with" do
it "sets class" do
expect(dummy_class.rating_klasses).to eq [Rater, Rater, Rater]
end
end
describe "#rating" do
before do
allow(FiveStar::RatingCalculator).to receive(:rate).and_return(5)
end
it "passes raters to calculation class" do
expect(FiveStar::RatingCalculator).to receive(:rate).with(anything, [Rater, Rater, Rater])
dummy_class.new.rating
end
it "returns value from calculation" do
expect(dummy_class.new.rating).to eq 5
end
end
describe "#rating_descriptions" do
before do
allow(Rater).to receive(:description).and_return("A", "B", "C")
end
it "returns descriptions from raters in order" do
expect(dummy_class.new.rating_descriptions).to eq ["A", "B", "C"]
end
end
describe "integration specs" do
context "without any raters" do
subject(:dummy_class) {
Class.new do
include FiveStar::Rateable
def rateable_name
"Dummy rater"
end
end
}
describe "#rating" do
it "is has a default value" do
expect(dummy_class.new.rating).to eq 0.0
end
end
describe "#rating_descriptions" do
it "returns empty descriptions" do
expect(dummy_class.new.rating_descriptions).to eq []
end
end
end
context "with invalid rater" do
class BadRater < FiveStar.base_rater
def rating; 200; end
def weighting; 1.0; end
end
subject(:dummy_class) {
Class.new do
include FiveStar::Rateable
rate_with(BadRater)
def rateable_name
"Dummy rater"
end
end
}
describe "#rating" do
it "raises error with helpful message" do
expect{
dummy_class.new.rating
}.to raise_error(FiveStar::RatingError).with_message("Rating 200.0 is invalid from BadRater")
end
end
end
context "with valid raters" do
class FirstRater < FiveStar.base_rater
def description; "A"; end
def rating; 2; end
def weighting; 0.6; end
end
class SecondRater < FiveStar.base_rater
def rating; 7; end
def weighting; 0.4; end
end
class ThirdRater < FiveStar.base_rater
def description
"ThirdRater rated #{rateable.rateable_name} at #{rating} with weighting of #{weighting}"
end
def rating; 6; end
def weighting; 0.3; end
end
subject(:dummy_class) {
Class.new do
include FiveStar::Rateable
rate_with(FirstRater, SecondRater, ThirdRater)
def rateable_name
"Dummy rater"
end
end
}
describe "#rating" do
it "is the weighted average" do
expect(dummy_class.new.rating).to be_within(0.0001).of 4.4615
end
end
describe "#rating_descriptions" do
it "returns descriptions from raters in order" do
expect(dummy_class.new.rating_descriptions).to eq ["A", "SecondRater rated Dummy rater at 7 with weighting of 0.4", "ThirdRater rated Dummy rater at 6 with weighting of 0.3"]
end
end
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/spec/five-star/base_rater_spec.rb | spec/five-star/base_rater_spec.rb | require "spec_helper"
RSpec.describe FiveStar::BaseRater do
let(:rateable) { double("Rateable", rateable_name: "Rateable", configuration: configuration) }
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
subject { described_class.new(rateable) }
describe ".build" do
it "returns new instance" do
expect(described_class.build(rateable)).to be_instance_of described_class
end
end
describe ".rating_weight" do
after { described_class.rating_weight(nil) }
it "sets weighting value" do
expect {
described_class.rating_weight(0.5)
}.to change { described_class.weighting }.to 0.5
end
end
describe ".rating_weight" do
context "when no weighting set" do
it "uses default value" do
expect(described_class.weighting).to eq 1.0
end
end
context "when set" do
before { described_class.rating_weight(0.1) }
after { described_class.rating_weight(nil) }
it "uses correct value" do
expect(described_class.weighting).to eq 0.1
end
end
end
describe "#rating" do
let(:configuration) { double("Configuration", min_rating: 100.0, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
it "is minimum value from configuration by default" do
expect(subject.rating).to eq 100.0
end
end
describe "#description" do
it "includes rater class name" do
expect(subject.description).to include "Rateable"
end
it "has rating" do
expect(subject.description).to include "0"
end
it "has weighting" do
expect(subject.description).to include "1.0"
end
end
describe "#weighting" do
it "is correct weighting for class" do
expect(subject.weighting).to eq described_class.weighting
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/spec/five-star/rating_calculator_spec.rb | spec/five-star/rating_calculator_spec.rb | require "spec_helper"
RSpec.describe FiveStar::RatingCalculator do
let(:list_of_raters) { [first_rater, second_rater, third_rater] }
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
subject { described_class.new(configuration, list_of_raters) }
describe "#calculate_rating" do
context "with no rating classes provided" do
let(:configuration) { double("Configuration", min_rating: min_rating, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:list_of_raters) { [] }
let(:min_rating) { 1.0 }
it "is returns minimum rating" do
expect(subject.calculate_rating).to eq 1.0
end
end
describe "validation" do
describe "rating" do
let(:first_rater) { double("FiveStar::BaseRater", class: "FiveStar::BaseRater", rating: 0, weighting: 1.0) }
let(:second_rater) { double("FiveStar::BaseRater", class: "FiveStar::ErrorRater", rating: rating, weighting: 1.0) }
let(:third_rater) { double("FiveStar::BaseRater", class: "FiveStar::BaseRater", rating: 0, weighting: 1.0) }
context "below minimum" do
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:rating) { -10.0 }
it "raises error with helpful message" do
expect{
subject.calculate_rating
}.to raise_error(FiveStar::RatingError).with_message("Rating #{rating} is invalid from FiveStar::ErrorRater")
end
end
context "on minimum" do
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:rating) { 0.0 }
it "does not raise error" do
expect{
subject.calculate_rating
}.not_to raise_error
end
end
context "within range" do
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:rating) { 5.0 }
it "does not raise error" do
expect{
subject.calculate_rating
}.not_to raise_error
end
end
context "on maximum" do
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 1, min_weighting: 0.0, max_weighting: 1.0) }
let(:rating) { 1.0 }
it "does not raise error" do
expect{
subject.calculate_rating
}.not_to raise_error
end
end
context "above maximum" do
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 2, min_weighting: 0.0, max_weighting: 1.0) }
let(:rating) { 3.0 }
it "raises error with helpful message" do
expect{
subject.calculate_rating
}.to raise_error(FiveStar::RatingError).with_message("Rating #{rating} is invalid from FiveStar::ErrorRater")
end
end
context "when string" do
let(:configuration) { double("Configuration", min_rating: 0, max_rating: 2, min_weighting: 0, max_weighting: 1.0) }
let(:rating) { "foo" }
it "parses to number" do
#byebug
expect(subject.calculate_rating).to eq 0.0
end
end
end
describe "weighting" do
let(:first_rater) { double("FiveStar::BaseRater", class: "FiveStar::BaseRater", rating: 5, weighting: 1.0) }
let(:second_rater) { double("FiveStar::BaseRater", class: "FiveStar::ErrorRater", rating: 5, weighting: weighting) }
let(:third_rater) { double("FiveStar::BaseRater", class: "FiveStar::BaseRater", rating: 5, weighting: 1.0) }
context "below minimum" do
let(:configuration) { double("Configuration", min_rating: 1, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:weighting) { -1.0 }
it "raises error with helpful message" do
expect{
subject.calculate_rating
}.to raise_error(FiveStar::RatingError).with_message("Weighting #{weighting} is invalid from FiveStar::ErrorRater")
end
end
context "on minimum" do
let(:configuration) { double("Configuration", min_rating: 1, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:weighting) { 0 }
it "does not raise error" do
expect{
subject.calculate_rating
}.not_to raise_error
end
end
context "within range" do
let(:configuration) { double("Configuration", min_rating: 1, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:weighting) { 0.5 }
it "does not raise error" do
expect{
subject.calculate_rating
}.not_to raise_error
end
end
context "on maximum" do
let(:configuration) { double("Configuration", min_rating: 1, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:weighting) { 1.0 }
it "does not raise error" do
expect{
subject.calculate_rating
}.not_to raise_error
end
end
context "above maximum" do
let(:configuration) { double("Configuration", min_rating: 1, max_rating: 10, min_weighting: 0.0, max_weighting: 1.0) }
let(:weighting) { 1.1 }
it "raises error with helpful message" do
expect{
subject.calculate_rating
}.to raise_error(FiveStar::RatingError).with_message("Weighting 1.1 is invalid from FiveStar::ErrorRater")
end
end
end
end
describe "rating calculation" do
context "with rating classes" do
context "having zero rating" do
let(:first_rater) { double("FiveStar::BaseRater", rating: 0, weighting: 1.0) }
let(:second_rater) { double("FiveStar::BaseRater", rating: 0, weighting: 1.0) }
let(:third_rater) { double("FiveStar::BaseRater", rating: 0, weighting: 1.0) }
it "is zero" do
expect(subject.calculate_rating).to be_zero
end
end
context "having identical weighting" do
let(:first_rater) { double("FiveStar::BaseRater", rating: 2, weighting: 1.0) }
let(:second_rater) { double("FiveStar::BaseRater", rating: 7, weighting: 1.0) }
let(:third_rater) { double("FiveStar::BaseRater", rating: 6, weighting: 1.0) }
it "is the average" do
expect(subject.calculate_rating).to eq 5.0
end
end
context "having varying weights" do
let(:first_rater) { double("FiveStar::BaseRater", rating: 2, weighting: 0.6) }
let(:second_rater) { double("FiveStar::BaseRater", rating: 7, weighting: 0.4) }
let(:third_rater) { double("FiveStar::BaseRater", rating: 6, weighting: 0.3) }
it "is the weighted average" do
expect(subject.calculate_rating).to be_within(0.0001).of 4.4615
end
end
end
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/lib/five-star.rb | lib/five-star.rb | require "five-star/version"
require "five-star/base_rater"
require "five-star/configuration"
require "five-star/rateable"
require "five-star/errors"
require "five-star/rating_calculator"
# Base module for library interface
module FiveStar
class << self
# Include this in your class that can be rated - this is your domain model
# object that has various attributes that you need rated.
# Being +rateable+ is defined as an object that has attributes on which a
# rating can be calculated based on varying attributes of that model.
#
# This adds the public class and instance methods from the Rateable module.
#
# @example
# class Film
# include FiveStar.rateable
#
# rate_with GoreRater, SwearingRater, SexRater
# # ...
# end
#
# @see FiveStar::Rateable
#
# @return [Class]
#
# @api public
def rateable
Rateable
end
# The base class of a class that gives a rating and weighting to something
# that is rateable. See FiveStar.rateable.
#
# This implements the interface necessary to calculate a rating for the
# rateable instance. At a minimum this must be +build+, +rating+,
# +description+ and +weighting+.
#
# The method +build+ *will* be called on each class with the argument of
# the instance being rated.
#
# @example
# class GoreRater < FiveStar.base_rater
# rating_weight 0.4
#
# def description
# "The Film #{film.title} has #{film.number_of_swear_words} and was rated at #{rating}"
# end
#
# def rating
# # calculate rating somehow
# end
# end
#
# @see FiveStar::BaseRater
#
# @return [Class]
#
# @api public
def base_rater
BaseRater
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/lib/five-star/version.rb | lib/five-star/version.rb | module FiveStar
VERSION = "1.0.0"
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/lib/five-star/errors.rb | lib/five-star/errors.rb | module FiveStar
# Exception raised when error calculating occurs.
#
RatingError = Class.new(StandardError)
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/lib/five-star/base_rater.rb | lib/five-star/base_rater.rb | module FiveStar
# Base implementation of a class to give a rating, weighting and description
# to a +rateable+ instance.
#
# You are *expected* to subclass this class and override the default
# implementation with your own implementation.
class BaseRater
# Called to build a new instance of the rater with the given object being rated.
#
# @param [Object] rateable
# the instance of the Object being rated
#
# @return [Object] the instance of Rating class created ready to be used
#
# @api public
def self.build(rateable)
new(rateable)
end
# Set the weighting for this rating classifcation class. This should
# a valid floating point within the scale configured.
#
# @example
# class GoreRater < FiveStar.base_rater
# rating_weight 0.4
# # ...
# end
#
# @param [Float] weighting
# the weighting value
#
# @return [undefined]
#
# @api public
def self.rating_weight(weighting)
@weighting = weighting
end
# Return the weighting value for this rating classifcation class.
#
# @return [Float]
# the weighting value. Defaults to 1.0
#
# @api public
def self.weighting
@weighting ||= Configuration::DEFAULT_WEIGHTING
end
# Create a new instance of rater
#
# @param [Object] rateable
# the instance of the Object being rated
#
# @api private
def initialize(rateable)
@rateable = rateable
end
# Return the rating description for the rater given to the +rateable+
# object.
# Override this method to customise the message.
#
# @example
# class GoreRater < FiveStar.base_rater
# rating_weight 0.4
#
# def description
# "The film #{film.title} has #{film.number_of_swear_words} and was rated at #{rating}"
# end
# end
#
# rater.description # => "The film Alien was rated 8 for gore"
#
# @return [String] the description
#
# @api public
def description
"#{self.class} rated #{rateable_name} at #{rating} with weighting of #{weighting}"
end
# Return the rating for the rater given to the +rateable+ object.
# You are *expected* to override this method to perform your own calculation
# for the rating based on your own criteria. If this is an expensive
# operation then the result should be cached as this method *can* be
# called more than once, for example by the +description+ method.
#
# @example
# class GoreRater < FiveStar.base_rater
# rating_weight 0.4
#
# def rating
# # count the pints of blood spilt in the film and return a rating
# if film.blood_spilt == :a_lot
# 10
# elsif film.blood_spilt == :a_little
# 5
# else
# 0
# end
# end
# end
#
# rater.rating # => 6
#
# @raise [FiveStar::RatingError] raises error if any raters return either
# +rating+ or +weighting+ that is outside of configuration bounds.
#
# @return [Float] the rating value calculated.
# Defaults to minimum rating value unless overridden
#
# @api public
def rating
configuration.min_rating
end
# Return the weighting value for this rating classifcation class.
#
# @return [Float]
# the weighting value
#
# @api public
def weighting
self.class.weighting
end
protected
attr_reader :rateable
# Return the maximum weighting value for this rating classifcation class.
# By default this comes from the instance of FiveStar::Configuration used.
#
# Override if required - this should be the same for each rater class.
#
# @return [Fixnum]
# the maximum rating value from configuration.
#
# @api protected
def max_rating
configuration.max_rating
end
# Return the minimum weighting value for this rating classifcation class.
# By default this comes from the instance of FiveStar::Configuration used.
#
# Override if required - this should be the same for each rater class.
#
# @return [Fixnum]
# the minimum rating value from configuration.
#
# @api protected
def min_rating
configuration.min_rating
end
# Return the name of the given rateable instance.
#
# @return [String]
# the name of the object being rated.
#
# @api protected
def rateable_name
rateable.rateable_name
end
# The current configuration instance for the given +rateable+ object.
#
# @return [FiveStar::Configuration]
# the instance of configuration described by the +rateable+ class.
#
# @api protected
def configuration
rateable.configuration
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/lib/five-star/configuration.rb | lib/five-star/configuration.rb | module FiveStar
# Default configuration of rating values and weighting.
#
# @api private
class Configuration
DEFAULT_WEIGHTING = 1.0.freeze
def min_rating; 0.0; end
def max_rating; 10.0; end
def min_weighting; 0.0; end
def max_weighting; 1.0; end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/lib/five-star/rating_calculator.rb | lib/five-star/rating_calculator.rb | module FiveStar
# Calculate overall rating for the rateable object from each rater.
# Each instance must implement +rating+ and +weighting+.
# The configuration instance provides min and max rating and weighting values.
#
# @api private
class RatingCalculator
# @see calculate_rating
def self.rate(configuration, raters)
new(configuration, raters).calculate_rating
end
def initialize(configuration, raters)
@configuration = configuration
@raters = raters
end
# Calculate the overall weighting from each rating class
#
# @return [Float] the calculated rating
# The min rating will be returned if there are no raters.
#
# @raise [FiveStar::RatingError] raises error if any raters return either
# +rating+ or +weighting+ that is outside of configuration bounds.
#
# @api private
def calculate_rating
return min_rating unless raters.any?
sum_total / weights_total
end
private
attr_reader :raters, :configuration
def sum_total
raters.map { |rater|
validate_rating!(rater.rating, rater) * validate_weighting!(rater.weighting, rater)
}.reduce(&:+)
end
def weights_total
raters.map(&:weighting).reduce(&:+)
end
def validate_rating!(rating, rater)
rating = rating.to_f
if rating < min_rating || rating > max_rating
raise RatingError, "Rating #{rating} is invalid from #{rater.class}"
else
rating
end
end
def validate_weighting!(weighting, rater)
weighting = weighting.to_f
if weighting < min_weighting || weighting > max_weighting
raise RatingError, "Weighting #{weighting} is invalid from #{rater.class}"
else
weighting
end
end
def min_rating
configuration.min_rating
end
def max_rating
configuration.max_rating
end
def min_weighting
configuration.min_weighting
end
def max_weighting
configuration.max_weighting
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
rob-murray/five-star | https://github.com/rob-murray/five-star/blob/41109fe87c95b94387363203bf41d59d6b160f0d/lib/five-star/rateable.rb | lib/five-star/rateable.rb | module FiveStar
# A module to be included to enhance an object with the interface below.
module Rateable
# Extends base class or a module with Rateable methods
#
# @param base [Object]
# the object to mix in this *Rateable* module
#
# @return [undefined]
#
# @api private
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# Set which rating classes will be used to rate the object
# using this module.
# Each class must implement the rater methods, see FiveStar::BaseRater
#
# @example
# class Film
# include FiveStar.rateable
#
# rate_with GoreRater, SwearingRater, SexRater
# # ...
# end
#
# @param klasses [Class]
# constants referencing classes to rate object included with
#
# @return [undefined]
#
# @see FiveStar::BaseRater
#
# @api public
def rate_with(*klasses)
@rating_klasses = Array(klasses)
end
# Return which rating classes will be used to rate the object
# using this module.
#
# @return [Array] list of classes to rate with
#
# @see FiveStar.rateable
#
# @api private
def rating_klasses
@rating_klasses ||= []
end
# Reference to Configuration used for this +rateable+ instance.
#
# @return [FiveStar::Configuration] Configuration instance in use
#
# @see FiveStar::Configuration
#
# @api private
def configuration
@configuration ||= Configuration.new
end
end
# Return the rating given to the +rateable+ object by calculating based on
# set raters and their configuration.
#
# @example
# film = Film.new
# film.rating # => 6.0
#
# @return [Float] rating calculated by set raters for the object
#
# @raise [FiveStar::RatingError] raises error if any raters return either
# +rating+ or +weighting+ that is outside of configuration bounds.
#
# @api public
def rating
rating_calculator.rate(self.class.configuration, raters)
end
# Return the rating description for each rater given to the +rateable+
# object.
# These are returned in the order in which the rating classes were
# defined in +rate_with+.
#
# @example
# film = Film.new
# film.rating_descriptions # => ["The film Alien was rated 8 for gore", ...]
#
# @return [Array] list of descriptions from each rater
#
# @api public
def rating_descriptions
raters.map { |rater| rater.description }
end
# The name of the object that is rateable. This may be used by raters when
# generating descriptions.
# This can be overridden to provide a better response, otherwise is the class name.
#
# @return [String] name of the class
#
# @api public
def rateable_name
self.class.name
end
# Reference to Configuration used for this +rateable+ instance. Delegates to class.
#
# @return [FiveStar::Configuration] Configuration instance in use
#
# @api private
def configuration
self.class.configuration
end
protected
# The instance that included this module
#
# @return [Object] self
#
# @api protected
def rateable
self
end
private
def raters
@raters ||= rating_klasses.map { |rater| rater.build(rateable) }
end
def rating_klasses
rateable.class.rating_klasses
end
def rating_calculator
RatingCalculator
end
end
end
| ruby | MIT | 41109fe87c95b94387363203bf41d59d6b160f0d | 2026-01-04T17:55:19.222030Z | false |
jacquescrocker/jammit-s3 | https://github.com/jacquescrocker/jammit-s3/blob/e8aaa4074ab1689795de9376460261cc2c466fa5/lib/jammit-s3.rb | lib/jammit-s3.rb | require 'jammit/command_line'
require 'jammit/s3_command_line'
require 'jammit/s3_uploader'
module Jammit
def self.upload_to_s3!(options = {})
S3Uploader.new(options).upload
end
end
if defined?(Rails)
module Jammit
class JammitRailtie < Rails::Railtie
initializer "set asset host and asset id" do
config.before_initialize do
if Jammit.configuration[:use_cloudfront] && Jammit.configuration[:cloudfront_cname].present? && Jammit.configuration[:cloudfront_domain].present?
asset_hostname = Jammit.configuration[:cloudfront_cname]
asset_hostname_ssl = Jammit.configuration[:cloudfront_domain]
elsif Jammit.configuration[:use_cloudfront] && Jammit.configuration[:cloudfront_domain].present?
asset_hostname = asset_hostname_ssl = Jammit.configuration[:cloudfront_domain]
else
asset_hostname = asset_hostname_ssl = "#{Jammit.configuration[:s3_bucket]}.s3.amazonaws.com"
end
if Jammit.package_assets and asset_hostname.present?
puts "Initializing Cloudfront"
ActionController::Base.asset_host = Proc.new do |source, request|
if Jammit.configuration.has_key?(:ssl)
protocol = Jammit.configuration[:ssl] ? "https://" : "http://"
else
protocol = request.protocol
end
if request.protocol == "https://"
"#{protocol}#{asset_hostname_ssl}"
else
"#{protocol}#{asset_hostname}"
end
end
end
end
end
end
end
end | ruby | MIT | e8aaa4074ab1689795de9376460261cc2c466fa5 | 2026-01-04T17:55:19.350524Z | false |
jacquescrocker/jammit-s3 | https://github.com/jacquescrocker/jammit-s3/blob/e8aaa4074ab1689795de9376460261cc2c466fa5/lib/jammit/s3_uploader.rb | lib/jammit/s3_uploader.rb | require 'rubygems'
require 'hmac'
require 'hmac-sha1'
require 'net/https'
require 'base64'
require 'mimemagic'
require 'digest/md5'
module Jammit
class S3Uploader
def initialize(options = {})
@bucket = options[:bucket]
unless @bucket
@bucket_name = options[:bucket_name] || Jammit.configuration[:s3_bucket]
@access_key_id = options[:access_key_id] || Jammit.configuration[:s3_access_key_id]
@secret_access_key = options[:secret_access_key] || Jammit.configuration[:s3_secret_access_key]
@bucket_location = options[:bucket_location] || Jammit.configuration[:s3_bucket_location]
@cache_control = options[:cache_control] || Jammit.configuration[:s3_cache_control]
@acl = options[:acl] || Jammit.configuration[:s3_permission]
@bucket = find_or_create_bucket
if Jammit.configuration[:use_cloudfront]
@changed_files = []
@cloudfront_dist_id = options[:cloudfront_dist_id] || Jammit.configuration[:cloudfront_dist_id]
end
end
end
def upload
log "Pushing assets to S3 bucket: #{@bucket.name}"
globs = []
# add default package path
if Jammit.gzip_assets
globs << "public/#{Jammit.package_path}/**/*.gz"
else
globs << "public/#{Jammit.package_path}/**/*.css"
globs << "public/#{Jammit.package_path}/**/*.js"
end
# add images
globs << "public/images/**/*" unless Jammit.configuration[:s3_upload_images] == false
# add custom configuration if defined
s3_upload_files = Jammit.configuration[:s3_upload_files]
globs << s3_upload_files if s3_upload_files.is_a?(String)
globs += s3_upload_files if s3_upload_files.is_a?(Array)
# upload all the globs
globs.each do |glob|
upload_from_glob(glob)
end
if Jammit.configuration[:use_cloudfront] && !@changed_files.empty?
log "invalidating cloudfront cache for changed files"
invalidate_cache(@changed_files)
end
end
def upload_from_glob(glob)
log "Pushing files from #{glob}"
log "#{ASSET_ROOT}/#{glob}"
Dir["#{ASSET_ROOT}/#{glob}"].each do |local_path|
next if File.directory?(local_path)
remote_path = local_path.gsub(/^#{ASSET_ROOT}\/public\//, "")
use_gzip = false
# handle gzipped files
if File.extname(remote_path) == ".gz"
use_gzip = true
remote_path = remote_path.gsub(/\.gz$/, "")
end
# check if the file already exists on s3
begin
obj = @bucket.objects.find_first(remote_path)
rescue
obj = nil
end
# if the object does not exist, or if the MD5 Hash / etag of the
# file has changed, upload it
if !obj || (obj.etag != Digest::MD5.hexdigest(File.read(local_path)))
# save to s3
new_object = @bucket.objects.build(remote_path)
new_object.cache_control = @cache_control if @cache_control
new_object.content_type = MimeMagic.by_path(remote_path)
new_object.content = open(local_path)
new_object.content_encoding = "gzip" if use_gzip
new_object.acl = @acl if @acl
log "pushing file to s3: #{remote_path}"
new_object.save
if Jammit.configuration[:use_cloudfront] && obj
log "File changed and will be invalidated in cloudfront: #{remote_path}"
@changed_files << remote_path
end
else
log "file has not changed: #{remote_path}"
end
end
end
def find_or_create_bucket
s3_service = S3::Service.new(:access_key_id => @access_key_id, :secret_access_key => @secret_access_key)
# find or create the bucket
begin
s3_service.buckets.find(@bucket_name)
rescue S3::Error::NoSuchBucket
log "Bucket not found. Creating '#{@bucket_name}'..."
bucket = s3_service.buckets.build(@bucket_name)
location = (@bucket_location.to_s.strip.downcase == "eu") ? :eu : :us
bucket.save(location)
bucket
end
end
def invalidate_cache(files)
paths = ""
files.each do |key|
log "adding /#{key} to list of invalidation requests"
paths += "<Path>/#{key}</Path>"
end
digest = HMAC::SHA1.new(@secret_access_key)
digest << date = Time.now.utc.strftime("%a, %d %b %Y %H:%M:%S %Z")
uri = URI.parse("https://cloudfront.amazonaws.com/2010-11-01/distribution/#{@cloudfront_dist_id}/invalidation")
req = Net::HTTP::Post.new(uri.path)
req.initialize_http_header({
'x-amz-date' => date,
'Content-Type' => 'text/xml',
'Authorization' => "AWS %s:%s" % [@access_key_id, Base64.encode64(digest.digest).gsub("\n", '')]
})
req.body = "<InvalidationBatch>#{paths}<CallerReference>#{@cloudfront_dist_id}_#{Time.now.utc.to_i}</CallerReference></InvalidationBatch>"
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
res = http.request(req)
log result_message(req, res)
end
def result_message req, res
if res.code == "201"
'Invalidation request succeeded'
else
<<-EOM.gsub(/^\s*/, '')
=============================
Failed with #{res.code} error!
Request path:#{req.path}
Request header: #{req.to_hash}
Request body:#{req.body}
Response body: #{res.body}
=============================
EOM
end
end
def log(msg)
puts msg
end
end
end
| ruby | MIT | e8aaa4074ab1689795de9376460261cc2c466fa5 | 2026-01-04T17:55:19.350524Z | false |
jacquescrocker/jammit-s3 | https://github.com/jacquescrocker/jammit-s3/blob/e8aaa4074ab1689795de9376460261cc2c466fa5/lib/jammit/s3_command_line.rb | lib/jammit/s3_command_line.rb | require 's3'
module Jammit
class S3CommandLine < CommandLine
def initialize
super
ensure_s3_configuration
begin
Jammit.upload_to_s3!
rescue S3::Error::BucketAlreadyExists => e
# tell them to pick another name
puts e.message
exit(1)
end
end
protected
def ensure_s3_configuration
bucket_name = Jammit.configuration[:s3_bucket]
unless bucket_name.is_a?(String) && bucket_name.length > 0
puts "\nA valid s3_bucket name is required."
puts "Please add one to your Jammit config (config/assets.yml):\n\n"
puts "s3_bucket: my-bucket-name\n\n"
exit(1)
end
access_key_id = Jammit.configuration[:s3_access_key_id]
unless access_key_id.is_a?(String) && access_key_id.length > 0
puts "access_key_id: '#{access_key_id}' is not valid"
exit(1)
end
secret_access_key = Jammit.configuration[:s3_secret_access_key]
unless secret_access_key.is_a?(String) && secret_access_key.length > 0
puts "secret_access_key: '#{secret_access_key}' is not valid"
exit(1)
end
end
end
end | ruby | MIT | e8aaa4074ab1689795de9376460261cc2c466fa5 | 2026-01-04T17:55:19.350524Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/jobs/application_job.rb | app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/helpers/hello_codespaces_helper.rb | app/helpers/hello_codespaces_helper.rb | module HelloCodespacesHelper
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/helpers/application_helper.rb | app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/controllers/hello_controller.rb | app/controllers/hello_controller.rb | class HelloController < ApplicationController
def index
end
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/controllers/application_controller.rb | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/models/application_record.rb | app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/mailers/application_mailer.rb | app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout "mailer"
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/channels/application_cable/channel.rb | app/channels/application_cable/channel.rb | module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/app/channels/application_cable/connection.rb | app/channels/application_cable/connection.rb | module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/db/seeds.rb | db/seeds.rb | # 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 bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
# Character.create(name: "Luke", movie: movies.first)
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/test/application_system_test_case.rb | test/application_system_test_case.rb | require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/test/test_helper.rb | test/test_helper.rb | ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
class ActiveSupport::TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/test/controllers/hello_codespaces_controller_test.rb | test/controllers/hello_codespaces_controller_test.rb | require "test_helper"
class HelloCodespacesControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get "/"
assert_response :success
end
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/test/channels/application_cable/connection_test.rb | test/channels/application_cable/connection_test.rb | require "test_helper"
class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
# test "connects with cookies" do
# cookies.signed[:user_id] = 42
#
# connect
#
# assert_equal connection.user_id, "42"
# end
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/application.rb | config/application.rb | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module CodespacesTryRails
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.1
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
end
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/environment.rb | config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/puma.rb | config/puma.rb | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/routes.rb | config/routes.rb | Rails.application.routes.draw do
root "hello#index"
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/importmap.rb | config/importmap.rb | # Pin npm packages by running ./bin/importmap
pin "application", preload: true
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
pin_all_from "app/javascript/controllers", under: "controllers"
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/boot.rb | config/boot.rb | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
# # Generate session nonces for permitted importmap and inline scripts
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
# end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/initializers/inflections.rb | config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular /^(ox)en/i, "\\1"
# inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym "RESTful"
# end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/initializers/permissions_policy.rb | config/initializers/permissions_policy.rb | # Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/initializers/assets.rb | config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/environments/test.rb | config/environments/test.rb | require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true
# Eager loading loads your whole application. When running a single test locally,
# this probably isn't necessary. It's a good idea to do in a continuous integration
# system, or in some way before deploying your code.
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Store uploaded files on the local file system in a temporary directory.
config.active_storage.service = :test
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/environments/development.rb | config/environments/development.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable server timing
config.server_timing = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Suppress logger output for asset requests.
config.assets.quiet = true
pf_domain = ENV['GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN']
config.action_dispatch.default_headers = {
'X-Frame-Options' => "ALLOW-FROM #{pf_domain}"
}
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
# Allow requests from our preview domain.
pf_host = "#{ENV['CODESPACE_NAME']}-3000.#{pf_domain}"
config.hosts << pf_host
config.hosts << "localhost:3000"
config.action_cable.allowed_request_origins = ["https://#{pf_host}", "http://localhost:3000"]
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
github/codespaces-rails | https://github.com/github/codespaces-rails/blob/c169e2a6f6db8039a9dfd261f9c69082a58258c2/config/environments/production.rb | config/environments/production.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = "wss://example.com/cable"
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "codespaces_try_rails_production"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Don't log any deprecations.
config.active_support.report_deprecations = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
| ruby | MIT | c169e2a6f6db8039a9dfd261f9c69082a58258c2 | 2026-01-04T17:50:33.169053Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/spec_helper.rb | spec/spec_helper.rb | =begin
#CRM Owners
#HubSpot uses **owners** to assign CRM objects to specific people in your organization. The endpoints described here are used to get a list of the owners that are available for an account. To assign an owner to an object, set the hubspot_owner_id property using the appropriate CRM object update or create a request. If teams are available for your HubSpot tier, these endpoints will also indicate which team an owner belongs to. Team membership can be one of PRIMARY (default), SECONDARY, or CHILD.
OpenAPI spec version: v3
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.8
=end
# load the gem
require 'hubspot-api-client'
# The following was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!
# This setting enables warnings. It's recommended, but in some cases may
# be too noisy due to issues in dependencies.
config.warnings = true
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/client_spec.rb | spec/discovery/client_spec.rb | require 'spec_helper'
describe 'Hubspot::Client' do
subject(:client) { Hubspot::Client.new(access_token: 'test') }
it { is_expected.to respond_to(:automation) }
it { is_expected.to respond_to(:cms) }
it { is_expected.to respond_to(:communication_preferences) }
it { is_expected.to respond_to(:conversations) }
it { is_expected.to respond_to(:crm) }
it { is_expected.to respond_to(:events) }
it { is_expected.to respond_to(:files) }
it { is_expected.to respond_to(:marketing) }
it { is_expected.to respond_to(:oauth) }
it { is_expected.to respond_to(:settings) }
it { is_expected.to respond_to(:webhooks) }
it { is_expected.to respond_to(:api_request) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/base_api_client_spec.rb | spec/discovery/base_api_client_spec.rb | require 'spec_helper'
require 'hubspot/discovery/base_api_client'
require 'hubspot/configuration'
describe 'Hubspot::Discovery::BaseApiClient' do
class Hubspot::Discovery::SomeApiClass
include Hubspot::Discovery::BaseApiClient
def require_codegen(path)
path
end
end
class Hubspot::SomeApiClass
def initialize(api_client)
end
def get(test_id, opts = {})
"got test_id: #{test_id}, opts: #{opts}"
end
def get_with_http_info
end
def update(test_id, simple_public_object_input, opts = {})
"updated test_id: #{test_id}, name: #{simple_public_object_input.name}, email: #{simple_public_object_input.email}, opts: #{opts}"
end
def update_with_http_info
end
def raise_error
raise Hubspot::ApiError
end
def raise_error_with_http_info
end
def raise_error_on_third_call
@calls_count ||= 0
@calls_count += 1
raise Hubspot::ApiError if @calls_count < 3
'ok'
end
def raise_error_on_third_call_with_http_info
end
end
class Hubspot::ApiClient
def initialize(config)
end
end
class Hubspot::ApiError < ::StandardError
def message
'test error'
end
def code
429
end
end
class Hubspot::SimplePublicObjectInput
attr_reader :name, :email
def initialize(params)
@name = params[:name]
@email = params[:email]
end
def self.build_from_hash(params)
new(params)
end
end
subject(:client) { Hubspot::Discovery::SomeApiClass.new(access_token: 'test') }
let(:api) { client.api }
let(:body) { {name: 'test_name', email: 'test_email'} }
it { is_expected.to respond_to(:get) }
it { is_expected.to respond_to(:update) }
it { is_expected.to respond_to(:get_with_http_info) }
it { is_expected.to respond_to(:update_with_http_info) }
describe '#get' do
subject(:get) { client.get(params) }
context 'with default params order' do
let(:params) { {test_id: 'test_id_value', limit: 10} }
it { is_expected.to eq('got test_id: test_id_value, opts: {:debug_auth_names=>"oauth2", :limit=>10}') }
end
context 'with changed params order' do
let(:params) { {limit: 5, test_id: 'test_id_value'} }
it { is_expected.to eq('got test_id: test_id_value, opts: {:debug_auth_names=>"oauth2", :limit=>5}') }
end
context 'with error handle block' do
subject(:get) { client.get(params) { |e| e.message } }
let(:params) { {test_id: 'test_id_value', limit: 10} }
it { is_expected.to eq('got test_id: test_id_value, opts: {:debug_auth_names=>"oauth2", :limit=>10}') }
end
end
describe '#update' do
subject(:update) { client.update(params) }
context 'with default params order' do
let(:params) { {test_id: 'test_id_value', simple_public_object_input: Hubspot::SimplePublicObjectInput.new(body), limit: 10} }
it { is_expected.to eq('updated test_id: test_id_value, name: test_name, email: test_email, opts: {:debug_auth_names=>"oauth2", :limit=>10}') }
end
context 'with reversed params order' do
let(:params) { {limit: 5, simple_public_object_input: Hubspot::SimplePublicObjectInput.new(body), test_id: 'test_id_value'} }
it { is_expected.to eq('updated test_id: test_id_value, name: test_name, email: test_email, opts: {:debug_auth_names=>"oauth2", :limit=>5}') }
end
context 'with shuffled params order' do
let(:params) { {simple_public_object_input: Hubspot::SimplePublicObjectInput.new(body), limit: 7, test_id: 'test_id_value'} }
it { is_expected.to eq('updated test_id: test_id_value, name: test_name, email: test_email, opts: {:debug_auth_names=>"oauth2", :limit=>7}') }
end
context 'with body' do
let(:params) { {test_id: 'test_id_value', body: body, limit: 10} }
it { is_expected.to eq('updated test_id: test_id_value, name: test_name, email: test_email, opts: {:debug_auth_names=>"oauth2", :limit=>10}') }
end
context 'with block' do
subject(:update) { client.update(params) { |e| e.message } }
let(:params) { {test_id: 'test_id_value', body: body, limit: 10} }
it { is_expected.to eq('updated test_id: test_id_value, name: test_name, email: test_email, opts: {:debug_auth_names=>"oauth2", :limit=>10}') }
end
end
describe '#raise_error' do
subject(:raise_error) { client.raise_error { |e| e.message } }
it { is_expected.to eq('test error') }
end
describe '#raise_error_on_third_call' do
subject(:raise_error_on_third_call) { client.raise_error_on_third_call(retry: retry_config) }
context 'with 2 retries' do
let(:retry_config) { {429 => { max_retries: 2 }} }
it { is_expected.to eq('ok') }
context 'with range config' do
let(:retry_config) { {429..442 => { max_retries: 2 }} }
it { is_expected.to eq('ok') }
end
end
context 'with 1 retry' do
let(:retry_config) { {429 => { max_retries: 1 }} }
it { is_expected.to have_attributes(code: 429, message: 'test error') }
end
end
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/base_module_client_spec.rb | spec/discovery/base_module_client_spec.rb | require 'spec_helper'
require 'hubspot/discovery/base_module_client'
describe 'Hubspot::Discovery::BaseModuleClient' do
class Hubspot::Discovery::TestModuleClass
def api_classes
%i[
settings
subscriptions
].freeze
end
def api_modules
%i[
automation
cms
].freeze
end
include Hubspot::Discovery::BaseModuleClient
end
subject(:client) { Hubspot::Discovery::TestModuleClass.new(access_token: 'test') }
it { is_expected.to respond_to(:automation) }
it { is_expected.to respond_to(:cms) }
it { is_expected.to respond_to(:settings_api) }
it { is_expected.to respond_to(:subscriptions_api) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/settings/businnes_units/business_unit_api_spec.rb | spec/discovery/settings/businnes_units/business_unit_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Settings::BusinessUnits::BusinessUnitApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').settings.business_units.business_unit_api }
it { is_expected.to respond_to(:get_by_user_id) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/settings/users/users_api_spec.rb | spec/discovery/settings/users/users_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Settings::Users::UsersApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').settings.users.users_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_page) }
it { is_expected.to respond_to(:replace) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/settings/users/teams_api_spec.rb | spec/discovery/settings/users/teams_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Settings::Users::TeamsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').settings.users.teams_api }
it { is_expected.to respond_to(:get_all) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/settings/users/roles_api_spec.rb | spec/discovery/settings/users/roles_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Settings::Users::RolesApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').settings.users.roles_api }
it { is_expected.to respond_to(:get_all) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/files/folders_api_spec.rb | spec/discovery/files/folders_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Files::FoldersApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').files.folders_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:archive_by_path) }
it { is_expected.to respond_to(:check_update_status) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:do_search) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_by_path) }
it { is_expected.to respond_to(:update_properties) }
it { is_expected.to respond_to(:update_properties_recursively) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/files/files_api_spec.rb | spec/discovery/files/files_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Files::FilesApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').files.files_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:check_import) }
it { is_expected.to respond_to(:delete) }
it { is_expected.to respond_to(:do_search) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_metadata) }
it { is_expected.to respond_to(:get_signed_url) }
it { is_expected.to respond_to(:import_from_url) }
it { is_expected.to respond_to(:replace) }
it { is_expected.to respond_to(:update_properties) }
it { is_expected.to respond_to(:upload) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/client_spec.rb | spec/discovery/crm/client_spec.rb | require 'spec_helper'
describe 'Hubspot::Client' do
subject(:client) { Hubspot::Client.new(access_token: 'test').crm }
it { is_expected.to respond_to(:associations) }
it { is_expected.to respond_to(:companies) }
it { is_expected.to respond_to(:contacts) }
it { is_expected.to respond_to(:deals) }
it { is_expected.to respond_to(:extensions) }
it { is_expected.to respond_to(:imports) }
it { is_expected.to respond_to(:line_items) }
it { is_expected.to respond_to(:objects) }
it { is_expected.to respond_to(:owners) }
it { is_expected.to respond_to(:pipelines) }
it { is_expected.to respond_to(:products) }
it { is_expected.to respond_to(:quotes) }
it { is_expected.to respond_to(:schemas) }
it { is_expected.to respond_to(:tickets) }
it { is_expected.to respond_to(:timeline) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/schemas/core_api_spec.rb | spec/discovery/crm/schemas/core_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Schemas::CoreApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.schemas.core_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:archive_association) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:create_association) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/tickets/basic_api_spec.rb | spec/discovery/crm/tickets/basic_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Tickets::BasicApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.tickets.basic_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_page) }
it { is_expected.to respond_to(:merge) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/tickets/search_api_spec.rb | spec/discovery/crm/tickets/search_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Tickets::SearchApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.tickets.search_api }
it { is_expected.to respond_to(:do_search) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/tickets/batch_api_spec.rb | spec/discovery/crm/tickets/batch_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Tickets::BatchApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.tickets.batch_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:read) }
it { is_expected.to respond_to(:update) }
it { is_expected.to respond_to(:upsert) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/exports/public_exports_api_spec.rb | spec/discovery/crm/exports/public_exports_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Exports::PublicExportsApi' do
subject(:PublicExportsApi) { Hubspot::Client.new(access_token: 'test').crm.exports.public_exports_api }
it { is_expected.to respond_to(:get_status) }
it { is_expected.to respond_to(:start) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/deals/basic_api_spec.rb | spec/discovery/crm/deals/basic_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Deals::BasicApi' do
subject(:basic_api) { Hubspot::Client.new(access_token: 'test').crm.deals.basic_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_page) }
it { is_expected.to respond_to(:merge) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/deals/search_api_spec.rb | spec/discovery/crm/deals/search_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Deals::SearchApi' do
subject(:search_api) { Hubspot::Client.new(access_token: 'test').crm.deals.search_api }
it { is_expected.to respond_to(:do_search) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/deals/batch_api_spec.rb | spec/discovery/crm/deals/batch_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Deals::BatchApi' do
subject(:batch_api) { Hubspot::Client.new(access_token: 'test').crm.deals.batch_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:read) }
it { is_expected.to respond_to(:update) }
it { is_expected.to respond_to(:upsert) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/lists/memberships_api_spec.rb | spec/discovery/crm/lists/memberships_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Lists::MembershipsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.lists.memberships_api }
it { is_expected.to respond_to(:add) }
it { is_expected.to respond_to(:add_all_from_list) }
it { is_expected.to respond_to(:add_and_remove) }
it { is_expected.to respond_to(:get_page) }
it { is_expected.to respond_to(:remove) }
it { is_expected.to respond_to(:remove_all) }
it { is_expected.to respond_to(:get_lists) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/lists/mapping_api_spec.rb | spec/discovery/crm/lists/mapping_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Lists::ListsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.lists.lists_api }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:do_search) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_by_name) }
it { is_expected.to respond_to(:remove) }
it { is_expected.to respond_to(:restore) }
it { is_expected.to respond_to(:update_list_filters) }
it { is_expected.to respond_to(:update_name) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/lists/folders_api_spec.rb | spec/discovery/crm/lists/folders_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Lists::FoldersApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.lists.folders_api }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:move) }
it { is_expected.to respond_to(:move_list) }
it { is_expected.to respond_to(:remove) }
it { is_expected.to respond_to(:rename) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/lists/lists_api_spec.rb | spec/discovery/crm/lists/lists_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Lists::MappingApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.lists.mapping_api }
it { is_expected.to respond_to(:translate_legacy_list_id_to_list_id) }
it { is_expected.to respond_to(:translate_legacy_list_id_to_list_id_batch) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/line_items/basic_api_spec.rb | spec/discovery/crm/line_items/basic_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::LineItems::BasicApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.line_items.basic_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_page) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/line_items/search_api_spec.rb | spec/discovery/crm/line_items/search_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::LineItems::SearchApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.line_items.search_api }
it { is_expected.to respond_to(:do_search) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/line_items/batch_api_spec.rb | spec/discovery/crm/line_items/batch_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::LineItems::BatchApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.line_items.batch_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:read) }
it { is_expected.to respond_to(:update) }
it { is_expected.to respond_to(:upsert) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/extensions/client_spec.rb | spec/discovery/crm/extensions/client_spec.rb | require 'spec_helper'
describe 'Hubspot::Client' do
subject(:client) { Hubspot::Client.new(access_token: 'test').crm.extensions }
it { is_expected.to respond_to(:calling) }
it { is_expected.to respond_to(:cards) }
it { is_expected.to respond_to(:videoconferencing) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/extensions/videoconferencing/settings_api_spec.rb | spec/discovery/crm/extensions/videoconferencing/settings_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Extensions::Videoconferencing::SettingsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.extensions.videoconferencing.settings_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:replace) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/extensions/cards/sample_response_api_spec.rb | spec/discovery/crm/extensions/cards/sample_response_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Extensions::Cards::SampleResponseApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.extensions.cards.sample_response_api }
it { is_expected.to respond_to(:get_cards_sample_response) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/extensions/cards/cards_api_spec.rb | spec/discovery/crm/extensions/cards/cards_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Extensions::Cards::CardsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.extensions.cards.cards_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/extensions/calling/recording_settings_api_spec.rb | spec/discovery/crm/extensions/calling/recording_settings_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Extensions::Calling::RecordingSettingsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.extensions.calling.recording_settings_api }
it { is_expected.to respond_to(:get_url_format) }
it { is_expected.to respond_to(:mark_as_ready) }
it { is_expected.to respond_to(:register_url_format) }
it { is_expected.to respond_to(:update_url_format) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/extensions/calling/channel_connection_settings_api_spec.rb | spec/discovery/crm/extensions/calling/channel_connection_settings_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Extensions::Calling::ChannelConnectionSettingsApi' do
subject(:ChannelConnectionSettingsApi) { Hubspot::Client.new(access_token: 'test').crm.extensions.calling.channel_connection_settings_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/extensions/calling/settings_api_spec.rb | spec/discovery/crm/extensions/calling/settings_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Extensions::Calling::SettingsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.extensions.calling.settings_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/owners/owners_api_spec.rb | spec/discovery/crm/owners/owners_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Owners::OwnersApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.owners.owners_api }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_page) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/pipelines/pipeline_audits_api_spec.rb | spec/discovery/crm/pipelines/pipeline_audits_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Pipelines::PipelineAuditsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.pipelines.pipeline_audits_api }
it { is_expected.to respond_to(:get_audit) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/pipelines/pipeline_stage_audits_api_spec.rb | spec/discovery/crm/pipelines/pipeline_stage_audits_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Pipelines::PipelineStageAuditsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.pipelines.pipeline_stage_audits_api }
it { is_expected.to respond_to(:get_audit) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/pipelines/pipeline_stages_api_spec.rb | spec/discovery/crm/pipelines/pipeline_stages_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Pipelines::PipelineStagesApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.pipelines.pipeline_stages_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:replace) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/pipelines/pipelines_api_spec.rb | spec/discovery/crm/pipelines/pipelines_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Pipelines::PipelinesApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.pipelines.pipelines_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:replace) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/quotes/basic_api_spec.rb | spec/discovery/crm/quotes/basic_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Quotes::BasicApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.quotes.basic_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_by_id) }
it { is_expected.to respond_to(:get_page) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/quotes/search_api_spec.rb | spec/discovery/crm/quotes/search_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Quotes::SearchApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.quotes.search_api }
it { is_expected.to respond_to(:do_search) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/quotes/batch_api_spec.rb | spec/discovery/crm/quotes/batch_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Quotes::BatchApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.quotes.batch_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:read) }
it { is_expected.to respond_to(:update) }
it { is_expected.to respond_to(:upsert) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/properties/batch_api_spec.rb | spec/discovery/crm/properties/batch_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Properties::BatchApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.properties.batch_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:read) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/properties/core_api_spec.rb | spec/discovery/crm/properties/core_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Properties::CoreApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.properties.core_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:get_by_name) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
HubSpot/hubspot-api-ruby | https://github.com/HubSpot/hubspot-api-ruby/blob/75a9afa65e9789fbe6ff711066d798ca0c10f432/spec/discovery/crm/properties/groups_api_spec.rb | spec/discovery/crm/properties/groups_api_spec.rb | require 'spec_helper'
describe 'Hubspot::Discovery::Crm::Properties::GroupsApi' do
subject(:api) { Hubspot::Client.new(access_token: 'test').crm.properties.groups_api }
it { is_expected.to respond_to(:archive) }
it { is_expected.to respond_to(:create) }
it { is_expected.to respond_to(:get_all) }
it { is_expected.to respond_to(:get_by_name) }
it { is_expected.to respond_to(:update) }
end
| ruby | Apache-2.0 | 75a9afa65e9789fbe6ff711066d798ca0c10f432 | 2026-01-04T17:55:03.682567Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.