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 |
|---|---|---|---|---|---|---|---|---|
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/helpers/date_helpers.rb | lib/icloud/helpers/date_helpers.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
require "date"
module ICloud
def self.date_from_icloud obj
_, year, month, mday, hour, minute, _ = obj
DateTime.new year, month, mday, hour, minute
end
def self.date_to_icloud dt
[
# The Y/M/D concatenated into an int.
# I have no idea what this is for.
dt.strftime("%Y%m%d").to_i,
# The usual date+time fields. Note that there's no seconds.
dt.year, dt.month, dt.mday, dt.hour, dt.min,
# Minutes since midnight.
(dt.hour * 60) + dt.min
]
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/helpers/proxy.rb | lib/icloud/helpers/proxy.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
module Proxy
#
# Public: Returns a URI containing the current proxy server, as set by the
# environment, or nil if no proxy is set.
#
def proxy
if proxies.any?
URI(proxies.first)
else
nil
end
end
#
# Public: Returns true if a proxy should be used.
#
def use_proxy?
!! proxy
end
#
# Internal: Returns the list of proxy servers found in the environment.
# environment. Proxies can be set using the following ENV vars (in order):
# `HTTPS_PROXY`, `https_proxy`, `HTTP_PROXY`, `http_proxy`.
#
def proxies
%w[HTTPS_PROXY https_proxy HTTP_PROXY http_proxy].map do |key|
env[key]
end.compact
end
#
# Internal: Returns `ENV`. Stub me!
#
def env
ENV
end
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/helpers/inflections.rb | lib/icloud/helpers/inflections.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
# Internal: Convert a snake_cased string to camelCase.
def self.camel_case str
str.gsub /_([a-z])/ do
$1.upcase
end
end
# Internal: Convert a camelCased string to snake_case.
def self.snake_case str
str.gsub /(.)([A-Z])/ do
"#{$1}_#{$2.downcase}"
end.downcase
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/helpers/guid.rb | lib/icloud/helpers/guid.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
require "uuidtools"
module ICloud
# Public: Returns a random GUID.
def self.guid
UUIDTools::UUID.random_create.to_s.upcase
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/core_ext/array.rb | lib/icloud/core_ext/array.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class Array
def to_icloud
map do |item|
item.to_icloud
end
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/core_ext/object.rb | lib/icloud/core_ext/object.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
class Object
def to_icloud
self
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/core_ext/date_time.rb | lib/icloud/core_ext/date_time.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
require 'date'
class DateTime
def to_icloud
ICloud.date_to_icloud(self)
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/records/collection.rb | lib/icloud/records/collection.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
module Records
class Collection
include Record
has_fields(
:ctag,
:title,
:created_date_extended,
:completed_count,
:participants,
:collection_share_type,
:created_date,
:guid,
:email_notifications,
:order
)
end
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/records/alarm.rb | lib/icloud/records/alarm.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
module Records
#
# Note: Alarms can only be added to existing reminders. Reminders cannot be
# created with alarms.
#
class Alarm
include Record
has_fields(
:description,
:guid,
:is_location_based,
:measurement,
:message_type,
:on_date,
:proximity,
:structured_location
)
#
# Internal: Cast `value` to a DateTime (for the `on_date` field).
#
def self.on_date_from_icloud(value)
unless value.nil?
ICloud.date_from_icloud(value)
end
end
# TODO: Move this up to Record?
def guid
@guid ||= ICloud.guid
end
#
# Note: Message type MUST be specified, or the service will return a very
# unhelpful internal server error.
#
def message_type
@message_type ||= "message"
end
def inspect
"#<Alarm %p date=%p>" % [
description,
on_date
]
end
end
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/records/dsinfo.rb | lib/icloud/records/dsinfo.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
module Records
#
# Public: An iCloud user's info. This is returned at login, and isn't (as far
# as I'm aware) editable.
#
class DsInfo
include Record
has_fields(
:primary_email_verified,
:last_name,
:icloud_apple_id_alias,
:apple_id_alias,
:apple_id,
:has_icloud_qualifying_device,
:dsid,
:primary_email,
:status_code,
:full_name,
:locked,
:first_name,
:apple_id_aliases
)
def to_s
full_name
end
end
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
adammck/ruby-icloud | https://github.com/adammck/ruby-icloud/blob/8a9418a4260dc4faf9dd0b23599cab341443e5ef/lib/icloud/records/reminder.rb | lib/icloud/records/reminder.rb | #!/usr/bin/env ruby
# vim: et ts=2 sw=2
module ICloud
module Records
class Reminder
include Record
has_fields(
:alarms,
:completed_date,
:created_date_extended,
:created_date,
:description,
:due_date,
:due_date_is_all_day,
:etag,
:guid,
:last_modified_date,
:order,
:p_guid,
:priority,
:recurrence,
:start_date,
:start_date_is_all_day,
:start_date_tz,
:title
)
def initialize
@alarms = []
end
#
# Public: Returns true if this reminder has been marked as complete.
#
def complete?
!! completed_date
end
# When alarms are added to this reminder, wrap them in Alarm objects.
# TODO: Replace this with a cast method.
def alarms=(alarms)
@alarms = alarms.map do |alarm|
if alarm.is_a?(Hash)
Alarm.from_icloud(alarm)
else
alarm
end
end
end
# If this reminder doesn't already have a guid (i.e. it hasn't been
# persisted) yet, generate one the first time it's read.
def guid
@guid ||= ICloud.guid
end
# If this reminder doesn't have a parent GUID, assign it to the default
# list the first time it's read.
def p_guid
@p_guid ||= "tasks"
end
end
end
end
| ruby | MIT | 8a9418a4260dc4faf9dd0b23599cab341443e5ef | 2026-01-04T17:52:21.382901Z | false |
cllns/material_design_lite-rails | https://github.com/cllns/material_design_lite-rails/blob/d9dc875b935bb7b360d7bcbfa02a5cd512e94917/lib/material_design_lite/rails.rb | lib/material_design_lite/rails.rb | require "material_design_lite/rails/version"
module MaterialDesignLite
module Rails
class Engine < ::Rails::Engine
end
end
end
| ruby | MIT | d9dc875b935bb7b360d7bcbfa02a5cd512e94917 | 2026-01-04T17:52:22.530212Z | false |
cllns/material_design_lite-rails | https://github.com/cllns/material_design_lite-rails/blob/d9dc875b935bb7b360d7bcbfa02a5cd512e94917/lib/material_design_lite/rails/version.rb | lib/material_design_lite/rails/version.rb | module MaterialDesignLite
module Rails
VERSION = "1.3.0"
end
end
| ruby | MIT | d9dc875b935bb7b360d7bcbfa02a5cd512e94917 | 2026-01-04T17:52:22.530212Z | false |
square/cocoapods-check | https://github.com/square/cocoapods-check/blob/ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75/spec/check_spec.rb | spec/check_spec.rb | require 'cocoapods'
require 'tempfile'
require_relative '../lib/pod/command/check'
describe Pod::Command::Check do
it 'detects no differences' do
check = Pod::Command::Check.new(CLAide::ARGV.new([]))
config = create_config({ :pod_one => '1.0', :pod_two => '2.0' }, { :pod_one => '1.0', :pod_two => '2.0' })
development_pods = {}
results = check.find_differences(config, development_pods)
expect(results).to eq([])
end
it 'detects modifications and additions' do
check = Pod::Command::Check.new(CLAide::ARGV.new([]))
config = create_config(
{
:pod_one => '1.0',
:pod_two => '3.0',
:pod_three => '2.0'
},
{
:pod_one => '1.0',
:pod_two => '2.0',
:pod_three => nil
}
)
development_pods = {}
results = check.find_differences(config, development_pods)
# Alphabetical order
expect(results).to eq([ '+pod_three', '~pod_two' ])
end
it 'detects modifications and additions with verbosity' do
check = Pod::Command::Check.new(CLAide::ARGV.new([ '--verbose' ]))
config = create_config(
{
:pod_one => '1.0',
:pod_two => '3.0',
:pod_three => '2.0'
},
{
:pod_one => '1.0',
:pod_two => '2.0',
:pod_three => nil
}
)
development_pods = {}
results = check.find_differences(config, development_pods)
# Alphabetical order
expect(results).to eq([ 'pod_three newly added', 'pod_two 2.0 -> 3.0' ])
end
it 'handles development pods with changes' do
check = Pod::Command::Check.new(CLAide::ARGV.new([]))
config = create_config({ :pod_one => '1.0', :pod_two => '1.0' }, { :pod_one => '1.0', :pod_two => '1.0' })
# Make an actual lockfile file because 'check' needs the modified time
lockfile_path = Tempfile.new('dev-pod-test-lockfile').path
allow(config.lockfile).to receive(:defined_in_file).and_return(lockfile_path)
# Ensure development pod modified time is after lockfile modified time
sleep(1)
# Create a temp dir with a temp file and run the check in that context
Dir.mktmpdir('dev-pod-test-dir') do |dir|
# Create a source file
source_file = Tempfile.new('some-pod-file', dir)
# Write a podspec file pointing at the source file
File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = '#{File.basename(source_file)}' end")
# Do the check
development_pods = { :pod_two => { :path => "#{dir}/foo.podspec" } }
results = check.find_differences(config, development_pods)
expect(results).to eq([ '~pod_two' ])
end
end
it 'handles development pods no changes reported' do
check = Pod::Command::Check.new(CLAide::ARGV.new([]))
config = create_config({ :pod_one => '1.0', :pod_two => '1.0' }, { :pod_one => '1.0', :pod_two => '1.0' })
# Create a temp dir with a temp file and run the check in that context
Dir.mktmpdir('dev-pod-test-dir') do |dir|
# Create a source file
Tempfile.new('some-pod-file', dir)
# Write a podspec file pointing at the source file
File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = 'ack' end")
# Ensure lockfile modified time is after development pod modified time
sleep(1)
# Make an actual lockfile file because 'check' needs the modified time
lockfile_path = Tempfile.new('dev-pod-test-lockfile').path
allow(config.lockfile).to receive(:defined_in_file).and_return(lockfile_path)
# Do the check
development_pods = { :pod_two => { :path => "#{dir}/foo.podspec" } }
results = check.find_differences(config, development_pods)
expect(results).to eq([])
end
end
it 'handles ignoring development pods with changes' do
check = Pod::Command::Check.new(CLAide::ARGV.new([ '--ignore-dev-pods' ]))
config = create_config({ :pod_one => '1.0', :pod_two => '1.0' }, { :pod_one => '1.0', :pod_two => '1.0' })
# Make an actual lockfile file because 'check' needs the modified time
lockfile_path = Tempfile.new('dev-pod-test-lockfile').path
allow(config.lockfile).to receive(:defined_in_file).and_return(lockfile_path)
# Ensure development pod modified time is after lockfile modified time
sleep(1)
# Create a temp dir with a temp file and run the check in that context
Dir.mktmpdir('dev-pod-test-dir') do |dir|
# Create a source file
source_file = Tempfile.new('some-pod-file', dir)
# Write a podspec file pointing at the source file
File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = '#{File.basename(source_file)}' end")
# Do the check
development_pods = { :pod_two => { :path => "#{dir}/foo.podspec" } }
results = check.find_differences(config, development_pods)
expect(results).to eq([])
end
end
def create_config(lockfile_hash, manifest_hash)
config = Pod::Config.new
lockfile = double('lockfile')
sandbox = double('sandbox')
manifest = double('manifest')
allow(config).to receive(:lockfile).and_return(lockfile)
allow(config).to receive(:sandbox).and_return(sandbox)
allow(sandbox).to receive(:manifest).and_return(manifest)
allow(lockfile).to receive(:pod_names).and_return(lockfile_hash.keys)
lockfile_hash.each do |key, value|
allow(lockfile).to receive(:version).with(key).and_return(value)
end
manifest_hash.each do |key, value|
allow(manifest).to receive(:version).with(key).and_return(value)
end
config
end
end
| ruby | Apache-2.0 | ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75 | 2026-01-04T17:52:25.800169Z | false |
square/cocoapods-check | https://github.com/square/cocoapods-check/blob/ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75/lib/cocoapods_check.rb | lib/cocoapods_check.rb | module CocoapodsCheck
VERSION = '1.1.0'
end
| ruby | Apache-2.0 | ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75 | 2026-01-04T17:52:25.800169Z | false |
square/cocoapods-check | https://github.com/square/cocoapods-check/blob/ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75/lib/cocoapods_plugin.rb | lib/cocoapods_plugin.rb | require 'pod/command/check'
| ruby | Apache-2.0 | ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75 | 2026-01-04T17:52:25.800169Z | false |
square/cocoapods-check | https://github.com/square/cocoapods-check/blob/ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75/lib/pod/command/check.rb | lib/pod/command/check.rb | # The CocoaPods check command.
# The CocoaPods namespace
module Pod
class Command
class Check < Command
self.summary = <<-SUMMARY
Displays which Pods would be changed by running `pod install`
SUMMARY
self.description = <<-DESC
Compares the Pod lockfile with the manifest lockfile and shows
any differences. In non-verbose mode, '~' indicates an existing Pod
will be updated to the version specified in Podfile.lock and '+'
indicates a missing Pod will be installed.
DESC
self.arguments = []
def self.options
[
['--verbose', 'Show change details.'],
['--ignore-dev-pods', 'Ignores updates to development pods.']
].concat(super)
end
def initialize(argv)
@check_command_verbose = argv.flag?('verbose')
@check_command_ignore_dev_pods = argv.flag?('ignore-dev-pods')
super
end
def run
unless config.lockfile
raise Informative, 'Missing Podfile.lock!'
end
development_pods = find_development_pods(config.podfile)
results = find_differences(config, development_pods)
has_same_manifests = check_manifests(config)
print_results(results, has_same_manifests)
end
def check_manifests(config)
# Bail if the first time
return true unless config.sandbox.manifest
root_lockfile = config.lockfile.defined_in_file
pods_manifest = config.sandbox.manifest_path
File.read(root_lockfile) == File.read(pods_manifest)
end
def find_development_pods(podfile)
development_pods = {}
podfile.dependencies.each do |dependency|
if dependency.local?
development_pods[dependency.name] = dependency.external_source.clone
development_pods[dependency.name][:path] = File.absolute_path(development_pods[dependency.name][:path])
end
end
development_pods
end
def find_differences(config, development_pods)
all_pod_names = config.lockfile.pod_names
all_pod_names.concat development_pods.keys
all_pod_names.sort.uniq.map do |spec_name|
locked_version = config.lockfile.version(spec_name)
# If no manifest, assume Pod hasn't been installed
if config.sandbox.manifest
manifest_version = config.sandbox.manifest.version(spec_name)
else
manifest_version = nil
end
# If this Pod is installed
if manifest_version
# If this is a development pod do a modified time check
if development_pods[spec_name] != nil
next if @check_command_ignore_dev_pods
newer_files = get_files_newer_than_lockfile_for_podspec(config, development_pods[spec_name])
if newer_files.any?
changed_development_result(spec_name, newer_files)
end
# Otherwise just compare versions
elsif locked_version != manifest_version
changed_result(spec_name, manifest_version, locked_version)
end
# If this Pod is not installed
else
added_result(spec_name)
end
end.compact
end
def get_files_newer_than_lockfile_for_podspec(config, development_pod)
files_for_podspec = get_files_for_podspec(development_pod[:path])
lockfile_mtime = File.mtime(config.lockfile.defined_in_file)
podspec_file = get_podspec_for_file_or_path(development_pod[:path])
podspec_dir = Pathname.new(File.dirname(podspec_file))
files_for_podspec
.select {|f| File.mtime(f) >= lockfile_mtime}
.map {|f| Pathname.new(f).relative_path_from(podspec_dir).to_s}
end
# Returns an array of all files pointed to by the podspec
def get_files_for_podspec(podspec_file)
podspec_file = get_podspec_for_file_or_path(podspec_file)
development_pod_dir = File.dirname(podspec_file)
spec = Specification.from_file(podspec_file)
# Gather all the dependencies used by the spec, across all platforms, and including subspecs.
all_files = [spec, spec.subspecs].flatten.map { |a_spec|
a_spec.available_platforms.map { |platform|
accessor = Sandbox::FileAccessor.new(Sandbox::PathList.new(Pathname.new(development_pod_dir)), a_spec.consumer(platform))
[
accessor.vendored_frameworks,
accessor.vendored_libraries,
accessor.resource_bundle_files,
accessor.license,
accessor.prefix_header,
accessor.preserve_paths,
accessor.readme,
accessor.resources,
accessor.source_files
].compact
}
}.flatten
# Include the podspec files as well
all_files.push(podspec_file)
end
def get_podspec_for_file_or_path(podspec_file_or_path)
if File.basename(podspec_file_or_path).include?('.podspec')
podspec_file_or_path
else
glob_pattern = podspec_file_or_path + '/*.podspec{,.json}'
Pathname.glob(glob_pattern).first
end
end
def changed_result(spec_name, manifest_version, locked_version)
if @check_command_verbose
"#{spec_name} #{manifest_version} -> #{locked_version}"
else
"~#{spec_name}"
end
end
def changed_development_result(spec_name, newer_files)
if @check_command_verbose
number_files_not_shown = newer_files.length - 2
newer_files = newer_files[0..1]
if number_files_not_shown > 0
newer_files.push("and #{number_files_not_shown} other#{'s' if number_files_not_shown > 1}")
end
"#{spec_name} (#{newer_files.join(', ')})"
else
"~#{spec_name}"
end
end
def added_result(spec_name)
if @check_command_verbose
"#{spec_name} newly added"
else
"+#{spec_name}"
end
end
def print_results(results, same_manifests)
return UI.puts "The Podfile's dependencies are satisfied" if results.empty? && same_manifests
unless same_manifests
raise Informative, 'The Podfile.lock does not match the Pods/Manifest.lock.'
end
if @check_command_verbose
UI.puts results.join("\n")
else
UI.puts results.join(', ')
end
raise Informative, "`pod install` will install #{results.length} Pod#{'s' if results.length > 1}."
end
end
end
end
| ruby | Apache-2.0 | ba5f196deaa5f921c2d4a64aa7fea680f0bf4a75 | 2026-01-04T17:52:25.800169Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/jobs/chaskiq/mail_sender_job.rb | app/jobs/chaskiq/mail_sender_job.rb | module Chaskiq
class MailSenderJob < ActiveJob::Base
queue_as :default
#send to all list with state passive & subscribed
def perform(campaign)
campaign.apply_premailer
campaign.list.subscriptions.availables.each do |s|
campaign.push_notification(s)
end
end
end
end | ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/jobs/chaskiq/sns_receiver_job.rb | app/jobs/chaskiq/sns_receiver_job.rb | module Chaskiq
class SnsReceiverJob < ActiveJob::Base
queue_as :default
#Receive hook
def perform(track_type, m, referrer)
data = m["mail"]["messageId"]
metric = Chaskiq::Metric.find_by(data:parsed_message_id(m))
return if metric.blank?
campaign = metric.campaign
#subscriber = metric.trackable
#subscription = campaign.subscriptions.find_by(subscriber: subscriber)
subscription = metric.trackable
subscription.unsubscribe! if track_type == "spam"
subscription.subscriber.send("track_#{track_type}".to_sym, {
host: referrer,
campaign_id: campaign.id,
data: data
})
end
def parsed_message_id(m)
m["mail"]["messageId"]
end
end
end | ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/jobs/chaskiq/list_importer_job.rb | app/jobs/chaskiq/list_importer_job.rb | module Chaskiq
class ListImporterJob < ActiveJob::Base
queue_as :default
#send to all list with state passive & subscribed
def perform(list, file)
list.import_csv(file)
end
end
end | ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/jobs/chaskiq/ses_sender_job.rb | app/jobs/chaskiq/ses_sender_job.rb | module Chaskiq
class SesSenderJob < ActiveJob::Base
queue_as :mailers
#send to ses
def perform(campaign, subscription)
subscriber = subscription.subscriber
return if subscriber.blank?
mailer = campaign.prepare_mail_to(subscription)
response = mailer.deliver
message_id = response.message_id.gsub("@email.amazonses.com", "")
campaign.metrics.create(
trackable: subscription,
action: "deliver",
data: message_id)
end
end
end | ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/uploaders/chaskiq/image_uploader.rb | app/uploaders/chaskiq/image_uploader.rb | # encoding: utf-8
# encoding: utf-8
module Chaskiq
class ImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :fog
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process :resize_to_fit => [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
# def extension_white_list
# %w(jpg jpeg gif png)
# end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/uploaders/chaskiq/campaign_logo_uploader.rb | app/uploaders/chaskiq/campaign_logo_uploader.rb | # encoding: utf-8
module Chaskiq
class CampaignLogoUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
#storage :file
storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process :resize_to_fit => [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
# def extension_white_list
# %w(jpg jpeg gif png)
# end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end
end | ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/dashboard_helper.rb | app/helpers/chaskiq/dashboard_helper.rb | module Chaskiq
module DashboardHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/hooks_helper.rb | app/helpers/chaskiq/hooks_helper.rb | module Chaskiq
module HooksHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/subscribers_helper.rb | app/helpers/chaskiq/subscribers_helper.rb | module Chaskiq
module SubscribersHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/tracks_helper.rb | app/helpers/chaskiq/tracks_helper.rb | module Chaskiq
module TracksHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/campaigns_helper.rb | app/helpers/chaskiq/campaigns_helper.rb | module Chaskiq
module CampaignsHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/application_helper.rb | app/helpers/chaskiq/application_helper.rb | module Chaskiq
module ApplicationHelper
def paginate objects, options = {}
options.reverse_merge!( theme: 'twitter-bootstrap-3' )
super( objects, options )
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/manage/campain_wizard_helper.rb | app/helpers/chaskiq/manage/campain_wizard_helper.rb | module Chaskiq
module Manage::CampainWizardHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/manage/lists_helper.rb | app/helpers/chaskiq/manage/lists_helper.rb | module Chaskiq
module Manage::ListsHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/manage/metrics_helper.rb | app/helpers/chaskiq/manage/metrics_helper.rb | module Chaskiq
module Manage::MetricsHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/manage/attachments_helper.rb | app/helpers/chaskiq/manage/attachments_helper.rb | module Chaskiq
module Manage::AttachmentsHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/manage/campaigns_helper.rb | app/helpers/chaskiq/manage/campaigns_helper.rb | module Chaskiq
module Manage::CampaignsHelper
def metric_action_class(metric)
case metric.action
when "deliver"
"plain"
when "open"
"info"
when "click"
"primary"
when "bounce"
"warning"
when "spam"
"danger"
end
end
def metric_icon_action_class(metric)
case metric.action
when "deliver"
"check"
when "open"
"check"
when "click"
"check"
when "bounce"
"exclamation"
when "spam"
"exclamation-triangle"
end
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/helpers/chaskiq/manage/templates_helper.rb | app/helpers/chaskiq/manage/templates_helper.rb | module Chaskiq
module Manage::TemplatesHelper
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/campaigns_controller.rb | app/controllers/chaskiq/campaigns_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class CampaignsController < ApplicationController
layout "chaskiq/empty"
before_filter :find_campaign
def show
end
def find_campaign
@campaign = Chaskiq::Campaign.find(params[:id])
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/hooks_controller.rb | app/controllers/chaskiq/hooks_controller.rb | require_dependency "chaskiq/application_controller"
require "open-uri"
module Chaskiq
class HooksController < ApplicationController
layout false
def create
# get amazon message type and topic
amz_message_type = request.headers['x-amz-sns-message-type']
amz_sns_topic = request.headers['x-amz-sns-topic-arn']
#return unless !amz_sns_topic.nil? &&
#amz_sns_topic.to_s.downcase == 'arn:aws:sns:us-west-2:867544872691:User_Data_Updates'
request_body = JSON.parse request.body.read
# if this is the first time confirmation of subscription, then confirm it
if amz_message_type.to_s.downcase == 'subscriptionconfirmation'
send_subscription_confirmation request_body
render text: "ok" and return
end
process_notification(request_body)
render text: "ok" and return
end
private
def process_notification(request_body)
message = parse_body_message(request_body["Message"])
case message["notificationType"]
when "Bounce"
process_bounce(message)
when "Complaint"
process_complaint(message)
end
end
def parse_body_message(body)
JSON.parse(body)
end
def process_bounce(m)
emails = m["bounce"]["bouncedRecipients"].map{|o| o["emailAddress"] }
source = m["mail"]["source"]
track_message_for("bounce", m)
end
def process_complaint(m)
emails = m["complaint"]["complainedRecipients"].map{|o| o["emailAddress"] }
source = m["mail"]["source"]
track_message_for("spam", m)
end
def track_message_for(track_type, m)
Chaskiq::SnsReceiverJob.perform_later(track_type, m, get_referrer)
end
def send_subscription_confirmation(request_body)
subscribe_url = request_body['SubscribeURL']
return nil unless !subscribe_url.to_s.empty? && !subscribe_url.nil?
subscribe_confirm = open subscribe_url
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/dashboard_controller.rb | app/controllers/chaskiq/dashboard_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class DashboardController < Chaskiq::ApplicationController
before_filter :authentication_method
def show
@campaigns_count = Chaskiq::Campaign.count
@sends_count = Chaskiq::Metric.deliveries.size
@daily_metrics = Chaskiq::Metric.group_by_day(:created_at, range: 2.weeks.ago.midnight..Time.now).count
@pie_metrics = Chaskiq::Metric.group(:action)
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/subscribers_controller.rb | app/controllers/chaskiq/subscribers_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class SubscribersController < ApplicationController
before_filter :find_base_models
layout "chaskiq/empty"
def show
#TODO, we should obfustate code
find_subscriber
render "edit"
end
def new
@subscriber = @campaign.subscribers.new
end
def edit
find_subscriber
end
def update
find_subscriber
if @subscriber.update_attributes(resource_params) && @subscriber.errors.blank?
flash[:notice] = "you did it!"
@subscription.subscribe! unless @subscription.subscribed?
redirect_to campaign_path(@campaign)
else
render "edit"
end
end
def create
@subscriber = @campaign.list.create_subscriber(resource_params)
if @subscriber.errors.blank?
@subscription = @campaign.subscriptions.find_by(subscriber: @subscriber)
@subscription.subscribe! unless @subscription.subscribed?
flash[:notice] = "you did it!"
redirect_to campaign_path(@campaign)
else
render "new"
end
end
def delete
find_subscriber
end
def destroy
find_subscriber
begin
if @subscription.unsubscribe!
flash[:notice] = "Thanks, you will not receive more emails from this newsletter!"
redirect_to campaign_path(@campaign)
end
rescue
flash[:notice] = "Thanks, you will not receive more emails from this newsletter!"
redirect_to campaign_path(@campaign)
end
end
protected
def find_subscriber
@subscriber = @campaign.list.subscribers.find_by(email: URLcrypt.decode(params[:id]))
@subscription = @campaign.subscriptions.find_by(subscriber: @subscriber)
end
def find_base_models
@campaign = Chaskiq::Campaign.find(params[:campaign_id])
@list = @campaign.list
end
def resource_params
return [] if request.get?
params.require(:subscriber).permit(:email, :name, :last_name)
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/lists_controller.rb | app/controllers/chaskiq/lists_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class ListsController < ApplicationController
protected
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/application_controller.rb | app/controllers/chaskiq/application_controller.rb | require "wicked"
module Chaskiq
class ApplicationController < ActionController::Base
def get_referrer
ip = request.ip
ip = env['HTTP_X_FORWARDED_FOR'].split(",").first if Rails.env.production?
end
def authentication_method
if meth = Chaskiq::Config.authentication_method
self.send meth
end
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/tracks_controller.rb | app/controllers/chaskiq/tracks_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class TracksController < ApplicationController
before_filter :find_campaign
#http://localhost:3000/chaskiq/campaigns/1/tracks/1/[click|open|bounce|spam].gif
%w[open bounce spam].each do |action|
define_method(action) do
find_subscriber
@subscriber.send("track_#{action}".to_sym, { host: get_referrer, campaign_id: @campaign.id })
#return image
img_path = Chaskiq::Engine.root.join("app/assets/images/chaskiq", "track.gif")
send_data File.read(img_path, :mode => "rb"), :filename => '1x1.gif', :type => 'image/gif'
#send_data File.read(view_context.image_url("chaskiq/track.gif"), :mode => "rb"), :filename => '1x1.gif', :type => 'image/gif'
end
end
def click
find_subscriber
#TODO: if subscriber has not an open , we will track open too!
#that's probably due to plain email or image not beign displayed
@subscriber.track_click({ host: get_referrer, campaign_id: @campaign.id, data: params[:r] })
redirect_to params[:r]
end
private
def find_campaign
@campaign = Chaskiq::Campaign.find(params[:campaign_id])
end
def find_subscriber
@subscriber = @campaign.subscribers.find_by(email: URLcrypt.decode(params[:id]))
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/manage/templates_controller.rb | app/controllers/chaskiq/manage/templates_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class Manage::TemplatesController < ApplicationController
before_filter :authentication_method
def index
@templates = Chaskiq::Template.all
end
def show
@template = Chaskiq::Template.find(params[:id])
end
def new
@template = Chaskiq::Template.new
end
def edit
@template = Chaskiq::Template.find(params[:id])
end
def update
@template = Chaskiq::Template.find(params[:id])
if @template.update_attributes(resource_params)
redirect_to manage_templates_path
else
render "edit"
end
end
def create
@template = Chaskiq::Template.create(resource_params)
if @template.errors.blank?
redirect_to manage_templates_path
else
render "new"
end
end
def resource_params
return [] if request.get?
params.require(:template).permit!
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/manage/campaigns_controller.rb | app/controllers/chaskiq/manage/campaigns_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class Manage::CampaignsController < ApplicationController
before_filter :authentication_method, except: [:preview, :premailer_preview]
before_filter :find_campaign, except: [:index, :create, :new]
helper Chaskiq::Manage::CampaignsHelper
def index
@q = Chaskiq::Campaign.ransack(params[:q])
@campaigns = @q.result
.order("updated_at desc")
.page(params[:page])
.per(8)
end
def new
@campaign = Chaskiq::Campaign.new
end
def create
@campaign = Chaskiq::Campaign.new
@campaign.step = 1
@campaign.assign_attributes(resource_params)
if @campaign.save && @campaign.errors.blank?
redirect_to manage_campaign_wizard_path(@campaign, "setup")
else
render "new"
end
end
def show
find_campaign
@metrics = @campaign.metrics.order("chaskiq_metrics.created_at desc")
@q = @metrics.ransack(params[:q])
@metrics = @q.result
.includes(:trackable)
.order("chaskiq_metrics.created_at desc")
.page(params[:page])
.per(8)
end
def preview
find_campaign
@campaign.apply_premailer(exclude_gif: true)
render layout: false
end
def premailer_preview
find_campaign
render layout: false
end
def iframe
find_campaign
render layout: false
end
def editor
find_campaign
render "editor_frame", layout: false
end
def test
find_campaign
@campaign.test_newsletter
flash[:notice] = "test sended"
redirect_to manage_campaigns_path()
end
def deliver
find_campaign
@campaign.send_newsletter
flash[:notice] = "newsletter sended"
redirect_to manage_campaigns_path()
end
def clone
find_campaign
new_campaign = @campaign.clone_newsletter
if new_campaign.save
flash[:notice] = "cloned"
redirect_to manage_campaign_path(new_campaign)
else
flash[:error] = "whoops!"
redirect_to manage_campaign_path(@campaign)
end
end
def purge
find_campaign
@campaign.purge_metrics
flash[:notice] = "cleaned data!"
redirect_to manage_campaign_path(@campaign)
end
def destroy
find_campaign
if @campaign.destroy
flash[:notice] = "the campaign was removed"
end
redirect_to manage_campaigns_path
end
protected
def find_campaign
@campaign = Chaskiq::Campaign.find(params[:id])
end
def resource_params
return [] if request.get?
params.require(:campaign).permit(:list_id)
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/manage/metrics_controller.rb | app/controllers/chaskiq/manage/metrics_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class Manage::MetricsController < ApplicationController
before_filter :authentication_method
before_filter :find_campaign
def index
@q = @campaign.metrics.ransack(params[:q])
@metrics = @q.result
.includes(:trackable)
.order("chaskiq_metrics.created_at desc")
.page(params[:page])
.per(8)
respond_to do |format|
format.html{ render "chaskiq/manage/campaigns/show" }
format.xml { render :xml => @people.to_xml }
end
end
protected
def find_campaign
@campaign = Chaskiq::Campaign.find(params[:campaign_id])
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/manage/campaign_wizard_controller.rb | app/controllers/chaskiq/manage/campaign_wizard_controller.rb | require_dependency "chaskiq/application_controller"
require "wicked"
module Chaskiq
class Manage::CampaignWizardController < ApplicationController
before_filter :authentication_method
before_filter :find_campaign , except: [:create]
include Wicked::Wizard
steps :list, :setup, :template, :design, :confirm
def show
render_wizard
end
def design
render_wizard
render :show , layout: false
end
def update
@campaign.update_attributes(resource_params)
render_wizard @campaign
end
def create
@campaign = Chaskiq::Campaign.create(resource_params)
redirect_to manage_wizard_path(steps.first, :campaign_id => @campaign.id)
end
protected
def find_campaign
@campaign = Chaskiq::Campaign.find(params[:campaign_id])
end
def resource_params
return [] if request.get?
params.require(:campaign).permit!
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/manage/attachments_controller.rb | app/controllers/chaskiq/manage/attachments_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class Manage::AttachmentsController < ApplicationController
before_filter :authentication_method
before_filter :find_campaign
def index
@attachments = @campaign.attachments.page(params[:page]).per(50)
respond_to do |format|
format.html
format.json { render json: @attachments }
end
end
def show
@attachment = @campaign.attachments.find(params[:id])
end
def new
@attachment = @campaign.attachments.new
end
def create
@attachment = @campaign.attachments.create(resource_params)
respond_to do |format|
format.html
format.json { render json: @attachment }
end
end
protected
def find_campaign
@campaign = Chaskiq::Campaign.find(params[:campaign_id])
end
def resource_params
return [] if request.get?
params[:attachment] = {} unless params[:attachment].present?
params[:attachment][:image] = params[:image] if params[:image].present?
params.require(:attachment).permit! #(:name)
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/controllers/chaskiq/manage/lists_controller.rb | app/controllers/chaskiq/manage/lists_controller.rb | require_dependency "chaskiq/application_controller"
module Chaskiq
class Manage::ListsController < ApplicationController
before_filter :authentication_method
def index
@q = Chaskiq::List.ransack(params[:q])
@lists = @q.result
.page(params[:page])
.per(8)
end
def show
@list = Chaskiq::List.find(params[:id])
@subscribers = @list.subscribers.page(params[:page]).per(50)
end
def new
@list = Chaskiq::List.new
end
def edit
@list = Chaskiq::List.find(params[:id])
end
def upload
@list = Chaskiq::List.find(params[:id])
if path = params[:list][:upload_file].try(:tempfile)
Chaskiq::ListImporterJob.perform_later(@list, params[:list][:upload_file].tempfile.path)
flash[:notice] = "We are importing in background, refresh after a while ;)"
else
flash[:error] = "Whoops!"
end
redirect_to manage_list_path(@list)
end
def clear
@list = Chaskiq::List.find(params[:id])
@list.subscriptions.delete_all
flash[:notice] = "We are importing in background, refresh after a while ;)"
redirect_to manage_list_path(@list)
end
def update
@list = Chaskiq::List.find(params[:id])
if @list.update_attributes(resource_params)
redirect_to manage_lists_path
else
render "new"
end
end
def create
if @list = Chaskiq::List.create(resource_params)
redirect_to manage_lists_path
else
render "new"
end
end
def destroy
@list = Chaskiq::List.find(params[:id])
if @list.destroy
flash[:notice] = "Destroyed succesfully"
redirect_to manage_lists_path
end
end
protected
def resource_params
return [] if request.get?
params.require(:list).permit! #(:name)
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/subscription.rb | app/models/chaskiq/subscription.rb | require "aasm"
module Chaskiq
class Subscription < ActiveRecord::Base
belongs_to :subscriber
belongs_to :list
has_many :campaigns, through: :list
has_many :metrics , as: :trackable
delegate :name, :last_name, :email, to: :subscriber
scope :availables, ->{ where(["chaskiq_subscriptions.state =? or chaskiq_subscriptions.state=?", "passive", "subscribed"]) }
include AASM
aasm :column => :state do # default column: aasm_state
state :passive, :initial => true
state :subscribed, :after_enter => :notify_subscription
state :unsubscribed, :after_enter => :notify_unsubscription
#state :bounced, :after_enter => :make_bounced
#state :complained, :after_enter => :make_complained
event :subscribe do
transitions :from => [:passive, :unsubscribed], :to => :subscribed
end
event :unsubscribe do
transitions :from => [:subscribed, :passive], :to => :unsubscribed
end
end
def notify_unsubscription
puts "Pending"
end
def notify_subscription
#we should only unsubscribe when process is made from interface, not from sns notification
puts "Pending"
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/attachment.rb | app/models/chaskiq/attachment.rb | module Chaskiq
class Attachment < ActiveRecord::Base
belongs_to :campaign
mount_uploader :image, ImageUploader
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/subscriber.rb | app/models/chaskiq/subscriber.rb |
module Chaskiq
class Subscriber < ActiveRecord::Base
has_many :subscriptions
has_many :lists, through: :subscriptions, class_name: "Chaskiq::List"
has_many :metrics , as: :trackable
has_many :campaigns, through: :lists, class_name: "Chaskiq::Campaign"
validates :email , presence: true
#validates :name , presence: true
%w[click open bounce spam].each do |action|
define_method("track_#{action}") do |opts|
m = self.metrics.new
m.assign_attributes(opts)
m.action = action
m.save
end
end
def encoded_id
URLcrypt.encode(self.email)
end
def decoded_id
URLcrypt.decode(self.email)
end
def style_class
case self.state
when "passive"
"plain"
when "subscribed"
"information"
when "unsusbscribed"
"warning"
end
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/template.rb | app/models/chaskiq/template.rb | module Chaskiq
class Template < ActiveRecord::Base
has_many :campaigns
validates :body, presence: true
validates :name, presence: true
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/list.rb | app/models/chaskiq/list.rb | module Chaskiq
class List < ActiveRecord::Base
has_many :subscriptions #, dependent: :destroy
has_many :subscribers, through: :subscriptions
has_many :campaigns
accepts_nested_attributes_for :subscribers
attr_accessor :upload_file
def subscription_progress
return 0 if subscribers.where(state: "subscribed").size.zero?
(subscribers.where(state: "subscribed").size.to_f / subscribers.size.to_f * 100.0).to_i
end
def import_csv(file)
csv_importer.import(file).each do |row|
puts "Importing row #{row}"
sub = {email: row[0], name: row[1], last_name: row[2]}
create_subscriber(sub)
end
end
def create_subscriber(subscriber)
sub = self.subscribers.find_or_initialize_by(email: subscriber[:email])
sub.name = subscriber[:name]
sub.last_name = subscriber[:last_name]
s = self.subscriptions.find_or_initialize_by(id: sub.id)
s.subscriber = sub
s.save
s.subscriber
end
def unsubscribe(subscriber)
s = subscriptions.find_by(subscriber: subscriber)
s.unsubscribe!
end
def subscribe(subscriber)
s = subscriptions.find_by(subscriber: subscriber)
s.subscribe!
end
def csv_importer
@importer ||= Chaskiq::CsvImporter.new
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/setting.rb | app/models/chaskiq/setting.rb | module Chaskiq
class Setting < ActiveRecord::Base
belongs_to :campaign
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/metric.rb | app/models/chaskiq/metric.rb | module Chaskiq
class Metric < ActiveRecord::Base
belongs_to :campaign
belongs_to :trackable, polymorphic: true, required: true
#belongs_to :subscription, ->{ where("chaskiq_metrics.trackable_type =?", "Chaskiq::Subscription")}, foreign_key: :trackable_id
belongs_to :subscription, foreign_key: :trackable_id
#system output
scope :deliveries, ->{where(action: "deliver")}
#user feedback
scope :bounces, ->{ where(action: "bounce")}
scope :opens, ->{ where(action: "open") }
scope :clicks, ->{ where(action: "click")}
scope :spams, ->{ where(action: "spam") }
#reportery
scope :uniques, ->{group("host")}
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/models/chaskiq/campaign.rb | app/models/chaskiq/campaign.rb | require 'net/http'
module Chaskiq
class Campaign < ActiveRecord::Base
belongs_to :parent, class_name: "Chaskiq::Campaign"
belongs_to :list
has_many :subscribers, through: :list
has_many :subscriptions, through: :subscribers
has_many :attachments
has_many :metrics
belongs_to :template, class_name: "Chaskiq::Template"
#accepts_nested_attributes_for :template, :campaign_template
attr_accessor :step
validates :subject, presence: true , unless: :step_1?
validates :from_name, presence: true, unless: :step_1?
validates :from_email, presence: true, unless: :step_1?
#validates :plain_content, presence: true, unless: :template_step?
validates :html_content, presence: true, if: :template_step?
before_save :detect_changed_template
mount_uploader :logo, CampaignLogoUploader
def delivery_progress
return 0 if metrics.deliveries.size.zero?
subscriptions.availables.size.to_f / metrics.deliveries.size.to_f * 100.0
end
def subscriber_status_for(subscriber)
#binding.pry
end
def step_1?
self.step == 1
end
def template_step?
self.step == "template"
end
def purge_metrics
self.metrics.delete_all
end
def send_newsletter
Chaskiq::MailSenderJob.perform_later(self)
end
def test_newsletter
Chaskiq::CampaignMailer.test(self).deliver_later
end
def clone_newsletter
cloned_record = self.deep_clone #(:include => :subscribers)
cloned_record.name = self.name + "-copy"
cloned_record
end
def detect_changed_template
if self.changes.include?("template_id")
copy_template
end
end
#deliver email + create metric
def push_notification(subscription)
Chaskiq::SesSenderJob.perform_later(self, subscription)
end
def prepare_mail_to(subscription)
Chaskiq::CampaignMailer.newsletter(self, subscription)
end
def copy_template
self.html_content = self.template.body
self.css = self.template.css
end
def campaign_url
host = Rails.application.routes.default_url_options[:host]
campaign_url = "#{host}/campaigns/#{self.id}"
end
def apply_premailer(opts={})
host = Rails.application.routes.default_url_options[:host]
skip_track_image = opts[:exclude_gif] ? "exclude_gif=true" : nil
premailer_url = ["#{host}/manage/campaigns/#{self.id}/premailer_preview", skip_track_image].join("?")
url = URI.parse(premailer_url)
self.update_column(:premailer, clean_inline_css(url))
end
#will remove content blocks text
def clean_inline_css(url)
premailer = Premailer.new(url, :adapter => :nokogiri, :escape_url_attributes => false)
premailer.to_inline_css.gsub("Drop Content Blocks Here", "")
end
def attributes_for_mailer(subscriber)
subscriber_url = "#{campaign_url}/subscribers/#{subscriber.encoded_id}"
track_image = "#{campaign_url}/tracks/#{subscriber.encoded_id}/open.gif"
{ campaign_url: campaign_url,
campaign_unsubscribe: "#{subscriber_url}/delete",
campaign_subscribe: "#{campaign_url}/subscribers/new",
campaign_description: "#{self.description}",
track_image_url: track_image
}
end
def mustache_template_for(subscriber)
link_prefix = host + "/campaigns/#{self.id}/tracks/#{subscriber.encoded_id}/click?r="
html = Chaskiq::LinkRenamer.convert(premailer, link_prefix)
Mustache.render(html, subscriber.attributes.merge(attributes_for_mailer(subscriber)) )
end
def compiled_template_for(subscriber)
html = mustache_template_for(subscriber)
end
def host
Rails.application.routes.default_url_options[:host] || "http://localhost:3000"
end
## CHART STUFF
def sparklines_by_day(opts={})
range = opts[:range] ||= 2.weeks.ago.midnight..Time.now
self.metrics.group_by_day(:created_at, range: range ).count.map{|o| o.to_a.last}
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/inputs/date_time_picker_input.rb | app/inputs/date_time_picker_input.rb | ## app/inputs/date_time_picker_input.rb
class DateTimePickerInput < SimpleForm::Inputs::Base
def input
template.content_tag(:div, class: 'form-group') do
template.content_tag(:div, class: 'input-group date') do
template.concat span_calendar
template.concat @builder.text_field(attribute_name, input_html_options)
#template.concat span_remove
#template.concat span_table
end
end
end
def input_html_options
{class: 'form-control', readonly: true}
end
def span_calendar
template.content_tag(:span, class: 'input-group-addon') do
template.concat icon_calendar
end
end
def icon_calendar
"<i class='fa fa fa-calendar'></i>".html_safe
end
end | ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/mailers/application_mailer.rb | app/mailers/application_mailer.rb | require 'mustache'
class ApplicationMailer < ActionMailer::Base
def tryme
campaign = Chaskiq::Campaign.first
mail( from: "#{campaign.from_name}<#{campaign.from_email}>",
to: "miguelmichelson@gmail.com",
subject: "campaign.subject",
body: "campaign.reply_email",
content_type: "text/plain" ) do |format|
format.html { render text:'newsletter' }
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/app/mailers/chaskiq/campaign_mailer.rb | app/mailers/chaskiq/campaign_mailer.rb | module Chaskiq
class CampaignMailer < ApplicationMailer
layout 'mailer'
#default delivery_method: :ses
def newsletter(campaign, subscription)
subscriber = subscription.subscriber
return if subscriber.blank?
content_type = "text/html"
attrs = subscriber.attributes
@campaign = campaign
@subscriber = subscriber
@body = campaign.compiled_template_for(subscriber).html_safe
mail( from: "#{campaign.from_name}<#{campaign.from_email}>",
to: subscriber.email,
subject: campaign.subject,
content_type: content_type,
return_path: campaign.reply_email )
end
def test(campaign)
content_type = "text/html"
@campaign = campaign
@subscriber = {name: "Test Name", last_name: "Test Last Name", email: "test@test.com"}
@body = campaign.compiled_template_for(@subscriber).html_safe
content_type = "text/html"
mail( from: "#{campaign.from_name}<#{campaign.from_email}>",
to: "miguelmichelson@gmail.com",
subject: campaign.subject,
body: campaign.reply_email,
content_type: content_type ) do |format|
format.html { render 'newsletter' }
end
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/seeds.rb | db/seeds.rb | name = 'Default theme'
body = '<table id=\"bodyTable\" height=\"100%\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tbody>
<tr>
<td id=\"bodyCell\" align=\"center\" valign=\"top\">
<!-- BEGIN TEMPLATE // -->
<table id=\"templateContainer\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">
<tbody>
<tr>
<td align=\"center\" valign=\"top\">
<!-- BEGIN PREHEADER // -->
<table id=\"templatePreheader\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">
<tbody>
<tr>
<td mccontainer=\"preheader_container\" mc:container=\"preheader_container\" style=\"padding-top:9px;\" class=\"preheaderContainer tpl-container chaskiqDndSource chaskiqDndTarget chaskiqDndContainer\" valign=\"top\">
<div class=\"chaskiqContainerEmptyMessage\" style=\"display: block;\">Drop Content Blocks Here</div>
</td>
</tr>
</tbody>
</table>
<!-- // END PREHEADER -->
</td>
</tr>
<tr>
<td align=\"center\" valign=\"top\">
<!-- BEGIN HEADER // -->
<table id=\"templateHeader\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">
<tbody>
<tr>
<td mccontainer=\"header_container\" mc:container=\"header_container\" class=\"headerContainer tpl-container chaskiqDndSource chaskiqDndTarget chaskiqDndContainer\" valign=\"top\">
<div class=\"chaskiqContainerEmptyMessage\" style=\"display: block;\">Drop Content Blocks Here</div>
</td>
</tr>
</tbody>
</table>
<!-- // END HEADER -->
</td>
</tr>
<tr>
<td align=\"center\" valign=\"top\">
<!-- BEGIN BODY // -->
<table id=\"templateBody\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">
<tbody>
<tr>
<td mccontainer=\"body_container\" mc:container=\"body_container\" class=\"bodyContainer tpl-container chaskiqDndSource chaskiqDndTarget chaskiqDndContainer\" valign=\"top\">
<div class=\"chaskiqContainerEmptyMessage\" style=\"display: block;\">Drop Content Blocks Here</div>
</td>
</tr>
</tbody>
</table>
<!-- // END BODY -->
</td>
</tr>
<tr>
<td align=\"center\" valign=\"top\">
<!-- BEGIN FOOTER // -->
<table id=\"templateFooter\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">
<tbody>
<tr>
<td mccontainer=\"footer_container\" style=\"padding-bottom:9px;\" mc:container=\"footer_container\" class=\"footerContainer tpl-container chaskiqDndSource chaskiqDndTarget chaskiqDndContainer\" valign=\"top\">
<div class=\"chaskiqContainerEmptyMessage\" style=\"display: block;\">Drop Content Blocks Here</div>
<div class=\"chaskiqBlock tpl-block chaskiqDndItem focus\">
<div data-chaskiq-attach-point=\"containerNode\">
<table class=\"mcnTextBlock\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tbody class=\"mcnTextBlockOuter\">
<tr>
<td class=\"mcnTextBlockInner\" valign=\"top\">
<table class=\"mcnTextContentContainer\" align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"600\">
<tbody>
<tr>
<td style=\"padding-top:9px; padding-right: 18px; padding-bottom: 9px; padding-left: 18px;\" class=\"mcnTextContent\" valign=\"top\"> <em>©</em> {{campaign_description}} <br> <br> <strong>Our mailing address is:</strong><br> {{campaign_url}} <br> <br> <a href=\"{{campaign_unsubscribe}}\" class=\"utilityLink\">unsubscribe from this list</a> <a href=\"{{campaign_unsubscribe}}\" class=\"utilityLink\">update subscription preferences</a> <br> <br> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class=\"tpl-block-controls\"> <span class=\"tpl-block-drag chaskiqDndHandle freddicon vellip-square\" title=\"Drag to Reorder\"></span> <a data-chaskiq-attach-point=\"editBtn\" class=\"tpl-block-edit\" href=\"#\" title=\"Edit Block\"><i class=\"fa fa-edit\"></i></a> <a data-chaskiq-attach-point=\"cloneBtn\" class=\"tpl-block-clone\" href=\"#\" title=\"Duplicate Block\"><i class=\"fa fa-files-o\"></i></a> <a data-chaskiq-attach-point=\"deleteBtn\" class=\"tpl-block-delete\" href=\"#\" title=\"Delete Block\"><i class=\"fa fa-trash\"></i></a> </div>
</div>
</td>
</tr>
</tbody>
</table>
<!-- // END FOOTER -->
</td>
</tr>
</tbody>
</table>
<!-- // END TEMPLATE -->
</td>
</tr>
</tbody>
</table>'
css = '#bodyTable {background-color: #f2f2f2;}
#templatePreheader,
#templateHeader,
#templateColumns,
#templateFooter,
#templateBody{
background-color: #ffffff;
border-bottom: 0 none;
border-top: 0 none;
}
.footerContainer .mcnTextContent a {
color: #606060;
font-weight: normal;
text-decoration: underline;
}
.footerContainer .mcnTextContent, .footerContainer .mcnTextContent p {
color: #606060;
font-family: Helvetica;
font-size: 11px;
line-height: 125%;
text-align: left;
}
.chaskiqContainerEmptyMessage{
overflow:hidden;
float:left;
display:none;
line-height:0px;
}'
Chaskiq::Template.create(body: body , name: name, css: css)
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150321205815_create_chaskiq_settings.rb | db/migrate/20150321205815_create_chaskiq_settings.rb | class CreateChaskiqSettings < ActiveRecord::Migration
def change
create_table :chaskiq_settings do |t|
t.text :config
t.references :campaign, index: true
t.timestamps null: false
end
#add_foreign_key :chaskiq_settings, :campaign
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150318021239_create_chaskiq_templates.rb | db/migrate/20150318021239_create_chaskiq_templates.rb | class CreateChaskiqTemplates < ActiveRecord::Migration
def change
create_table :chaskiq_templates do |t|
t.string :name
t.text :body
t.text :html_content
t.string :screenshot
t.timestamps null: false
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150318022506_create_chaskiq_subscribers.rb | db/migrate/20150318022506_create_chaskiq_subscribers.rb | class CreateChaskiqSubscribers < ActiveRecord::Migration
def change
create_table :chaskiq_subscribers do |t|
t.string :name
t.string :email
t.string :state
t.string :last_name
t.references :list, index: true
t.timestamps null: false
end
#add_foreign_key :chaskiq_subscribers, :chaskiq_lists
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150402201729_create_chaskiq_subscriptions.rb | db/migrate/20150402201729_create_chaskiq_subscriptions.rb | class CreateChaskiqSubscriptions < ActiveRecord::Migration
def change
create_table :chaskiq_subscriptions do |t|
t.string :state
t.references :campaign, index: true
t.references :subscriber, index: true
t.references :list, index: true
t.timestamps null: false
end
#add_foreign_key :chaskiq_subscriptions, :campaigns
#add_foreign_key :chaskiq_subscriptions, :subscribers
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150331022602_add_css_to_campaign.rb | db/migrate/20150331022602_add_css_to_campaign.rb | class AddCssToCampaign < ActiveRecord::Migration
def change
add_column :chaskiq_campaigns, :css, :text
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150320031404_create_chaskiq_metrics.rb | db/migrate/20150320031404_create_chaskiq_metrics.rb | class CreateChaskiqMetrics < ActiveRecord::Migration
def change
create_table :chaskiq_metrics do |t|
t.references :trackable, polymorphic: true, index: true, null: false
t.references :campaign, index: true
t.string :action
t.string :host
t.string :data
t.timestamps null: false
end
#add_foreign_key :chaskiq_metrics, :trackable
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150318021006_create_chaskiq_campaigns.rb | db/migrate/20150318021006_create_chaskiq_campaigns.rb | class CreateChaskiqCampaigns < ActiveRecord::Migration
def change
create_table :chaskiq_campaigns do |t|
t.string :subject
t.string :from_name
t.string :from_email
t.string :reply_email
t.text :plain_content
t.text :html_content
t.text :premailer
t.text :description
t.string :logo
t.string :name
t.string :query_string
t.datetime :scheduled_at
t.string :timezone
t.string :state
t.integer :recipients_count
t.boolean :sent
t.integer :opens_count
t.integer :clicks_count
t.references :parent, index: true
t.timestamps null: false
end
add_reference :chaskiq_campaigns, :list, index: true
add_reference :chaskiq_campaigns, :template, index: true
#add_foreign_key :chaskiq_campaigns, :chaskiq_templates
#add_foreign_key :chaskiq_campaigns, :parents
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150331025829_add_css_to_chaskiq_template.rb | db/migrate/20150331025829_add_css_to_chaskiq_template.rb | class AddCssToChaskiqTemplate < ActiveRecord::Migration
def change
add_column :chaskiq_templates, :css, :text
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150318023136_create_chaskiq_attachments.rb | db/migrate/20150318023136_create_chaskiq_attachments.rb | class CreateChaskiqAttachments < ActiveRecord::Migration
def change
create_table :chaskiq_attachments do |t|
t.string :image
t.string :content_type
t.integer :size
t.string :name
t.references :campaign, index: true
t.timestamps null: false
end
#add_foreign_key :chaskiq_attachments, :chaskiq_campaigns
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/db/migrate/20150318021424_create_chaskiq_lists.rb | db/migrate/20150318021424_create_chaskiq_lists.rb | class CreateChaskiqLists < ActiveRecord::Migration
def change
create_table :chaskiq_lists do |t|
t.string :name
t.string :state
t.integer :unsubscribe_count
t.integer :bounced
t.integer :active_count
t.timestamps null: false
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/rails_helper.rb | spec/rails_helper.rb | require "spec_helper.rb" | ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/spec_helper.rb | spec/spec_helper.rb | # This file was generated by the `rails generate rspec:install` 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.
#
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'factory_girl_rails'
require 'shoulda/matchers'
require 'database_cleaner'
require 'active_job/test_helper'
#require 'sidekiq/testing'
#Sidekiq::Testing.fake! # fake is the default mode
require 'pry'
def last_email
ActionMailer::Base.deliveries.last
end
def reset_email
ActionMailer::Base.deliveries = []
end
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.mock_with :rspec
ActiveJob::Base.queue_adapter = :test
# clean out the queue after each spec
config.before(:each) do
unless ActiveJob::Base.queue_adapter.blank?
ActiveJob::Base.queue_adapter.enqueued_jobs = []
ActiveJob::Base.queue_adapter.performed_jobs = []
end
end
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
DatabaseCleaner.cleaning do
example.run
end
end
#config.use_transactional_fixtures = true
#config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
end
def inline_job(&block)
ActiveJob::Base.queue_adapter = :inline
block.call
ActiveJob::Base.queue_adapter = :test
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/hooks_helper_spec.rb | spec/helpers/chaskiq/hooks_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the HooksHelper. For example:
#
# describe HooksHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe HooksHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/subscribers_helper_spec.rb | spec/helpers/chaskiq/subscribers_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the SubscribersHelper. For example:
#
# describe SubscribersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe SubscribersHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/campaigns_helper_spec.rb | spec/helpers/chaskiq/campaigns_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the CampaignsHelper. For example:
#
# describe CampaignsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe CampaignsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/tracks_helper_spec.rb | spec/helpers/chaskiq/tracks_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the TracksHelper. For example:
#
# describe TracksHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe TracksHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/dashboard_helper_spec.rb | spec/helpers/chaskiq/dashboard_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the DashboardHelper. For example:
#
# describe DashboardHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe DashboardHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/manage/lists_helper_spec.rb | spec/helpers/chaskiq/manage/lists_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Manage::ListsHelper. For example:
#
# describe Manage::ListsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe Manage::ListsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/manage/templates_helper_spec.rb | spec/helpers/chaskiq/manage/templates_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Manage::TemplatesHelper. For example:
#
# describe Manage::TemplatesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe Manage::TemplatesHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/manage/metrics_helper_spec.rb | spec/helpers/chaskiq/manage/metrics_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Manage::MetricsHelper. For example:
#
# describe Manage::MetricsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe Manage::MetricsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/manage/campaigns_helper_spec.rb | spec/helpers/chaskiq/manage/campaigns_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Manage::CampaignsHelper. For example:
#
# describe Manage::CampaignsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe Manage::CampaignsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/manage/attachments_helper_spec.rb | spec/helpers/chaskiq/manage/attachments_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Manage::AttachmentsHelper. For example:
#
# describe Manage::AttachmentsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe Manage::AttachmentsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/helpers/chaskiq/manage/campain_wizard_helper_spec.rb | spec/helpers/chaskiq/manage/campain_wizard_helper_spec.rb | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Manage::CampainWizardHelper. For example:
#
# describe Manage::CampainWizardHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module Chaskiq
RSpec.describe Manage::CampainWizardHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_lists.rb | spec/factories/chaskiq_lists.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_list, :class => 'Chaskiq::List' do
name "MyString"
#state "MyString"
#unsubscribe_count 1
#bounced 1
#active_count 1
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_settings.rb | spec/factories/chaskiq_settings.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_setting, :class => 'Setting' do
config "MyText"
campaign nil
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_subscriptions.rb | spec/factories/chaskiq_subscriptions.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_subscription, :class => 'Subscription' do
state "MyString"
campaign nil
subscriber nil
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_subscribers.rb | spec/factories/chaskiq_subscribers.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_subscriber, :class => 'Chaskiq::Subscriber' do
sequence :email do |n|
"person#{n}@example.com"
end
sequence :name do |n|
"person #{n}"
end
sequence :last_name do |n|
"#{n}son"
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_attachments.rb | spec/factories/chaskiq_attachments.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_attachment, :class => 'Chaskiq::Attachment' do
image "MyString"
content_type "MyString"
size 1
name "MyString"
campaign nil
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_campaigns.rb | spec/factories/chaskiq_campaigns.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_campaign, :class => 'Chaskiq::Campaign' do
name "some Campaign"
subject "Hello"
from_name "Me"
from_email "me@me.com"
reply_email "reply-me@me.com"
#plain_content "hi this is the plain content"
#html_content "<h1>hi this is htmlcontent </h1>"
#query_string "opt=1&out=2"
#scheduled_at "2015-03-17 23:10:06"
#timezone "utc-4"
#recipients_count 1
#sent false
#opens_count 1
#clicks_count 1
#parent nil
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_metrics.rb | spec/factories/chaskiq_metrics.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_metric, :class => 'Chaskiq::Metric' do
trackable nil
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/factories/chaskiq_templates.rb | spec/factories/chaskiq_templates.rb | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :chaskiq_template, :class => 'Chaskiq::Template' do
name "MyString"
body "<p>this is the template</p>"
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/subscribers_controller_spec.rb | spec/controllers/chaskiq/subscribers_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe SubscribersController, type: :controller do
render_views
routes { Chaskiq::Engine.routes }
let(:list){ FactoryGirl.create(:chaskiq_list) }
let(:subscriber){
list.create_subscriber FactoryGirl.attributes_for(:chaskiq_subscriber)
}
let(:campaign){ FactoryGirl.create(:chaskiq_campaign, list: list) }
it "will show subscriber!" do
campaign
response = get("show", campaign_id: campaign.id, id: subscriber.encoded_id)
expect(response.status).to be == 200
expect(response.body).to include campaign.name
end
it "will subscribe subscribe!" do
campaign
response = post("create", campaign_id: campaign.id, subscriber: {name: "some subscriber", last_name: "subscriberson", email: "some@email.com"})
expect(response.status).to be == 302
expect(campaign.subscriptions.subscribed.size).to be == 1
end
it "will unsubscribe unsubscribe!" do
campaign
subscriber
response = delete("destroy", campaign_id: campaign.id, id: subscriber.encoded_id )
expect(response.status).to be == 302
expect(list.subscriptions.unsubscribed.size).to be == 1
end
it "will update subscriber" do
campaign
subscriber
response = delete("update", campaign_id: campaign.id, id: subscriber.encoded_id, subscriber: {name: "updated name"} )
expect(response.status).to be == 302
expect(subscriber.reload.name).to be == "updated name"
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/hooks_controller_spec.rb | spec/controllers/chaskiq/hooks_controller_spec.rb | require 'rails_helper'
def send_data(params)
@request.env['RAW_POST_DATA'] = params.to_json
post :create
end
module Chaskiq
RSpec.describe HooksController, type: :controller do
routes { Chaskiq::Engine.routes }
let(:list){ FactoryGirl.create(:chaskiq_list) }
let(:subscriber){
list.create_subscriber FactoryGirl.attributes_for(:chaskiq_subscriber)
}
let(:subscription){
subscriber.subscriptions.first
}
let(:campaign){ FactoryGirl.create(:chaskiq_campaign, list: list) }
let(:metric){
FactoryGirl.create(:chaskiq_metric, campaign: campaign, trackable: subscription)
}
let(:bounce_sns){
{"Message" => {
"notificationType"=>"Bounce",
"bounce"=>{
"bounceType"=>"Permanent",
"bounceSubType"=> "General",
"bouncedRecipients"=>[
{
"emailAddress"=>"#{subscriber.email}"
},
{
"emailAddress"=>"recipient2@example.com"
}
],
"timestamp"=>"2012-05-25T14:59:38.237-07:00",
"feedbackId"=>"00000137860315fd-869464a4-8680-4114-98d3-716fe35851f9-000000"
},
"mail"=>{
"timestamp"=>"2012-05-25T14:59:38.237-07:00",
"messageId"=>"00000137860315fd-34208509-5b74-41f3-95c5-22c1edc3c924-000000",
"source"=>"#{campaign.from_email}",
"destination"=>[
"recipient1@example.com",
"recipient2@example.com",
"recipient3@example.com",
"recipient4@example.com"
]
}
}.to_json
}
}
let(:complaint_sns){
{"Message" => {
"notificationType"=>"Complaint",
"complaint"=>{
"complainedRecipients"=>[
{
"emailAddress"=>"#{subscriber.email}"
}
],
"timestamp"=>"2012-05-25T14:59:38.613-07:00",
"feedbackId"=>"0000013786031775-fea503bc-7497-49e1-881b-a0379bb037d3-000000"
},
"mail"=>{
"timestamp"=>"2012-05-25T14:59:38.613-07:00",
"messageId"=>"0000013786031775-163e3910-53eb-4c8e-a04a-f29debf88a84-000000",
"source"=>"#{campaign.from_email}",
"destination"=>[
"recipient1@example.com",
"recipient2@example.com",
"recipient3@example.com",
"recipient4@example.com"
]
}
}.to_json
}
}
it "will set a bounce" do
inline_job do
allow(Chaskiq::Metric).to receive(:find_by).and_return(metric)
campaign
response = send_data(bounce_sns)
expect(response.status).to be == 200
expect(campaign.metrics.bounces.size).to be == 1
end
end
it "will set a spam metric and unsubscribe user" do
inline_job do
ActiveJob::Base.queue_adapter = :inline
allow(Chaskiq::Metric).to receive(:find_by).and_return(metric)
campaign
response = send_data(complaint_sns)
expect(response.status).to be == 200
expect(campaign.metrics.spams.size).to be == 1
expect(subscriber.subscriptions.first.reload).to be_unsubscribed
end
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/campaigns_controller_spec.rb | spec/controllers/chaskiq/campaigns_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe CampaignsController, type: :controller do
render_views
routes { Chaskiq::Engine.routes }
let(:list){ FactoryGirl.create(:chaskiq_list) }
let(:subscriber){
list.create_subscriber FactoryGirl.attributes_for(:chaskiq_subscriber)
}
let(:campaign){ FactoryGirl.create(:chaskiq_campaign, list: list) }
it "will show campaign!" do
campaign
response = get("show", id: campaign.id)
expect(response.status).to be == 200
expect(response.body).to include "subscribe"
expect(response.body).to include campaign.name
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/dashboard_controller_spec.rb | spec/controllers/chaskiq/dashboard_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe DashboardController, type: :controller do
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/tracks_controller_spec.rb | spec/controllers/chaskiq/tracks_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe TracksController, type: :controller do
routes { Chaskiq::Engine.routes }
let(:list){ FactoryGirl.create(:chaskiq_list) }
let(:subscriber){
list.create_subscriber FactoryGirl.attributes_for(:chaskiq_subscriber)
}
let(:campaign){ FactoryGirl.create(:chaskiq_campaign, list: list) }
%w[open bounce spam].each do |action|
it "will track an #{action}" do
campaign
response = get(action , campaign_id: campaign.id, id: subscriber.encoded_id)
expect(response.status).to be == 200
expect(campaign.metrics.send(action.pluralize).size).to be == 1
expect(response.content_type).to be == "image/gif"
end
end
it "will track a click and redirect" do
campaign
response = get("click" , campaign_id: campaign.id, id: subscriber.encoded_id, r: "http://google.com")
expect(response.status).to be == 302
expect(campaign.metrics.clicks.size).to be == 1
expect(response).to redirect_to "http://google.com"
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/manage/attachments_controller_spec.rb | spec/controllers/chaskiq/manage/attachments_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe Manage::AttachmentsController, type: :controller do
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/manage/campaigns_controller_spec.rb | spec/controllers/chaskiq/manage/campaigns_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe Manage::CampaignsController, type: :controller do
routes { Chaskiq::Engine.routes }
let(:campaign){ FactoryGirl.create(:chaskiq_campaign) }
before do
campaign
end
it "will render index" do
response = get :index
expect(response).to render_template(:index)
expect(assigns(:campaigns)).to eq(Chaskiq::Campaign.all)
end
it "will render show" do
response = get :show , id: campaign.id
expect(response).to render_template(:show)
expect(assigns(:campaign)).to eq(campaign)
end
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/manage/campaign_wizard_controller_spec.rb | spec/controllers/chaskiq/manage/campaign_wizard_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe Manage::CampaignWizardController, type: :controller do
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
michelson/chaskiq-newsletters | https://github.com/michelson/chaskiq-newsletters/blob/1f0d0e6cf7f198e888d421471619bdfdedffa1d2/spec/controllers/chaskiq/manage/lists_controller_spec.rb | spec/controllers/chaskiq/manage/lists_controller_spec.rb | require 'rails_helper'
module Chaskiq
RSpec.describe Manage::ListsController, type: :controller do
end
end
| ruby | MIT | 1f0d0e6cf7f198e888d421471619bdfdedffa1d2 | 2026-01-04T17:52:24.705458Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.