source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/base.rb
Ruby
mit
92
master
10,440
# encoding: UTF-8 require 'timeout' require 'scanf' require 'monitor' require 'eventmachine' module Smpp class InvalidStateException < Exception; end class Base < EventMachine::Connection include Smpp # :bound or :unbound attr_accessor :state def initialize(config, delegate) @state = :unb...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/transmitter.rb
Ruby
mit
92
master
2,412
# encoding: UTF-8 # The SMPP Transmitter maintains a unidirectional connection to an SMSC. # Provide a config hash with connection options to get started. # See the sample_gateway.rb for examples of config values. class Smpp::Transmitter < Smpp::Base attr_reader :ack_ids # Send an MT SMS message. Delegate will r...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/optional_parameter.rb
Ruby
mit
92
master
605
# encoding: UTF-8 class Smpp::OptionalParameter attr_reader :tag, :value def initialize(tag, value) @tag = tag @value = value end def [](symbol) self.send symbol end def to_s self.inspect end #class methods class << self def from_wire_data(data) return nil if data.nil?...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/transceiver.rb
Ruby
mit
92
master
4,396
# encoding: UTF-8 # The SMPP Transceiver maintains a bidirectional connection to an SMSC. # Provide a config hash with connection options to get started. # See the sample_gateway.rb for examples of config values. # The transceiver accepts a delegate object that may implement # the following (all optional) methods: # #...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/submit_sm_response.rb
Ruby
mit
92
master
867
# encoding: UTF-8 class Smpp::Pdu::SubmitSmResponse < Smpp::Pdu::Base handles_cmd SUBMIT_SM_RESP attr_accessor :message_id attr_accessor :optional_parameters def initialize(seq, status, message_id, optional_parameters=nil) seq ||= next_sequence_number body = message_id.to_s + "\000" super(SUBMIT_...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/bind_resp_base.rb
Ruby
mit
92
master
520
# encoding: UTF-8 class Smpp::Pdu::BindRespBase < Smpp::Pdu::Base class << self; attr_accessor :command_id ; end attr_accessor :system_id def initialize(seq, status, system_id) seq ||= next_sequence_number system_id = system_id.to_s + "\000" super(self.class.command_id, status, seq, system_id) # pass...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/unbind_response.rb
Ruby
mit
92
master
278
# encoding: UTF-8 class Smpp::Pdu::UnbindResponse < Smpp::Pdu::Base handles_cmd UNBIND_RESP def initialize(seq, status) seq ||= next_sequence_number super(UNBIND_RESP, status, seq) end def self.from_wire_data(seq, status, body) new(seq, status) end end
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/submit_sm.rb
Ruby
mit
92
master
4,317
# encoding: UTF-8 # Sending an MT message class Smpp::Pdu::SubmitSm < Smpp::Pdu::Base handles_cmd SUBMIT_SM attr_reader :service_type, :source_addr_ton, :source_addr_npi, :source_addr, :dest_addr_ton, :dest_addr_npi, :destination_addr, :esm_class, :protocol_id, :priority_flag, :schedule_delivery_time...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/unbind.rb
Ruby
mit
92
master
227
# encoding: UTF-8 class Smpp::Pdu::Unbind < Smpp::Pdu::Base handles_cmd UNBIND def initialize(seq=next_sequence_number) super(UNBIND, 0, seq) end def self.from_wire_data(seq, status, body) new(seq) end end
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/submit_multi_response.rb
Ruby
mit
92
master
1,455
# encoding: UTF-8 # Recieving response for an MT message sent to multiple addresses # Author: Abhishek Parolkar, (abhishek[at]parolkar.com) class Smpp::Pdu::SubmitMultiResponse < Smpp::Pdu::Base class UnsuccessfulSme Struct.new(:dest_addr_ton, :dest_addr_npi, :destination_addr, :error_status_code) end handl...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/deliver_sm_response.rb
Ruby
mit
92
master
329
# encoding: UTF-8 class Smpp::Pdu::DeliverSmResponse < Smpp::Pdu::Base handles_cmd DELIVER_SM_RESP def initialize(seq, status=ESME_ROK) seq ||= next_sequence_number super(DELIVER_SM_RESP, status, seq, "\000") # body must be NULL..! end def self.from_wire_data(seq, status, body) new(seq, status) ...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/base.rb
Ruby
mit
92
master
6,561
# encoding: UTF-8 # PDUs are the protcol base units in SMPP module Smpp::Pdu class Base #Protocol Version PROTOCOL_VERSION = 0x34 # Error constants ESME_ROK = 0x00000000 # OK! ESME_RINVMSGLEN = 0x00000001 # Message Length is invalid ESME_RINVCMDLEN = 0x00000002 # ...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/deliver_sm.rb
Ruby
mit
92
master
6,651
# encoding: UTF-8 # Received for MO message or delivery notification class Smpp::Pdu::DeliverSm < Smpp::Pdu::Base handles_cmd DELIVER_SM attr_reader :service_type, :source_addr_ton, :source_addr_npi, :source_addr, :dest_addr_ton, :dest_addr_npi, :destination_addr, :esm_class, :protocol_id, :priority_...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/bind_base.rb
Ruby
mit
92
master
1,129
# encoding: UTF-8 # this class serves as the base for all the bind* commands. # since the command format remains the same for all bind commands, # sub classes just change the @@command_id class Smpp::Pdu::BindBase < Smpp::Pdu::Base class << self; attr_accessor :command_id ; end attr_reader :system_id, :password, :...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/generic_nack.rb
Ruby
mit
92
master
662
# encoding: UTF-8 # signals invalid message header class Smpp::Pdu::GenericNack < Smpp::Pdu::Base handles_cmd GENERIC_NACK attr_accessor :error_code def initialize(seq, error_code, original_sequence_code = nil) #TODO: original_sequence_code used to be passed to this function #however, a GENERIC_NACK ha...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/submit_multi.rb
Ruby
mit
92
master
2,918
# encoding: UTF-8 # Sending an MT message to multiple addresses # Author: Abhishek Parolkar, (abhishek[at]parolkar.com) #TODO: Implement from_wire_data for this pdu class. class Smpp::Pdu::SubmitMulti < Smpp::Pdu::Base IS_SMEADDR = 1 # type of dest_flag IS_DISTLISTNAME = 2 #type of dest_flag # Note: short_messa...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/enquire_link_response.rb
Ruby
mit
92
master
271
# encoding: UTF-8 class Smpp::Pdu::EnquireLinkResponse < Smpp::Pdu::Base handles_cmd ENQUIRE_LINK_RESP def initialize(seq = next_sequence_number) super(ENQUIRE_LINK_RESP, ESME_ROK, seq) end def self.from_wire_data(seq, status, body) new(seq) end end
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/pdu/enquire_link.rb
Ruby
mit
92
master
246
# encoding: UTF-8 class Smpp::Pdu::EnquireLink < Smpp::Pdu::Base handles_cmd ENQUIRE_LINK def initialize(seq = next_sequence_number) super(ENQUIRE_LINK, 0, seq) end def self.from_wire_data(seq, status, body) new(seq) end end
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
lib/smpp/encoding/utf8_encoder.rb
Ruby
mit
92
master
1,399
#encoding: ASCII-8BIT require 'iconv' if RUBY_VERSION =~ /\A1\.(8|9)/ module Smpp module Encoding # This class is not required by smpp.rb at all, you need to bring it in yourself. # This class also requires iconv, you'll need to ensure it is installed. class Utf8Encoder EURO_TOKEN = "_X_EURO_X_" ...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
examples/sample_gateway.rb
Ruby
mit
92
master
4,038
#!/usr/bin/env ruby # encoding: UTF-8 # Sample SMS gateway that can receive MOs (mobile originated messages) and # DRs (delivery reports), and send MTs (mobile terminated messages). # MTs are, in the name of simplicity, entered on the command line in the format # <sender> <receiver> <message body> # MOs and DRs will ...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
examples/sample_smsc.rb
Ruby
mit
92
master
2,612
#!/usr/bin/env ruby # encoding: UTF-8 # Sample SMPP SMS Gateway. require 'rubygems' require File.dirname(__FILE__) + '/../lib/smpp' require File.dirname(__FILE__) + '/../lib/smpp/server' # set up logger Smpp::Base.logger = Logger.new('smsc.log') # the transceiver $tx = nil # We use EventMachine to receive keyboar...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/optional_parameter_test.rb
Ruby
mit
92
master
708
# encoding: UTF-8 require 'rubygems' require 'test/unit' require 'smpp' class OptionalParameterTest < Test::Unit::TestCase include Smpp def test_symbol_accessor op = OptionalParameter.new(0x2150, "abcd") assert_equal "abcd", op[:value] assert_equal 0x2150, op[:tag] end def test_bad_data_does_not_...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/encoding_test.rb
Ruby
mit
92
master
6,557
# encoding: utf-8 require 'rubygems' require 'test/unit' require 'smpp/encoding/utf8_encoder' require File.expand_path(File.dirname(__FILE__) + "../../lib/smpp") class EncodingTest < Test::Unit::TestCase def setup ::Smpp::Pdu::DeliverSm.data_encoder = ::Smpp::Encoding::Utf8Encoder.new end def teardown ...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/responsive_delegate.rb
Ruby
mit
92
master
1,336
# encoding: UTF-8 #TODO This should be made prettier with mocha class ResponsiveDelegate attr_reader :seq, :event_counter def initialize @seq = 0 @event_counter = nil end def seq @seq += 1 end def count_function func = caller(1)[0].split("`")[1].split("'")[0].to_sym @event_counter = {} ...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/server.rb
Ruby
mit
92
master
1,728
# encoding: UTF-8 # a server which immediately requests the client to unbind module Server def self.config { :host => 'localhost', :port => 2775, :system_id => 'foo', :password => 'bar', :system_type => '', :source_ton => 0, :source_npi => 1, :destination_ton => 1,...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/smpp_test.rb
Ruby
mit
92
master
10,339
# encoding: UTF-8 require 'rubygems' require 'test/unit' require 'smpp' require 'server' require 'delegate' require 'responsive_delegate' class Poller def start end end class SmppTest < Test::Unit::TestCase def config Server::config end def test_transceiver_should_bind_and_unbind_then_stop Event...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/transceiver_test.rb
Ruby
mit
92
master
1,354
# encoding: UTF-8 require "rubygems" require "test/unit" require File.expand_path(File.dirname(__FILE__) + "../../lib/smpp") class TransceiverTest < Test::Unit::TestCase def test_get_message_part_size_8 options = {:data_coding => 8} assert_equal(67, Smpp::Transceiver.get_message_part_size(options)) end d...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/submit_sm_test.rb
Ruby
mit
92
master
1,367
# encoding: UTF-8 require 'rubygems' require 'test/unit' require 'smpp' class SubmitSmTest < Test::Unit::TestCase def test_this_is_not_a_real_test value = [383 >> 8, 383 & 0xff] optionals = {0x2150 => Smpp::OptionalParameter.new(0x2150, value.pack('cc'))} pdu = Smpp::Pdu::SubmitSm.new('12345', '54321', ...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/delegate.rb
Ruby
mit
92
master
611
# encoding: UTF-8 # the delagate receives callbacks when interesting things happen on the connection class Delegate def mo_received(transceiver, pdu) puts "** mo_received" end def delivery_report_received(transceiver, pdu) puts "** delivery_report_received" end def message_accepted(transceiver, mt...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/pdu_parsing_test.rb
Ruby
mit
92
master
3,716
# encoding: UTF-8 require 'rubygems' require 'test/unit' require File.expand_path(File.dirname(__FILE__) + "../../lib/smpp") class PduParsingTest < Test::Unit::TestCase def test_recieve_single_message raw_data = <<-EOF 0000 003d 0000 0005 0000 0000 0000 0002 0001 0134 3437 3830 3330 3239 3833 3700 0...
github
raykrueger/ruby-smpp
https://github.com/raykrueger/ruby-smpp
test/receiver_test.rb
Ruby
mit
92
master
8,060
# encoding: UTF-8 require 'rubygems' require 'test/unit' require 'smpp' class ReceiverTest < Test::Unit::TestCase class RecordingDelegate attr_reader :received_pdus, :received_delivery_report_pdus, :states def initialize @received_pdus, @received_delivery_report_pdus, @states = [], [], [] end ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
Rakefile
Ruby
mit
92
main
320
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require_relative "config/application" Rails.application.load_tasks task clean_call_list: :environment do User.all.each(&:clean_call_list_between_shifts) end
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
Gemfile
Ruby
mit
92
main
5,571
source 'https://rubygems.org' ruby '3.4.8' # Rails stock gem 'rails', '~> 8.1' # temp 72 # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" # gem "propshaft", require: false # temp off # The modern asset pipeline for Rails [https://github.com/rails/propshaft] gem "pg", "~> 1.6" # Use postg...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/encrypt_clinic_columns.rake
Ruby
mit
92
main
215
namespace :clinic do desc "update clinics to be encrypted with ActiveRecord encryption" task encrypt_sensitive_columns: :environment do Clinic.all.find_each do |clinic| clinic.encrypt end end end
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/factory_girl.rake
Ruby
mit
92
main
347
namespace :factory_bot do desc "Verify that all FactoryBot factories are valid" task lint: :environment do if Rails.env.test? begin DatabaseCleaner.start FactoryBot.lint ensure DatabaseCleaner.clean end else system("bundle exec rake factory_bot:lint RAILS_ENV=...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/create_fake_data.rake
Ruby
mit
92
main
3,418
namespace :db do namespace :seed do desc 'Generate fake patient entries for data wranglers' task :create_fake_data => :environment do ActsAsTenant.current_tenant = Fund.first users = User.all clinics = Clinic.all gen = Random.new(2020) # our random number generator: https://r...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/user.rake
Ruby
mit
92
main
351
namespace :user do desc "update role field production data" task update_role: :environment do User.all.each do |user| enum_role = check_role(user.role) user.update(role: enum_role) end puts 'User role updated' end private def check_role(role) case role when 'admin' 1 ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/encrypt_event_columns.rake
Ruby
mit
92
main
211
namespace :event do desc "update events to be encrypted with ActiveRecord encryption" task encrypt_sensitive_columns: :environment do Event.all.find_each do |event| event.encrypt end end end
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/multitenant_db_merge.rake
Ruby
mit
92
main
15,704
desc 'Merge an ext daria db into main db' task multitenant_db_merge: :environment do raise 'SET MIGRATION_FUND_ID ENV VAR' if not ENV['MIGRATION_FUND_ID'] raise 'SET MIGRATION_DB_URL ENV VAR' if not ENV['MIGRATION_DB_URL'] # Make absolutely sure the new fund has been created! fund = Fund.find ENV['MIGRATION_FU...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/nightly_cleanup.rake
Ruby
mit
92
main
1,223
desc 'Run nightly cleanup methods on call lists, users, patients, etc.' task nightly_cleanup: :environment do # Run most of these tasks nightly Rake::Task['db:sessions:trim'].invoke puts "#{Time.now} -- removed old sessions" Event.destroy_old_events puts "#{Time.now} -- destroyed old events" PaperTrailVer...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/seed_training.rake
Ruby
mit
92
main
568
namespace :db do namespace :seed do desc 'Generate 20 training accounts - training-account-n@example.com' task :training => :environment do fail 'No running seeds in prod' unless [nil, 'Sandbox'].include? ENV['DARIA_FUND'] # Create two test users 20.times do |i| User.create! name: "...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/notes_polymorphic_backfill.rb
Ruby
mit
92
main
216
desc 'Backfill notes polymorphism data' task notes_polymorphic_backfill: :environment do Note.where(can_note: nil).each do |note| note.can_note_id = note.patient_id note.can_note_type = 'Patient' end end
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
lib/tasks/fund_management.rake
Ruby
mit
92
main
1,997
namespace :fund_management do desc "Remove a fund and all its related objects" task :delete_fund, [:fund_name] => [:environment] do |task, args| # query our fund fund_name = args.fund_name defunct_fund = Fund.find_by(name: fund_name) if defunct_fund.nil? raise 'Fund not found. Please doubleche...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/environment.rb
Ruby
mit
92
main
437
# Load the Rails application. require_relative "application" # Initialize the Rails application. Rails.application.initialize! # Custom ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '587', :authentication => :plain, :user_name => ENV['SENDGRID_USERNAME'],...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/ci.rb
Ruby
mit
92
main
910
# Run using bin/ci CI.run do step "Setup", "bin/setup --skip-server" step "Style: Ruby", "bin/rubocop" step "Security: Gem audit", "bin/bundler-audit" step "Security: Yarn vulnerability audit", "yarn audit" step "Security: Importmap vulnerability audit", "bin/importmap audit" step "Security: Brakeman cod...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/routes.rb
Ruby
mit
92
main
4,203
Rails.application.routes.draw do get "up" => "rails/health#show", as: :rails_health_check # Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb) # get "manifest" => "rails/pwa#manifest", as: :pwa_manifest # get "service-worker" => "rails/pwa#service_worker", as: :pwa...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/application.rb
Ruby
mit
92
main
2,434
require_relative "boot" require "rails/all" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Daria2 class Application < Rails::Application # Initialize configuration defaults for originally generated Rails ve...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/importmap.rb
Ruby
mit
92
main
332
# Pin npm packages by running ./bin/importmap pin "application" pin "@hotwired/turbo-rails", to: "turbo.min.js" pin "@hotwired/stimulus", to: "stimulus.min.js" pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" pin_all_from "app/javascript/controllers", under: "controllers" pin "bootstrap", to: "bootstrap.bun...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/devise.rb
Ruby
mit
92
main
15,866
# frozen_string_literal: true # Assuming you have not yet modified this file, each configuration option below # is set to its default value. Note that some are commented out while others # are not: uncommented lines are intended to protect your configuration from # breaking changes in upgrades (i.e., in the event that...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/time_with_zone.rb
Ruby
mit
92
main
400
# Extends ActiveSupport::TimeWithZone class with convenience methods module ActiveSupport class TimeWithZone def display_date tz = Config.time_zone || Rails.application.config.time_zone in_time_zone(tz).strftime("%m/%d/%Y") end def display_time tz = Config.time_zone || Rails.application...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/sentry.rb
Ruby
mit
92
main
411
# Configure sentry Sentry.init do |config| config.dsn = ENV['SENTRY_DSN'] config.send_default_pii = true # Roughly reimplement sanitize_fields; see https://github.com/getsentry/sentry-ruby/issues/1140#issuecomment-788089679 filter = ActiveSupport::ParameterFilter.new(Rails.application.config.filter_parameters)...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/content_security_policy.rb
Ruby
mit
92
main
1,704
# Be sure to restart your server when you modify this file. # Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy Rails.application.config.content_security_policy do |policy| ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/assets.rb
Ruby
mit
92
main
640
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = "1.0" # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Precompile additional...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/time.rb
Ruby
mit
92
main
250
# Extends time class with convenience methods class Time def display_date getlocal.strftime("%m/%d/%Y") end def display_time getlocal.strftime("%-l:%M %P") end def display_timestamp "#{display_date} #{display_time}" end end
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/devise_security.rb
Ruby
mit
92
main
1,734
# frozen_string_literal: true Devise.setup do |config| # ==> Security Extension # Configure security extension for devise # Should the password expire (e.g 3.months) # config.expire_password_after = false # Need 1 char each of: A-Z, a-z, 0-9, and a punctuation mark or symbol # You may use "digits" in pla...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/rack-attack.rb
Ruby
mit
92
main
3,641
class Rack::Attack ### Configure Cache ### # If you don't want to use Rails.cache (Rack::Attack's default), then # configure it here. # # Note: The store is only used for throttling (not blacklisting and # whitelisting). It must implement .increment and .write like # ActiveSupport::Cache::Store # Rac...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/geokit_config.rb
Ruby
mit
92
main
4,773
# These defaults are used in Geokit::Mappable.distance_to and acts_as_mappable Geokit::default_units = :miles # others :kms, :nms, :meters Geokit::default_formula = :sphere # This is the timeout value in seconds to be used for calls to the geocoder web # services. For no timeout at all, comment out the setting. The ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/session_store.rb
Ruby
mit
92
main
276
# Be sure to restart your server when you modify this file. Rails.application.config.session_store :active_record_store, key: '_my_app_session', secure: Rails.env.production? || Rails.env.staging?
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/initializers/filter_parameter_logging.rb
Ruby
mit
92
main
673
# Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [ # Defaults :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc, # Custom :password, :...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/environments/development.rb
Ruby
mit
92
main
3,289
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Make code changes take effect immediately without server restart. config.enable_reloading = true # Do not eager load code on boot. config.eager...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/environments/test.rb
Ruby
mit
92
main
3,269
# The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! require "active_support/core_ext/integer/ti...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
config/environments/production.rb
Ruby
mit
92
main
4,384
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot for better performance and memory savings (ignor...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/mailers/user_mailer.rb
Ruby
mit
92
main
377
# app/mailers/user_mailer.rb class UserMailer < Devise::Mailer default from: "no-reply@#{FUND_MAILER_DOMAIN}" def password_changed(id) @user = User.find(id) mail to: @user.email, subject: 'Your DARIA password has changed' end def account_created(id) @user = User.find(id) mail to: @user.email, ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/services/pledge_form_generator.rb
Ruby
mit
92
main
5,509
class PledgeFormGenerator include ActionView::Helpers::NumberHelper # for currency formatting attr_reader :patient, :user, :case_manager_name, :fund def initialize(user, patient, case_manager_name, fund) @patient = patient @user = user @case_manager_name = case_manager_name @fund = fund @con...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/services/uri_service.rb
Ruby
mit
92
main
642
class UriService attr_accessor :uri def initialize(uri) return nil if uri.blank? begin @uri = URI.parse(uri) if @uri.class == URI::Generic # probably missing https. raise error so we can try again raise URI::InvalidURIError end rescue URI::InvalidURIError # M...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/services/clinic_finder/locator.rb
Ruby
mit
92
main
1,712
require 'ostruct' # require_relative './clinic_finder/gestation_helper' # require_relative 'clinic_finder/affordability_helper' # Use as follows: # pt = Patient.find('123'); # finder = ClinicFinder::Locator.new(Clinic.all) # finder.locate_nearest_clinics pt.zip, limit: 5 # finder.locate_cheapest_clinics limit: 5 modul...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/services/clinic_finder/modules/geocoder.rb
Ruby
mit
92
main
748
require 'ostruct' module ClinicFinder # Functionality pertaining to geography module Modules # Nesting due to rails autoload module Geocoder # Get a patient's latitude and longitude. def patient_coordinates_from_zip(zipcode) patient_location = @geocoder.geocode zipcode [patient_...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/services/clinic_finder/modules/gestation_helper.rb
Ruby
mit
92
main
1,374
require 'ostruct' # Currently defining this as a placeholder to keep the autoloader happy. # Actual code for the old gem is commented out below. Comment it it in # someday. module ClinicFinder # Functionality pertaining to gestation age calculation module Modules # Nesting due to rails autoload module Gest...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/user.rb
Ruby
mit
92
main
5,067
# Object representing a case manager. # Fields are all devise settings; most of the methods relate to call list mgmt. class User < ApplicationRecord acts_as_tenant :fund # Concerns include PaperTrailable include CallListable # Devise modules devise :database_authenticatable, :registerable, ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/call.rb
Ruby
mit
92
main
755
# Object representing a case manager dialing a patient. class Call < ApplicationRecord acts_as_tenant :fund # Concerns include EventLoggable include PaperTrailable # Enums enum :status, { reached_patient: 0, left_voicemail: 1, couldnt_reach_patient: 2 } # Relationships belongs_to :can_c...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/practical_support.rb
Ruby
mit
92
main
530
# Representation of non-monetary assistance coordinated for a patient. class PracticalSupport < ApplicationRecord acts_as_tenant :fund encrypts :attachment_url # Concerns include PaperTrailable include Notetakeable # Relationships belongs_to :can_support, polymorphic: true has_many :notes, as: :can_n...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/config.rb
Ruby
mit
92
main
14,045
# Class so that funds can set their own dropdown lists of things class Config < ApplicationRecord acts_as_tenant :fund # Concerns include PaperTrailable # Define overrides for particular config fields help text. HELP_TEXT_OVERRIDES = { resources_url: 'A link to a Google Drive folder with CM resources. '...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/fund.rb
Ruby
mit
92
main
692
class Fund < ApplicationRecord # TODO make papertrailable # Relations has_many :lines has_one :pledge_config # Validations validates :name, :subdomain, :domain, :full_name, :site_domain, :phone, presence: true validates :name, :subd...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/event.rb
Ruby
mit
92
main
905
# Object representing relevant actions taken by a case manager. class Event < ApplicationRecord acts_as_tenant :fund # Relations belongs_to :line encrypts :cm_name encrypts :patient_name # Enums enum :event_type, { reached_patient: 0, couldnt_reach_patient: 1, left_voicemail: 2, pledged...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/patient.rb
Ruby
mit
92
main
10,873
# Object representing core patient information and demographic data. class Patient < ApplicationRecord acts_as_tenant :fund # Concerns include PaperTrailable include Shareable include Callable include Notetakeable include PatientSearchable include AttributeDisplayable include LastMenstrualPeriodMeasu...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/external_pledge.rb
Ruby
mit
92
main
642
# Object representing money from organizations that aren't the fund or NAF. # For primary fund pledges or NAF pledges, see the patient model. class ExternalPledge < ApplicationRecord acts_as_tenant :fund # Concerns include PaperTrailable # Relationships belongs_to :can_pledge, polymorphic: true default_s...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/clinic.rb
Ruby
mit
92
main
2,617
# Object representing a clinic that a patient is going to. class Clinic < ApplicationRecord acts_as_tenant :fund # Concerns include PaperTrailable # Clinics intentionally excluded from ClinicFinder are assigned the zip 99999. # e.g. so a fund can have an 'OTHER CLINIC' catchall. EXCLUDED_ZIP = '99999' ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/call_list_entry.rb
Ruby
mit
92
main
310
# Object representing a patient's call list. class CallListEntry < ApplicationRecord acts_as_tenant :fund # Relationships belongs_to :user belongs_to :patient belongs_to :line # Validations validates :order_key, :line, presence: true validates_uniqueness_to_tenant :patient, scope: :user end
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/archived_patient.rb
Ruby
mit
92
main
4,636
# A PII stripped patient for reporting. class ArchivedPatient < ApplicationRecord acts_as_tenant :fund # Concerns include PaperTrailable include Exportable include LastMenstrualPeriodMeasureable # Relationships belongs_to :clinic, optional: true belongs_to :line has_one :fulfillment, as: :can_fulfil...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/fulfillment.rb
Ruby
mit
92
main
826
# Indicator that a pledge by the primary fund was cashed in, # which in turn indicates that the patient used our pledged money. class Fulfillment < ApplicationRecord acts_as_tenant :fund # Concerns include PaperTrailable # Relationships belongs_to :can_fulfill, polymorphic: true # Validations validates...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/note.rb
Ruby
mit
92
main
324
# A case manager's log of their interactions with a patient. class Note < ApplicationRecord acts_as_tenant :fund encrypts :full_text # Concerns include PaperTrailable # Relationships belongs_to :can_note, polymorphic: true # Validations validates :full_text, presence: true, length: { maximum: 4000 } ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/auth_factor.rb
Ruby
mit
92
main
1,136
# frozen_string_literal: true # An authentication factor used for multi factor authentication. class AuthFactor < ApplicationRecord include PaperTrailable cattr_accessor :form_steps do [:registration, :verification, :confirmation] end attr_accessor :current_form_step before_validation :clean_fields ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/call_listable.rb
Ruby
mit
92
main
2,714
# Methods relating to management of a user's call list module CallListable extend ActiveSupport::Concern # Someone is recently called if: # someone has a call from the current_user # that is less than 8 hours old, # AND they would otherwise be in the call list # (e.g. assigned to current line and in user.p...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/patient_searchable.rb
Ruby
mit
92
main
1,107
# Methods pertaining to patient search module PatientSearchable extend ActiveSupport::Concern DEFAULT_SEARCH_LIMIT = 15 class_methods do # Case insensitive and phone number format agnostic! # pass `search_limit: nil` for no limit. def search(name_or_phone_str, lines: nil, search_limit: DEFAULT_SEARC...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/last_menstrual_period_measureable.rb
Ruby
mit
92
main
1,393
# Methods pertaining to last menstrual period calculation module LastMenstrualPeriodMeasureable extend ActiveSupport::Concern def last_menstrual_period_at_appt_weeks return nil unless has_lmp? && appointment_date lmp = last_menstrual_period_on_date appointment_date (lmp / 7).to_i end def last_mens...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/pledgeable.rb
Ruby
mit
92
main
789
# Methods pertaining to pledges or pledge validation module Pledgeable extend ActiveSupport::Concern def pledge_info_present? pledge_info_presence errors.messages.present? end def pledge_info_errors errors.messages.values.flatten.uniq end private def updating_pledge_sent? pledge_sent =...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/exportable.rb
Ruby
mit
92
main
6,464
require 'csv' # Methods pertaining to patient export module Exportable extend ActiveSupport::Concern include ActionView::Helpers::NumberHelper CSV_EXPORT_FIELDS = { "BSON ID" => :id, # "Identifier" => :identifier, "Archived?" => :archived?, "Has Alt Contact?" => :has_alt_contact, "Voicemail ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/notetakeable.rb
Ruby
mit
92
main
382
# Methods relating to notes or parsing notes module Notetakeable extend ActiveSupport::Concern def most_recent_note_display_text note_text = most_recent_note.try(:full_text).to_s display_note = note_text[0..20] display_note << '…' if note_text.length > 21 display_note end def most_recent_note ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/paper_trailable.rb
Ruby
mit
92
main
470
# Custom PaperTrail class with a few convenience methods for pg models. module PaperTrailable extend ActiveSupport::Concern included do has_paper_trail versions: { class_name: 'PaperTrailVersion', scope: -> { order(id: :desc) } } end def created_by versions.last&.user ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/callable.rb
Ruby
mit
92
main
336
# Methods relating to calls or contacts module Callable extend ActiveSupport::Concern def recent_calls calls.includes(:versions).order('created_at DESC').limit(10) end def old_calls calls.includes(:versions).order('created_at DESC').offset(10) end def last_call calls.order(created_at: :desc)....
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/event_loggable.rb
Ruby
mit
92
main
503
# Allows models to have changed logged on create module EventLoggable extend ActiveSupport::Concern included do after_create -> { log_event(event_params) }, if: :call? after_update -> { log_event(event_params) }, if: :pledge_was_sent? end def log_event(params = {}) Event.create!(params) end ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/shareable.rb
Ruby
mit
92
main
731
# Methods pertaining to shared patients module Shareable extend ActiveSupport::Concern def still_shared? # Verify that a pregnancy has not been shared in the past six days return false if resolved_without_fund recent = versions.where('created_at > ?', Config.shared_reset_days.days.ago) return true ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/statusable.rb
Ruby
mit
92
main
2,460
# Methods pertaining to determining a patient's displayed status module Statusable extend ActiveSupport::Concern STATUSES = { no_contact: { key: I18n.t('patient.status.key.no_contact'), help_text: I18n.t('patient.status.help.no_contact')}, needs_appt: { key: I18n.t('patient.status.key.nee...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/models/concerns/attribute_displayable.rb
Ruby
mit
92
main
558
# Methods related to displaying attributes on the patient model module AttributeDisplayable extend ActiveSupport::Concern def primary_phone_display return nil unless primary_phone.present? "#{primary_phone[0..2]}-#{primary_phone[3..5]}-#{primary_phone[6..9]}" end def other_phone_display return nil...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/components/react_component.rb
Ruby
mit
92
main
464
# frozen_string_literal: true # Used for rendering React components in our Rails views class ReactComponent < ViewComponent::Base attr_reader :component, :raw_props def initialize(component, raw_props: {}) super @component = component @raw_props = raw_props end def call helpers.tag.div( ...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/lib/paper_trail_version.rb
Ruby
mit
92
main
2,527
# Extensions to base class of PaperTrail. class PaperTrailVersion < PaperTrail::Version acts_as_tenant :fund # Relations belongs_to :user, foreign_key: :whodunnit, optional: true IRRELEVANT_FIELDS = %w[ id user_ids updated_by_id pledge_sent_by_id last_edited_by_id identifier update...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/lib/twilio_verify_client.rb
Ruby
mit
92
main
1,183
# frozen_string_literal: true require 'rubygems' require 'twilio-ruby' # Help: https://www.twilio.com/docs/verify/quickstarts/totp class TwilioVerifyClient # For development these values can be found in the Twilio Console at https://console.twilio.com. TWILIO_ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID'] TWILIO_AUTH_...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/controllers/clinicfinders_controller.rb
Ruby
mit
92
main
1,052
# Controller for use with clinic_finder gem; locates nearest clinic # based on certain info. class ClinicfindersController < ApplicationController def search return head :bad_request if params[:zip].blank? gestation = calculate_gestation params filtered_clinics = Clinic.where.not(zip: [nil, '', Clinic::E...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/controllers/patients_controller.rb
Ruby
mit
92
main
10,058
# Create, edit, and update patients. The main patient view is edit. class PatientsController < ApplicationController include ActionController::Live before_action :confirm_admin_user, only: [:destroy] before_action :confirm_data_access, only: [:index] before_action :find_patient, if: :should_preload_patient_with...
github
DARIAEngineering/dcaf_case_management
https://github.com/DARIAEngineering/dcaf_case_management
app/controllers/practical_supports_controller.rb
Ruby
mit
92
main
1,916
# Create a non-monetary assistance record for a patient. class PracticalSupportsController < ApplicationController before_action :find_patient, only: [:create] before_action :find_support, only: [:edit, :update, :destroy] rescue_from ActiveRecord::RecordNotFound, with: -> { head :not_found } def ...