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 | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250401123606_remove_columns_from_account.rb | Ruby | mit | 47 | develop | 870 | class RemoveColumnsFromAccount < ActiveRecord::Migration[8.0]
def change
remove_column(:accounts, :twilio_account_sid, :citext)
remove_column(:accounts, :twilio_auth_token, :string)
remove_column(:accounts, :somleng_api_host, :string)
remove_column(:accounts, :somleng_api_base_url, :string)
remove... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20251201133031_add_devise_two_factor_to_users.rb | Ruby | mit | 47 | develop | 268 | class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[8.1]
def change
add_column :users, :otp_secret, :string
add_column :users, :consumed_timestep, :integer
add_column :users, :otp_required_for_login, :boolean, null: false, default: false
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20251201085855_add_created_by_started_by_stopped_by_to_broadcasts.rb | Ruby | mit | 47 | develop | 547 | class AddCreatedByStartedByStoppedByToBroadcasts < ActiveRecord::Migration[8.1]
def change
add_reference :broadcasts, :created_by, foreign_key: { to_table: :users, on_delete: :nullify }, null: true
add_reference :broadcasts, :started_by, foreign_key: { to_table: :users, on_delete: :nullify }, null: true
a... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250413063225_create_events.rb | Ruby | mit | 47 | develop | 258 | class CreateEvents < ActiveRecord::Migration[8.0]
def change
create_table :events do |t|
t.references :account, null: false, foreign_key: { on_delete: :cascade }
t.string :type, null: false, index: true
t.timestamps
end
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250109073858_update_address_name_to_citext.rb | Ruby | mit | 47 | develop | 620 | class UpdateAddressNameToCitext < ActiveRecord::Migration[8.0]
def change
change_column :beneficiary_addresses, :administrative_division_level_2_code, :citext
change_column :beneficiary_addresses, :administrative_division_level_2_name, :citext
change_column :beneficiary_addresses, :administrative_division... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20180609093900_add_somleng_api_host_and_somleng_api_base_url_to_accounts.rb | Ruby | mit | 47 | develop | 220 | class AddSomlengAPIHostAndSomlengAPIBaseURLToAccounts < ActiveRecord::Migration[5.2]
def change
add_column(:accounts, :somleng_api_host, :string)
add_column(:accounts, :somleng_api_base_url, :string)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20240307112427_create_recordings.rb | Ruby | mit | 47 | develop | 494 | class CreateRecordings < ActiveRecord::Migration[7.1]
def change
create_table :recordings do |t|
t.references :phone_call, null: false, foreign_key: true
t.references :account, null: false, foreign_key: true
t.references :contact, null: false, foreign_key: true
t.string :external_recording... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250103145109_add_beneficiary_phone_number_to_callout_participations.rb | Ruby | mit | 47 | develop | 1,008 | class AddBeneficiaryPhoneNumberToCalloutParticipations < ActiveRecord::Migration[8.0]
def up
say_with_time "Migrating on contacts" do
execute <<-SQL
UPDATE contacts
SET msisdn = REPLACE(msisdn, '+', '')
WHERE msisdn LIKE '+%';
SQL
end
# Allow null for now to migrate ex... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250331152154_remove_columns_from_delivery_attempts.rb | Ruby | mit | 47 | develop | 699 | class RemoveColumnsFromDeliveryAttempts < ActiveRecord::Migration[8.0]
def change
remove_column :delivery_attempts, :remote_direction, :string
remove_column :delivery_attempts, :remote_response, :jsonb, default: {}, null: false
remove_column :delivery_attempts, :remote_queue_response, :jsonb, default: {},... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250207081034_rename_contact_to_beneficiary.rb | Ruby | mit | 47 | develop | 324 | class RenameContactToBeneficiary < ActiveRecord::Migration[8.0]
def change
rename_table :contacts, :beneficiaries
rename_column :callout_participations, :contact_id, :beneficiary_id
rename_column :phone_calls, :contact_id, :beneficiary_id
rename_column :recordings, :contact_id, :beneficiary_id
end
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250412043529_create_broadcast_beneficiary_groups.rb | Ruby | mit | 47 | develop | 476 | class CreateBroadcastBeneficiaryGroups < ActiveRecord::Migration[8.0]
def change
create_table :broadcast_beneficiary_groups do |t|
t.references(:broadcast, null: false, foreign_key: { on_delete: :cascade }, index: false)
t.references(:beneficiary_group, null: false, foreign_key: { on_delete: :cascade ... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20171226101503_devise_invitable_add_to_users.rb | Ruby | mit | 47 | develop | 900 | class DeviseInvitableAddToUsers < ActiveRecord::Migration[5.1]
def up
change_table :users do |t|
t.string :invitation_token
t.datetime :invitation_created_at
t.datetime :invitation_sent_at
t.datetime :invitation_accepted_at
t.integer :invitation_limit
t.references... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20180604001322_add_permissions_to_access_tokens.rb | Ruby | mit | 47 | develop | 210 | class AddPermissionsToAccessTokens < ActiveRecord::Migration[5.2]
def change
add_column(
:oauth_access_tokens,
:permissions,
:bigint,
default: 0,
null: false
)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20240924122954_remove_phone_calls_and_contacts_count_from_accounts.rb | Ruby | mit | 47 | develop | 270 | class RemovePhoneCallsAndContactsCountFromAccounts < ActiveRecord::Migration[7.1]
def change
remove_column(:accounts, :contacts_count, :integer, default: 0, null: false)
remove_column(:accounts, :phone_calls_count, :integer, default: 0, null: false)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20180530200530_add_call_flow_logic_and_platform_provider_name_to_accounts.rb | Ruby | mit | 47 | develop | 223 | class AddCallFlowLogicAndPlatformProviderNameToAccounts < ActiveRecord::Migration[5.2]
def change
add_column(:accounts, :call_flow_logic, :string)
add_column(:accounts, :platform_provider_name, :string)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20171211071325_create_users.rb | Ruby | mit | 47 | develop | 1,301 | class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.references(:account, index: true, foreign_key: true, null: false)
t.jsonb(:metadata, null: false, default: {})
## Database authenticatable
t.string :email, null: false
t.string :enc... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250516005826_rename_alerts_to_notifications.rb | Ruby | mit | 47 | develop | 375 | class RenameAlertsToNotifications < ActiveRecord::Migration[8.0]
def change
rename_table :alerts, :notifications
rename_column :accounts, :max_delivery_attempts_for_alert, :max_delivery_attempts_for_notification
rename_column :accounts, :alert_phone_number, :notification_phone_number
rename_column :de... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250616074300_create_exports.rb | Ruby | mit | 47 | develop | 553 | class CreateExports < ActiveRecord::Migration[8.0]
def change
create_table :exports do |t|
t.string :name, null: false
t.references :user, null: false, foreign_key: { on_delete: :cascade }
t.references :account, null: false, foreign_key: { on_delete: :cascade }
t.string :resource_type, nul... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250331151106_remove_call_flow_logic.rb | Ruby | mit | 47 | develop | 385 | class RemoveCallFlowLogic < ActiveRecord::Migration[8.0]
def change
remove_column(:accounts, :call_flow_logic, :string)
remove_column(:alerts, :call_flow_logic, :string)
remove_column(:broadcasts, :call_flow_logic, :string)
remove_column(:delivery_attempts, :call_flow_logic, :string)
remove_column... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250221100342_add_status_to_alerts.rb | Ruby | mit | 47 | develop | 226 | class AddStatusToAlerts < ActiveRecord::Migration[8.0]
def change
add_column :alerts, :status, :string, null: false
add_index :alerts, :status
remove_column :alerts, :answered, :boolean, default: false
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20241211092117_create_beneficiary_addresses.rb | Ruby | mit | 47 | develop | 921 | class CreateBeneficiaryAddresses < ActiveRecord::Migration[8.0]
def change
create_table :beneficiary_addresses do |t|
t.references :beneficiary, null: false, foreign_key: { to_table: :contacts, on_delete: :cascade }
t.citext :iso_region_code
t.string :administrative_division_level_2_code
t... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250123085352_rename_msisdn_to_phone_number.rb | Ruby | mit | 47 | develop | 338 | class RenameMsisdnToPhoneNumber < ActiveRecord::Migration[8.0]
def change
rename_column :contacts, :msisdn, :phone_number
rename_column :phone_calls, :msisdn, :phone_number
rename_column :callout_participations, :beneficiary_phone_number, :phone_number
remove_column :callout_participations, :msisdn, ... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20181116004024_add_duration_to_phone_calls.rb | Ruby | mit | 47 | develop | 252 | class AddDurationToPhoneCalls < ActiveRecord::Migration[5.2]
def change
add_column(:remote_phone_call_events, :call_duration, :integer, null: false, default: 0)
add_column(:phone_calls, :duration, :integer, null: false, default: 0)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20170926070447_create_batch_operations.rb | Ruby | mit | 47 | develop | 388 | class CreateBatchOperations < ActiveRecord::Migration[5.1]
def change
create_table :batch_operations do |t|
t.references(:callout, index: true, foreign_key: true)
t.jsonb(:parameters, null: false, default: {})
t.jsonb(:metadata, null: false, default: {})
t.string(:status, null: false)
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20171213015809_add_account_id_to_batch_operations.rb | Ruby | mit | 47 | develop | 279 | class AddAccountIdToBatchOperations < ActiveRecord::Migration[5.1]
def up
change_table(:batch_operations) do |t|
t.references(:account, index: true, foreign_key: true, null: false)
end
end
def down
remove_reference(:batch_operations, :account)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20180618023959_add_not_null_on_call_flow_logic_columns.rb | Ruby | mit | 47 | develop | 346 | class AddNotNullOnCallFlowLogicColumns < ActiveRecord::Migration[5.2]
def change
change_column_null(:callouts, :call_flow_logic, false)
change_column_null(:callout_participations, :call_flow_logic, false)
change_column_null(:phone_calls, :call_flow_logic, false)
change_column_null(:accounts, :call_flo... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250624124359_add_index_on_notifications_on_status_created_at_broadcast_id.rb | Ruby | mit | 47 | develop | 237 | class AddIndexOnNotificationsOnStatusCreatedAtBroadcastId < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index(:notifications, [ :status, :created_at, :broadcast_id ], algorithm: :concurrently)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250704072626_change_foreign_key_constraint_on_invited_by_on_users.rb | Ruby | mit | 47 | develop | 239 | class ChangeForeignKeyConstraintOnInvitedByOnUsers < ActiveRecord::Migration[8.0]
def change
remove_foreign_key :users, column: :invited_by_id
add_foreign_key :users, :users, column: :invited_by_id, on_delete: :nullify
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20171213034649_update_index_contacts_on_msisdn.rb | Ruby | mit | 47 | develop | 300 | class UpdateIndexContactsOnMsisdn < ActiveRecord::Migration[5.1]
def up
remove_index(:contacts, :msisdn)
add_index(:contacts, %i[account_id msisdn], unique: true)
end
def down
remove_index(:contacts, %i[account_id msisdn])
add_index(:contacts, :msisdn, unique: true)
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250220070536_rename_phone_calls_to_delivery_attempts.rb | Ruby | mit | 47 | develop | 367 | class RenamePhoneCallsToDeliveryAttempts < ActiveRecord::Migration[8.0]
def change
rename_table :phone_calls, :delivery_attempts
rename_column :recordings, :phone_call_id, :delivery_attempt_id
rename_column :remote_phone_call_events, :phone_call_id, :delivery_attempt_id
rename_column :alerts, :phone_c... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20250617075644_add_index_on_delivery_attempts_on_id_and_lock_version.rb | Ruby | mit | 47 | develop | 244 | class AddIndexOnDeliveryAttemptsOnIdAndLockVersion < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index :delivery_attempts,
[ :id, :lock_version ],
algorithm: :concurrently
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | db/migrate/20241205142318_add_more_native_columns_to_contacts.rb | Ruby | mit | 47 | develop | 548 | class AddMoreNativeColumnsToContacts < ActiveRecord::Migration[8.0]
def change
change_table :contacts do |t|
t.string :status, null: false, default: 'active'
t.string :language_code
t.string :gender
t.date :date_of_birth
t.citext :iso_country_code
t.index [ :account_id, :statu... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/puma.rb | Ruby | mit | 47 | develop | 1,785 | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/application.rb | Ruby | mit | 47 | develop | 2,391 | require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_record/railtie"
require "active_storage/engine"
require "action_controller/railtie"
require "action_view/railtie"
require "action_mailer/railtie"
require "active_job/railtie"
require "action_cable/engine"
# require "sprockets/railt... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/routes.rb | Ruby | mit | 47 | develop | 3,658 | Rails.application.routes.draw do
constraints(AppSubdomainConstraint.new) do
devise_for(
:users,
controllers: { invitations: "users/invitations" },
skip: [ :invitations, :registrations ]
)
devise_scope(:user) do
resource(
:registration,
only: %i[edit update],
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/environments/test.rb | Ruby | mit | 47 | develop | 2,547 | require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data the... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/environments/development.rb | Ruby | mit | 47 | develop | 3,176 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for develop... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/environments/production.rb | Ruby | mit | 47 | develop | 4,539 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot for better performance and memory savings (ignored b... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/shoryuken.rb | Ruby | mit | 47 | develop | 885 | # Reduce the number of requests against SQS
# https://github.com/ruby-shoryuken/shoryuken/wiki/Shoryuken-options#cache_visibility_timeout
Shoryuken.cache_visibility_timeout = true
Shoryuken.configure_server do |config|
config.on(:startup) do
@server_pid = OkComputer::RackServer.run!
end
config.on(:shutdown)... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/content_security_policy.rb | Ruby | mit | 47 | develop | 1,315 | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/simple_form_bootstrap.rb | Ruby | mit | 47 | develop | 16,000 | # These defaults are defined and maintained by the community at
# https://github.com/heartcombo/simple_form-bootstrap
# Please submit feedback, changes and tests only there.
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/heartcombo/simple_form#custom-compon... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/filter_parameter_logging.rb | Ruby | mit | 47 | develop | 407 | # Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += %i... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/show_for.rb | Ruby | mit | 47 | develop | 2,082 | # Use this setup block to configure all options available in ShowFor.
ShowFor.setup do |config|
# The tag which wraps show_for calls.
config.show_for_tag = :div
# The DOM class set for show_for tag. Default is nil
config.show_for_class = :datagrid
# The tag which wraps each attribute/association call. Defau... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/new_framework_defaults_7_0.rb | Ruby | mit | 47 | develop | 7,847 | # Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/devise.rb | Ruby | mit | 47 | develop | 15,829 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
config.warden do |manager|
manager.default_strategies(:scope => :user).unshift :two_factor_authenticatable
end
# The secret key used by Devi... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/assets.rb | Ruby | mit | 47 | develop | 396 | # 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
Rails.application.config... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/inflections.rb | Ruby | mit | 47 | develop | 1,129 | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/simple_form.rb | Ruby | mit | 47 | develop | 6,903 | # frozen_string_literal: true
#
# Uncomment this and change the path if necessary to include your own
# components.
# See https://github.com/heartcombo/simple_form#custom-components to know
# more about custom components.
# Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }
#
# Use this setup block t... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/doorkeeper.rb | Ruby | mit | 47 | develop | 5,279 | Doorkeeper.configure do
# Change the ORM that doorkeeper will use (needs plugins)
orm :active_record
# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
fail "Please configure doorkeeper resource_owner_authenticator block located in #{__F... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/app_settings.rb | Ruby | mit | 47 | develop | 293 | class AppSettings
class << self
def app_uri
Addressable::URI.parse(fetch(:app_url_host))
end
def fetch(...)
config.fetch(...)
end
def [](...)
config.[](...)
end
private
def config
Rails.configuration.app_settings
end
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | config/initializers/mime_types.rb | Ruby | mit | 47 | develop | 319 | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
Mime::Type.register("audio/mpeg", :mp3)
Mime::Type.register(
"application/vnd.api+json",
:json,
%w[application/vnd.api+json text/x-json application/json]
) |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/invalid_request_schema_responder.rb | Ruby | mit | 47 | develop | 507 | require_relative "application_responder"
class InvalidRequestSchemaResponder < ApplicationResponder
def display(_resource, given_options = {})
controller.render(
given_options.merge!(options, format => json_resource_errors, status: :bad_request)
)
end
def json_resource_errors
serializer_class ... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/application_responder.rb | Ruby | mit | 47 | develop | 221 | class ApplicationResponder < ActionController::Responder
include Responders::FlashResponder
include Responders::HttpCacheResponder
self.error_status = :unprocessable_content
self.redirect_status = :see_other
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/jsonapi_pagination.rb | Ruby | mit | 47 | develop | 1,332 | class JSONAPIPagination
attr_reader :paginated_collection, :resources, :original_uri, :params, :pagination_options
def initialize(resources, original_url, **options)
@resources = resources
@original_uri = URI.parse(original_url)
@params = parse_params
@pagination_options = options.fetch(:pagination... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/jsonapi_responder.rb | Ruby | mit | 47 | develop | 1,431 | class JSONAPIResponder < ActionController::Responder
def display(resource, given_options = {})
serializer_class = options.delete(:serializer_class) || resource.jsonapi_serializer_class
decorator_class = options.key?(:decorator_class) ? options.fetch(:decorator_class) : resource.decorator_class
serializer_... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/simple_form_components/input_group.rb | Ruby | mit | 47 | develop | 565 | # custom component requires input group wrapper
module SimpleFormComponents
module InputGroup
def append(_wrapper_options = nil)
template.content_tag(:span, options[:append], class: "input-group-text")
end
def warning(_wrapper_options = nil)
return if options[:warning].blank?
template.... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/state_machine/machine.rb | Ruby | mit | 47 | develop | 1,871 | module StateMachine
class Machine
class InvalidStateTransitionError < StandardError; end
attr_reader :current_state
StateDefinition = Data.define(:name, :transitions_to, :initial)
Transition = Data.define(:name, :as)
class << self
def find(state)
state_definitions.find(-> { state_... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/state_machine/active_record.rb | Ruby | mit | 47 | develop | 970 | module StateMachine
class ActiveRecord < Machine
attr_reader :record
def initialize(record)
@record = record
super(record.status)
end
def transition_to(new_state, **options)
record.status = super(new_state).name
persist!(record.status, **options) if record.status_changed?
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/somleng/client.rb | Ruby | mit | 47 | develop | 1,093 | module Somleng
class Client
class RestError < StandardError; end
attr_reader :rest_client
def initialize(**options)
@rest_client = options.fetch(:rest_client) { Somleng::REST::Client.new(options.fetch(:account_sid), options.fetch(:auth_token)) }
end
def create_call(...)
make_request... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/somleng/request_validator.rb | Ruby | mit | 47 | develop | 583 | module Somleng
class RequestValidator
class InvalidSignatureError < StandardError; end
def validate_request(auth_token:, url:, params:, signature:)
raise InvalidSignatureError.new("Invalid signature: #{signature}") unless request_validator_for(auth_token).validate(url, params, signature)
end
d... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/somleng/parser/call_resource_parser.rb | Ruby | mit | 47 | develop | 436 | module Somleng
module Parser
class CallResourceParser
def parse(response)
Somleng::Resource.new(
sid: response.sid,
to: response.to,
from: response.from,
account_sid: response.account_sid,
status: response.status,
call_duration: (response.d... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/somleng/parser/message_resource_parser.rb | Ruby | mit | 47 | develop | 388 | module Somleng
module Parser
class MessageResourceParser
def parse(response)
Somleng::Resource.new(
sid: response.sid,
to: response.to,
from: response.from,
account_sid: response.account_sid,
status: response.status,
call_duration: nil,
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/somleng/parser/message_status_callback_parser.rb | Ruby | mit | 47 | develop | 446 | module Somleng
module Parser
class MessageStatusCallbackParser
def parse(payload)
Somleng::Resource.new(
sid: payload.fetch("MessageSid"),
to: payload.fetch("To"),
from: payload.fetch("From"),
account_sid: payload.fetch("AccountSid"),
status: payload... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/somleng/parser/call_status_callback_parser.rb | Ruby | mit | 47 | develop | 497 | module Somleng
module Parser
class CallStatusCallbackParser
def parse(payload)
Somleng::Resource.new(
sid: payload.fetch("CallSid"),
to: payload.fetch("To"),
from: payload.fetch("From"),
account_sid: payload.fetch("AccountSid"),
status: payload.fetch... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/somleng/rest/api.rb | Ruby | mit | 47 | develop | 211 | module Somleng
module REST
class API < Twilio::REST::Api
def initialize(...)
super
@base_url = "https://api.somleng.org"
@host = "api.somleng.org"
end
end
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/jsonapi/include_parameter_parser.rb | Ruby | mit | 47 | develop | 371 | module JSONAPI
class IncludeParameterParser
class Parser
attr_reader :query_parameters
def initialize(query_parameters)
@query_parameters = query_parameters
end
def parse
query_parameters.fetch(:include, "").split(/,\s*/).reject(&:blank?)
end
end
def parse(... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | lib/ok_computer/rack_server.rb | Ruby | mit | 47 | develop | 452 | module OkComputer
module RackServer
def self.run!(port: 3000)
require "rack/handler/puma"
fork do
handler = Rack::Handler::Puma
handler.run(self, Port: port, Threads: "1:3", workers: 0)
end
end
def self.call(_env)
checks = OkComputer::Registry.all
checks.run... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/errors_controller.rb | Ruby | mit | 47 | develop | 307 | class ErrorsController < ActionController::Base
STATUS_CODES = %w[400 404 406 500].freeze
def show
status_code = params[:status_code].to_i
respond_to do |format|
format.html { render status: status_code, locals: { status_code: } }
format.any { head status_code }
end
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/application_controller.rb | Ruby | mit | 47 | develop | 686 | class ApplicationController < ActionController::Base
allow_browser versions: :modern, block: :handle_outdated_browser
respond_to :html
before_action :configure_permitted_parameters, if: :devise_controller?
protect_from_forgery with: :exception
helper_method :current_account
helper_method :app_request
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard_controller.rb | Ruby | mit | 47 | develop | 1,120 | class DashboardController < ApplicationController
self.responder = ApplicationResponder
include DashboardTheme
layout "dashboard"
before_action :authenticate_user!, :set_locale
before_action :authorize_account!
before_action :enforce_two_factor_authentication!
helper_method :current_account
private... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/somleng_webhooks_controller.rb | Ruby | mit | 47 | develop | 745 | class SomlengWebhooksController < ApplicationController
skip_forgery_protection
before_action :verify_signature
rescue_from Somleng::RequestValidator::InvalidSignatureError, with: :invalid_signature
private
def verify_signature
request_validator.validate_request(
auth_token:,
url: request.... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api_controller.rb | Ruby | mit | 47 | develop | 2,140 | class APIController < ActionController::API
self.responder = JSONAPIResponder
respond_to :json
before_action :verify_requested_format!
before_action :doorkeeper_authorize!
rescue_from StatsQuery::TooManyResultsError do
render json: { errors: [ { title: "Too many results" } ] }, status: :bad_request
e... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/events_controller.rb | Ruby | mit | 47 | develop | 312 | module API
module V1
class EventsController < APIController
def index
apply_filters(scope, with: EventFilter)
end
def show
respond_with_resource(scope.find(params[:id]))
end
private
def scope
current_account.events
end
end
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/broadcasts_controller.rb | Ruby | mit | 47 | develop | 905 | module API
module V1
class BroadcastsController < APIController
def index
apply_filters(scope.includes(include_parameter(only: [ :beneficiary_groups ])), with: BroadcastFilter)
end
def show
respond_with_resource(scope.find(params[:id]))
end
def create
valida... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/beneficiary_groups_controller.rb | Ruby | mit | 47 | develop | 1,084 | module API
module V1
class BeneficiaryGroupsController < APIController
def index
apply_filters(scope.includes(include_parameter(only: :members)), with: BeneficiaryGroupFilter)
end
def show
respond_with_resource(scope.find(params[:id]))
end
def create
validat... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/beneficiaries_controller.rb | Ruby | mit | 47 | develop | 1,127 | module API
module V1
class BeneficiariesController < APIController
def index
apply_filters(scope.includes(include_parameter(only: [ :addresses, :groups ])), with: BeneficiaryFilter)
end
def show
respond_with_resource(scope.find(params[:id]))
end
def create
v... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/addresses_controller.rb | Ruby | mit | 47 | develop | 903 | module API
module V1
class AddressesController < APIController
def index
respond_with_resource(beneficiary.addresses)
end
def create
validate_request_schema(
with: ::V1::BeneficiaryAddressRequestSchema,
schema_options: { beneficiary: },
location: ->... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/beneficiaries/stats_controller.rb | Ruby | mit | 47 | develop | 960 | module API
module V1
module Beneficiaries
class StatsController < APIController
def index
validate_request_schema(
with: ::V1::BeneficiaryStatsRequestSchema,
serializer_class: StatSerializer,
**serializer_options
) do |permitted_params|
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/events/stats_controller.rb | Ruby | mit | 47 | develop | 729 | module API
module V1
module Events
class StatsController < APIController
def index
validate_request_schema(
with: ::V1::EventStatsRequestSchema,
serializer_class: StatSerializer,
**serializer_options
) do |permitted_params|
StatsQ... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/broadcasts/notifications_controller.rb | Ruby | mit | 47 | develop | 576 | module API
module V1
module Broadcasts
class NotificationsController < APIController
def index
apply_filters(notifications_scope, with: NotificationFilter)
end
def show
notification = notifications_scope.find(params[:id])
respond_with_resource(notificat... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/broadcasts/audio_files_controller.rb | Ruby | mit | 47 | develop | 505 | module API
module V1
module Broadcasts
class AudioFilesController < APIController
include ActiveStorage::SetCurrent
def show
if broadcast.audio_file.attached?
redirect_to broadcast.audio_file.url, allow_other_host: true
else
head :not_acceptable
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/broadcasts/notifications/stats_controller.rb | Ruby | mit | 47 | develop | 977 | module API
module V1
module Broadcasts
module Notifications
class StatsController < APIController
def index
validate_request_schema(
with: ::V1::NotificationStatsRequestSchema,
serializer_class: StatSerializer,
**serializer_options
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/beneficiary_groups/members_controller.rb | Ruby | mit | 47 | develop | 1,086 | module API
module V1
module BeneficiaryGroups
class MembersController < APIController
def index
apply_filters(scope, with: BeneficiaryFilter)
end
def show
respond_with_resource(scope.find(params[:id]))
end
def create
validate_request_sc... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/api/v1/beneficiary_groups/members/stats_controller.rb | Ruby | mit | 47 | develop | 958 | module API
module V1
module BeneficiaryGroups
module Members
class StatsController < APIController
def index
validate_request_schema(
with: ::V1::BeneficiaryStatsRequestSchema,
serializer_class: StatSerializer,
**serializer_options
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/concerns/dashboard_theme.rb | Ruby | mit | 47 | develop | 220 | module DashboardTheme
extend ActiveSupport::Concern
included do
before_action :set_theme
end
private
def set_theme
cookies[:theme] = params.fetch(:theme) { cookies.fetch(:theme, "light") }
end
end |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/somleng_webhooks/call_status_callbacks_controller.rb | Ruby | mit | 47 | develop | 401 | module SomlengWebhooks
class CallStatusCallbacksController < SomlengWebhooksController
def create
ExecuteWorkflowJob.perform_later(
HandleStatusCallback.to_s,
delivery_attempt_id: params.fetch(:delivery_attempt_id),
params: request.request_parameters,
parser: Somleng::Parser:... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/somleng_webhooks/message_status_callbacks_controller.rb | Ruby | mit | 47 | develop | 407 | module SomlengWebhooks
class MessageStatusCallbacksController < SomlengWebhooksController
def create
ExecuteWorkflowJob.perform_later(
HandleStatusCallback.to_s,
delivery_attempt_id: params.fetch(:delivery_attempt_id),
params: request.request_parameters,
parser: Somleng::Pars... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/users/registrations_controller.rb | Ruby | mit | 47 | develop | 407 | module Users
class RegistrationsController < Devise::RegistrationsController
layout "dashboard"
before_action :set_locale
helper_method :current_account
protected
def current_account
current_user.account
end
def after_update_path_for(_resource)
edit_user_registration_path
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/users/forgot_subdomain_controller.rb | Ruby | mit | 47 | develop | 535 | module Users
class ForgotSubdomainController < ApplicationController
layout "devise"
def new
@resource = ForgotSubdomainForm.new
end
def create
@resource = ForgotSubdomainForm.new(permitted_params)
if @resource.save
flash[:notice] = "You will receive an email with login ins... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/exports_controller.rb | Ruby | mit | 47 | develop | 600 | module Dashboard
class ExportsController < DashboardController
def index
@exports = paginate_resources(scope)
end
def create
ExportForm.new(user: current_user, **permitted_params).save!
flash[:notice] = t("flash.dashboard.exports.create.notice_html", exports_path: helpers.link_to("Expo... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/imports_controller.rb | Ruby | mit | 47 | develop | 885 | module Dashboard
class ImportsController < DashboardController
def index
@imports = paginate_resources(scope)
end
def create
@import = build_import
if @import.save
ExecuteWorkflowJob.perform_later(ImportCSV.to_s, @import)
flash[:notice] = "Your import is being processed.... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/alerts_controller.rb | Ruby | mit | 47 | develop | 1,616 | module Dashboard
class AlertsController < DashboardController
Badge = Data.define(:color, :icon)
before_action :authorize_feature_flag
helper_method :alert_badge
def index
@alerts = FakeResource::Alert.all
end
def new
@alert = FakeResource::Alert.first
end
def create
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/notifications_controller.rb | Ruby | mit | 47 | develop | 471 | module Dashboard
class NotificationsController < DashboardController
def index
@filter_form = NotificationFilterForm.new(filter_param)
@notifications = paginate_resources(@filter_form.apply(scope))
end
def show
@notification = scope.find(params[:id])
end
private
def scope
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/two_factor_authentications_controller.rb | Ruby | mit | 47 | develop | 647 | module Dashboard
class TwoFactorAuthenticationsController < DashboardController
skip_before_action :enforce_two_factor_authentication!
def new
@resource = TwoFactorAuthenticationForm.new
end
def create
@resource = TwoFactorAuthenticationForm.new(permitted_params)
@resource.user = c... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/user_profiles_controller.rb | Ruby | mit | 47 | develop | 437 | module Dashboard
class UserProfilesController < DashboardController
def show
@user = current_user
end
def update
@user = current_user
if @user.update(permitted_params)
respond_with(@user, location: dashboard_user_profile_path)
else
render :show
end
end
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/beneficiaries_controller.rb | Ruby | mit | 47 | develop | 1,590 | module Dashboard
class BeneficiariesController < DashboardController
def index
@filter_form = BeneficiaryFilterForm.new(filter_param)
@beneficiaries = paginate_resources(@filter_form.apply(scope))
end
def new
@beneficiary = scope.new
end
def create
@beneficiary = scope.ne... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/beneficiary_groups_controller.rb | Ruby | mit | 47 | develop | 1,116 | module Dashboard
class BeneficiaryGroupsController < DashboardController
def index
@filter_form = BeneficiaryGroupFilterForm.new(filter_param)
@beneficiary_groups = paginate_resources(@filter_form.apply(scope))
end
def new
@beneficiary_group = scope.new
end
def create
@be... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/broadcasts_controller.rb | Ruby | mit | 47 | develop | 1,360 | module Dashboard
class BroadcastsController < DashboardController
def index
@filter_form = BroadcastFilterForm.new(filter_param)
@broadcasts = paginate_resources(@filter_form.apply(scope))
end
def new
@broadcast = BroadcastForm.new(account: current_account)
end
def create
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/broadcasts/states_controller.rb | Ruby | mit | 47 | develop | 556 | module Dashboard
module Broadcasts
class StatesController < DashboardController
def create
@broadcast = current_account.broadcasts.find(params[:broadcast_id])
broadcast_state_machine = BroadcastStateMachine.new(@broadcast.status)
UpdateBroadcast.call(
@broadcast,
... |
github | open-ews/open-ews | https://github.com/open-ews/open-ews | app/controllers/dashboard/beneficiary_groups/memberships_controller.rb | Ruby | mit | 47 | develop | 553 | module Dashboard
module BeneficiaryGroups
class MembershipsController < DashboardController
def index
@filter_form = BeneficiaryGroupMembershipFilterForm.new(filter_param)
@memberships = paginate_resources(
@filter_form.apply(scope).includes(:beneficiary)
)
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.