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
somleng/somleng
https://github.com/somleng/somleng
app/forms/sms_gateway_form.rb
Ruby
mit
95
develop
1,067
class SMSGatewayForm include ActiveModel::Model include ActiveModel::Attributes attribute :carrier attribute :sms_gateway, default: -> { SMSGateway.new } attribute :max_channels attribute :name attribute :default_sender, PhoneNumberType.new validates :name, presence: true validates :max_channels, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/tariff_calculator_form.rb
Ruby
mit
95
develop
260
class TariffCalculatorForm < ApplicationForm attribute :tariff_plan attribute :destination attribute :tariff_calculator, default: -> { TariffCalculator.new } def result @result ||= tariff_calculator.calculate(tariff_plan:, destination:) end end
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/phone_number_plan_form.rb
Ruby
mit
95
develop
538
class PhoneNumberPlanForm include ActiveModel::Model include ActiveModel::Attributes attribute :phone_number attribute :account attribute :phone_number_plan, default: -> { PhoneNumberPlan.new } delegate :persisted?, :new_record?, :id, to: :phone_number_plan delegate :id, to: :phone_number, prefix: true ...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/tariff_package_plan_form.rb
Ruby
mit
95
develop
422
class TariffPackagePlanForm < TariffPlanAssignmentForm attribute :package attribute :object, default: -> { TariffPackagePlan.new } delegate :carrier, to: :package def self.model_name ActiveModel::Name.new(self, nil, "TariffPackagePlan") end def self.initialize_with(object) form = super form.p...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/tariff_plan_assignment_form.rb
Ruby
mit
95
develop
1,036
class TariffPlanAssignmentForm < ApplicationForm attribute :id attribute :plan_id attribute :category attribute :enabled, :boolean, default: false validates :plan_id, presence: true, if: ->(form) { form.enabled? } enumerize :category, in: TariffSchedule.category.values, value_class: TariffScheduleCategory...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/destination_group_form.rb
Ruby
mit
95
develop
1,561
class DestinationGroupForm < ApplicationForm attribute :carrier attribute :catch_all, :boolean, default: false attribute :object, default: -> { DestinationGroup.new } attribute :name attribute :prefixes, RoutePrefixesType.new, default: [] validates :name, :prefixes, presence: true, unless: :catch_all val...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/carrier_settings_form.rb
Ruby
mit
95
develop
3,658
class CarrierSettingsForm include ActiveModel::Model include ActiveModel::Attributes COUNTRIES = ISO3166::Country.all.map(&:alpha2).freeze class HostnameValidator < ActiveModel::EachValidator RESTRICTED_DOMAINS = [ AppSettings.app_uri.domain ].freeze def validate_each(record, attribute, val...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/destination_tariff_form.rb
Ruby
mit
95
develop
2,406
class DestinationTariffForm < ApplicationForm attribute :id attribute :object, default: -> { DestinationTariff.new } attribute :schedule attribute :destination_group_id attribute :rate attribute :currency attribute :_destroy, :boolean, default: false validates :destination_group_id, presence: true, if:...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/incoming_phone_number_form.rb
Ruby
mit
95
develop
2,435
class IncomingPhoneNumberForm include ActiveModel::Model include ActiveModel::Attributes extend Enumerize attribute :friendly_name attribute :voice_url attribute :voice_method attribute :status_callback_url attribute :status_callback_method attribute :sip_domain attribute :messaging_service_id at...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/tariff_plan_form.rb
Ruby
mit
95
develop
2,257
class TariffPlanForm < ApplicationForm attribute :carrier attribute :category attribute :object, default: -> { TariffPlan.new } attribute :name attribute :description attribute :tiers attribute :tiers, FormCollectionType.new(form: TariffPlanTierForm), default: [] enumerize :cat...
github
somleng/somleng
https://github.com/somleng/somleng
app/forms/messaging_service_form.rb
Ruby
mit
95
develop
4,413
class MessagingServiceForm include ActiveModel::Model include ActiveModel::Attributes extend Enumerize INBOUND_MESSAGE_BEHAVIORS = { defer_to_sender: "Defer to sender's webhook <div class='form-text'>Invoke the sender's HTTP webhook (if it is defined) for incoming messages.</div>", drop: "Drop the mess...
github
somleng/somleng
https://github.com/somleng/somleng
app/mailers/error_log_mailer.rb
Ruby
mit
95
develop
387
class ErrorLogMailer < ApplicationMailer helper ApplicationHelper layout "carrier_mailer" def notify(error_log:) @error_log = error_log @carrier = error_log.carrier @host = @carrier.account_host bootstrap_mail( to: error_log.notifications.pluck(:email), subject: "#{@carrier.name} - N...
github
somleng/somleng
https://github.com/somleng/somleng
app/mailers/devise_mailer.rb
Ruby
mit
95
develop
379
class DeviseMailer < Devise::Mailer layout "carrier_mailer" helper ApplicationHelper private def devise_mail(record, action, opts = {}, &block) initialize_from_record(record) @carrier = record.carrier @host = record.carrier_user? ? record.carrier.subdomain_host : record.carrier.account_host b...
github
somleng/somleng
https://github.com/somleng/somleng
app/mailers/forgot_subdomain_mailer.rb
Ruby
mit
95
develop
213
class ForgotSubdomainMailer < ApplicationMailer def forgot_subdomain(email:, carriers:) @email = email @carriers = carriers bootstrap_mail(to: email, subject: "Somleng - Forgot Subdomain") end end
github
somleng/somleng
https://github.com/somleng/somleng
app/sample_data/fake_resource/broadcast.rb
Ruby
mit
95
develop
6,821
module FakeResource class Broadcast include ActiveModel::Model include ActiveModel::Attributes extend Enumerize attribute :id attribute :channel attribute :status attribute :broadcaster attribute :headline attribute :message attribute :started_by attribute :completed_by ...
github
somleng/somleng
https://github.com/somleng/somleng
app/helpers/application_helper.rb
Ruby
mit
95
develop
537
module ApplicationHelper def carrier_logo(carrier, options = {}) if carrier&.logo&.attached? image_tag(carrier.logo, options.reverse_merge(alt: carrier.name)) else image_tag("placeholder_logo.png", options) end end def carrier_favicon_url(carrier) if carrier&.favicon&.attached? ...
github
somleng/somleng
https://github.com/somleng/somleng
app/helpers/dashboard_helper.rb
Ruby
mit
95
develop
4,061
module DashboardHelper def user_profile_image_url(user) user_email = Digest::MD5.hexdigest(user.email) "https://www.gravatar.com/avatar/#{user_email}?size=200" end def page_title(title:, &block) content_for(:page_title, title) content_tag(:div, class: "card-header d-flex justify-content-between ...
github
somleng/somleng
https://github.com/somleng/somleng
app/helpers/tariff_helper.rb
Ruby
mit
95
develop
3,092
module TariffHelper def destination_tariff_diagram(destination_tariff) category = destination_tariff.schedule.category destination_group = link_to( truncate(destination_tariff.destination_group_name, length: 10), dashboard_destination_group_path(destination_tariff.destination_group_id) ) t...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/available_phone_number_filter.rb
Ruby
mit
95
develop
285
class AvailablePhoneNumberFilter < ResourceFilter filter_with( :phone_number_type_filter, :area_code_filter, :region_filter, :locality_filter, { country_filter: { attribute_name: :iso_country_code } }, :number_filter, :lata_and_rate_center_filter ) end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/destination_group_filter.rb
Ruby
mit
95
develop
359
class DestinationGroupFilter < ResourceFilter class NameFilter < ApplicationFilter filter_params do optional(:name).value(:string) end def apply return super if filter_params.blank? FuzzySearch.new(super, column: :name).apply(filter_params.fetch(:name)) end end filter_with( ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/tariff_plan_filter.rb
Ruby
mit
95
develop
1,003
class TariffPlanFilter < ResourceFilter class CategoryFilter < ApplicationFilter filter_params do optional(:category).value(:string, included_in?: TariffSchedule.category.values) end def apply return super if filter_params.blank? super.where(category: filter_params.fetch(:category)) ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/resource_filter.rb
Ruby
mit
95
develop
768
class ResourceFilter < ApplicationFilter class_attribute :filters def self.filter_with(*args) self.filters = args end def apply filters.inject(super) do |result, filter| initialize_filter(filter, result).apply end end private def initialize_filter(filter, result) filter_options =...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/balance_transaction_filter.rb
Ruby
mit
95
develop
778
class BalanceTransactionFilter < ResourceFilter class TypeFilter < ApplicationFilter filter_params do optional(:type).value(:string, included_in?: BalanceTransaction.type.values) end def apply return super if filter_params.blank? super.where(type: filter_params.fetch(:type)) end ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/tariff_schedule_filter.rb
Ruby
mit
95
develop
1,339
class TariffScheduleFilter < ResourceFilter class CategoryFilter < ApplicationFilter filter_params do optional(:category).value(:string, included_in?: TariffSchedule.category.values) end def apply return super if filter_params.blank? super.where(category: filter_params.fetch(:category)...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/event_filter.rb
Ruby
mit
95
develop
636
class EventFilter < ResourceFilter class TypeFilter < ApplicationFilter filter_params do optional(:type).value(:string, included_in?: Event.type.values) end def apply return super if filter_params.blank? super.where(type: filter_params.fetch(:type)) end end class MessageIDFilt...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/error_log_filter.rb
Ruby
mit
95
develop
385
class ErrorLogFilter < ResourceFilter class TypeFilter < ApplicationFilter filter_params do optional(:type).value(:string, included_in?: ErrorLog.type.values) end def apply return super if filter_params.blank? super.where(type: filter_params.fetch(:type)) end end filter_with( ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/incoming_phone_number_filter.rb
Ruby
mit
95
develop
477
class IncomingPhoneNumberFilter < ResourceFilter class StatusFilter < ApplicationFilter filter_params do optional(:status).value(:string, included_in?: IncomingPhoneNumber.status.values) end def apply return super if filter_params.blank? super.where(status: filter_params.fetch(:status)...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/phone_number_plan_filter.rb
Ruby
mit
95
develop
431
class PhoneNumberPlanFilter < ResourceFilter class StatusFilter < ApplicationFilter filter_params do optional(:status).value(:string, included_in?: PhoneNumberPlan.status.values) end def apply return super if filter_params.blank? super.where(status: filter_params.fetch(:status)) en...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/tariff_package_filter.rb
Ruby
mit
95
develop
662
class TariffPackageFilter < ResourceFilter class NameFilter < ApplicationFilter filter_params do optional(:name).value(:string) end def apply return super if filter_params.blank? FuzzySearch.new(super, column: :name).apply(filter_params.fetch(:name)) end end class TariffPlanID...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/account_filter.rb
Ruby
mit
95
develop
1,769
class AccountFilter < ResourceFilter class StatusFilter < ApplicationFilter filter_params do optional(:status).value(:string, included_in?: Account.status.values) end def apply return super if filter_params.blank? super.where(status: filter_params.fetch(:status)) end end class...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/application_filter.rb
Ruby
mit
95
develop
770
class ApplicationFilter attr_reader :resources_scope, :input_params, :scoped_to, :options class_attribute :filter_schema, :options def self.filter_params(&block) self.filter_schema = Dry::Validation.Contract do params do optional(:filter).schema(&block) end end end def initializ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/message_filter.rb
Ruby
mit
95
develop
515
class MessageFilter < ResourceFilter class StatusFilter < ApplicationFilter filter_params do optional(:status).value(:string, included_in?: MessageDecorator.statuses) end def apply return super if filter_params.blank? super.where( status: MessageDecorator.status_from(filter_par...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/webhook_request_log_filter.rb
Ruby
mit
95
develop
586
class WebhookRequestLogFilter < ResourceFilter class FailedFilter < ApplicationFilter filter_params do optional(:failed).value(:bool) end def apply return super if filter_params.blank? super.where(failed: filter_params.fetch(:failed)) end end class EventFilter < ApplicationFil...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/verification_filter.rb
Ruby
mit
95
develop
869
class VerificationFilter < ResourceFilter class VerificationServiceIDFilter < ApplicationFilter filter_params do optional(:verification_service_id).value(:string) end def apply return super if filter_params.blank? super.where(verification_service_id: filter_params.fetch(:verification_s...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/phone_call_filter.rb
Ruby
mit
95
develop
505
class PhoneCallFilter < ResourceFilter class StatusFilter < ApplicationFilter filter_params do optional(:status).value(:string, included_in?: PhoneCallDecorator.statuses) end def apply return super if filter_params.blank? super.where(status: PhoneCallDecorator.status_from(filter_params...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/phone_number_filter.rb
Ruby
mit
95
develop
930
class PhoneNumberFilter < ResourceFilter class AssignedFilter < ApplicationFilter filter_params do optional(:assigned).value(:bool) end def apply return super if filter_params.blank? if filter_params.fetch(:assigned) super.assigned else super.unassigned end ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/sms_gateway_channel_group_filter.rb
Ruby
mit
95
develop
382
class SMSGatewayChannelGroupFilter < ResourceFilter class SMSGatewayFilter < ApplicationFilter filter_params do optional(:sms_gateway_id).value(:string) end def apply return super if filter_params.blank? super.where(sms_gateway_id: filter_params.fetch(:sms_gateway_id)) end end ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/lata_and_rate_center_filter.rb
Ruby
mit
95
develop
574
module AttributeFilter class LATAAndRateCenterFilter < ApplicationFilter filter_params do optional(:lata).value(:string) optional(:rate_center).value(:string) end def apply return super if filter_params.blank? return super if filter_params[:rate_center].present? && filter_params[:...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/area_code_filter.rb
Ruby
mit
95
develop
276
module AttributeFilter class AreaCodeFilter < ApplicationFilter filter_params do optional(:area_code).value(:string) end def apply return super if filter_params.blank? super.where(area_code: filter_params.fetch(:area_code)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/from_filter.rb
Ruby
mit
95
develop
289
module AttributeFilter class FromFilter < ApplicationFilter filter_params do optional(:from).value(ApplicationRequestSchema::Types::Number) end def apply return super if filter_params.blank? super.where(from: filter_params.fetch(:from)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/number_filter.rb
Ruby
mit
95
develop
297
module AttributeFilter class NumberFilter < ApplicationFilter filter_params do optional(:number).value(ApplicationRequestSchema::Types::Number) end def apply return super if filter_params.blank? super.where(number: filter_params.fetch(:number)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/to_filter.rb
Ruby
mit
95
develop
281
module AttributeFilter class ToFilter < ApplicationFilter filter_params do optional(:to).value(ApplicationRequestSchema::Types::Number) end def apply return super if filter_params.blank? super.where(to: filter_params.fetch(:to)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/id_filter.rb
Ruby
mit
95
develop
249
module AttributeFilter class IDFilter < ApplicationFilter filter_params do optional(:id).value(:string) end def apply return super if filter_params.blank? super.where(id: filter_params.fetch(:id)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/name_filter.rb
Ruby
mit
95
develop
321
module AttributeFilter class NameFilter < ApplicationFilter filter_params do optional(:name).value(:string) end def apply return super if filter_params.blank? arel_table = super.arel_table super.where(arel_table[:name].matches("%#{filter_params.fetch(:name)}%")) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/date_filter.rb
Ruby
mit
95
develop
465
module AttributeFilter class DateFilter < ApplicationFilter filter_params do optional(:from_date).value(:time) optional(:to_date).value(:time) end def apply date_range = DateRange.new( from_date: filter_params[:from_date], to_date: filter_params[:to_date] ) ...
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/account_id_filter.rb
Ruby
mit
95
develop
280
module AttributeFilter class AccountIDFilter < ApplicationFilter filter_params do optional(:account_id).value(:string) end def apply return super if filter_params.blank? super.where(account_id: filter_params.fetch(:account_id)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/locality_filter.rb
Ruby
mit
95
develop
273
module AttributeFilter class LocalityFilter < ApplicationFilter filter_params do optional(:locality).value(:string) end def apply return super if filter_params.blank? super.where(locality: filter_params.fetch(:locality)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/phone_number_type_filter.rb
Ruby
mit
95
develop
307
module AttributeFilter class PhoneNumberTypeFilter < ApplicationFilter filter_params do optional(:type).value(:string, included_in?: PhoneNumber.type.values) end def apply return super if filter_params.blank? super.where(type: filter_params.fetch(:type)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/region_filter.rb
Ruby
mit
95
develop
274
module AttributeFilter class RegionFilter < ApplicationFilter filter_params do optional(:region).value(:string) end def apply return super if filter_params.blank? super.where(iso_region_code: filter_params.fetch(:region)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/phone_call_id_filter.rb
Ruby
mit
95
develop
291
module AttributeFilter class PhoneCallIDFilter < ApplicationFilter filter_params do optional(:phone_call_id).value(:string) end def apply return super if filter_params.blank? super.where(phone_call_id: filter_params.fetch(:phone_call_id)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/filters/attribute_filter/country_filter.rb
Ruby
mit
95
develop
309
module AttributeFilter class CountryFilter < ApplicationFilter filter_params do optional(:country).value(:string) end def apply return super if filter_params.blank? super.where(options.fetch(:attribute_name, :country_code) => filter_params.fetch(:country)) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/incoming_phone_number_policy.rb
Ruby
mit
95
develop
222
class IncomingPhoneNumberPolicy < ApplicationPolicy def manage? record.active? && (account_admin? || carrier_managed?) end private def carrier_managed? carrier_admin? && record.carrier_managed? end end
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/account_policy.rb
Ruby
mit
95
develop
359
class AccountPolicy < ApplicationPolicy delegate :carrier_managed?, :customer_managed?, to: :record def read? user.carrier_user? end def show_auth_token? read? && carrier_managed? end def manage? carrier_admin? end def destroy? super && carrier_managed? && !record.messages.exists? &&...
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/application_policy.rb
Ruby
mit
95
develop
913
class ApplicationPolicy attr_reader :user, :record def initialize(user, record = nil) @user = user @record = record end def index? read? end def show? index? end def new? create? end def edit? update? end def destroy? manage? end def create? manage? e...
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/two_factor_authentication_policy.rb
Ruby
mit
95
develop
543
class TwoFactorAuthenticationPolicy < ApplicationPolicy def create? !user.otp_required_for_login? end def destroy? manage_record? end private def manage_record? return false if user.id == record.id return false unless record.otp_required_for_login? return carrier_users.exists?(record....
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/carrier_user_policy.rb
Ruby
mit
95
develop
276
class CarrierUserPolicy < ApplicationPolicy def read? managing_carrier? end def destroy? super && manage_record? end def update? destroy? end def manage? carrier_owner? end private def manage_record? record.id != user.id end end
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/verification_service_policy.rb
Ruby
mit
95
develop
298
class VerificationServicePolicy < ApplicationPolicy def index? true end def create? carrier_admin? || account_admin? end def manage? account_admin? || carrier_managed? end private def carrier_managed? carrier_admin? && record.account&.carrier_managed? end end
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/account_membership_policy.rb
Ruby
mit
95
develop
287
class AccountMembershipPolicy < ApplicationPolicy def destroy? super && manage_record? end def update? destroy? end def manage? account_owner? end def read? managing_account? end private def manage_record? record.user_id != user.id end end
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/user_invitation_policy.rb
Ruby
mit
95
develop
629
class UserInvitationPolicy < ApplicationPolicy def update? manage_record? end private def manage_record? return false if record.blank? return false if record.accepted_or_not_invited? return carrier_account_users.exists?(record.id) || carrier_users.exists?(record.id) if carrier_owner? retur...
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/broadcast_policy.rb
Ruby
mit
95
develop
206
class BroadcastPolicy < ApplicationPolicy delegate :carrier_managed?, :customer_managed?, to: :record def read? FeatureFlag.enabled_for?(user, :broadcasts) end def manage? read? end end
github
somleng/somleng
https://github.com/somleng/somleng
app/policies/messaging_service_policy.rb
Ruby
mit
95
develop
295
class MessagingServicePolicy < ApplicationPolicy def index? true end def create? carrier_admin? || account_admin? end def manage? account_admin? || carrier_managed? end private def carrier_managed? carrier_admin? && record.account&.carrier_managed? end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api_serializer.rb
Ruby
mit
95
develop
861
class TwilioAPISerializer < ApplicationSerializer def serializable_hash(options = nil) serializable_is_collection? ? hash_for_collection(options) : super end alias to_hash serializable_hash private def hash_for_collection(options) data = object.map do |record| self.class.new(record.decorated, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/jsonapi_serializer.rb
Ruby
mit
95
develop
264
class JSONAPISerializer include JSONAPI::Serializer def self.timestamp_attributes(*names) names.each do |name| attribute(name) do |object| object.public_send(name).utc.iso8601 if object.public_send(name).present? end end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/jsonapi_request_schema_errors_serializer.rb
Ruby
mit
95
develop
262
class JSONAPIRequestSchemaErrorsSerializer < JSONAPIErrorsSerializer private def build_error(error) { title: error.text, source: { pointer: "/#{error.path.join('/')}" }, **error.meta.slice(:code, :detail) } end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/jsonapi_errors_serializer.rb
Ruby
mit
95
develop
443
class JSONAPIErrorsSerializer attr_reader :object def initialize(object) @object = object end def serializable_hash(_options = nil) errors = object.errors errors.each_with_object(errors: []) do |error, result| result[:errors] << build_error(error) end end def as_json(_options = nil)...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/application_serializer.rb
Ruby
mit
95
develop
471
class ApplicationSerializer < SimpleDelegator include ActiveModel::Serializers::JSON attr_reader :serializer_options def initialize(object, serializer_options = {}) super(object) @serializer_options = serializer_options end def attributes {} end def to_json(*args) serializable_hash(*ar...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/available_phone_number_serializer.rb
Ruby
mit
95
develop
821
module TwilioAPI class AvailablePhoneNumberSerializer < TwilioAPISerializer def attributes super.merge( friendly_name: nil, phone_number: nil, lata: nil, rate_center: nil, latitude: nil, longitude: nil, locality: nil, region: nil, posta...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/message_serializer.rb
Ruby
mit
95
develop
1,076
module TwilioAPI class MessageSerializer < ResourceSerializer def attributes super.merge( account_sid: nil, body: nil, date_sent: nil, direction: nil, error_code: nil, error_message: nil, from: nil, messaging_service_sid: nil, num_media...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/bad_request_error_serializer.rb
Ruby
mit
95
develop
506
module TwilioAPI class BadRequestErrorSerializer < TwilioAPISerializer DEFAULT_ERROR_CODE = "20001".freeze DEFAULT_ERROR_MESSAGE = "Bad request" def attributes { message: nil, status: nil, code: nil, more_info: nil } end def code DEFAULT_ERROR_CO...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/recording_serializer.rb
Ruby
mit
95
develop
1,173
module TwilioAPI class RecordingSerializer < ResourceSerializer def attributes super.merge( account_sid: nil, call_sid: nil, conference_sid: nil, channels: nil, start_time: nil, duration: nil, price: nil, price_unit: nil, source: nil, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/incoming_phone_number_serializer.rb
Ruby
mit
95
develop
2,272
module TwilioAPI class IncomingPhoneNumberSerializer < ResourceSerializer def attributes super.merge( account_sid: nil, address_requirements: nil, address_sid: nil, beta: nil, capabilities: nil, emergency_status: nil, emergency_address_sid: nil, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/available_phone_number_country_serializer.rb
Ruby
mit
95
develop
1,083
module TwilioAPI class AvailablePhoneNumberCountrySerializer < TwilioAPISerializer COLLECTION_NAME = :countries def attributes super.merge( country_code: nil, country: nil, uri: nil, beta: nil, subresource_uris: nil ) end def country_code iso...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/resource_serializer.rb
Ruby
mit
95
develop
603
module TwilioAPI class ResourceSerializer < TwilioAPISerializer API_VERSION = "2010-04-01".freeze def attributes super.merge( "api_version" => nil, "sid" => nil, "date_created" => nil, "date_updated" => nil ) end def api_version API_VERSION end ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/account_serializer.rb
Ruby
mit
95
develop
893
module TwilioAPI class AccountSerializer < ResourceSerializer def attributes super.merge( auth_token: nil, friendly_name: nil, owner_account_sid: nil, status: nil, type: nil, uri: nil, subresource_uris: nil ) end def friendly_name ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/phone_call_serializer.rb
Ruby
mit
95
develop
1,337
module TwilioAPI class PhoneCallSerializer < ResourceSerializer def attributes super.merge( account_sid: nil, annotation: nil, answered_by: nil, caller_name: nil, direction: nil, duration: nil, end_time: nil, forwarded_from: nil, from: ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/request_errors_serializer.rb
Ruby
mit
95
develop
588
module TwilioAPI class RequestErrorsSerializer < TwilioAPISerializer DEFAULT_ERROR_CODE = "20422".freeze def attributes { message: nil, status: nil, code: nil, more_info: nil } end def message errors(full: true).map(&:text).to_sentence end d...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/no_pagination_serializer.rb
Ruby
mit
95
develop
273
module TwilioAPI class NoPaginationSerializer attr_reader :pagination_info def initialize(pagination_info) @pagination_info = pagination_info end def serializable_hash { uri: pagination_info.uri.request_uri } end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/pagination_serializer.rb
Ruby
mit
95
develop
571
module TwilioAPI class PaginationSerializer attr_reader :pagination_info def initialize(pagination_info) @pagination_info = pagination_info end def serializable_hash { uri: pagination_info.uri.request_uri, page: pagination_info.page_number, page_size: pagination_i...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/webhook/voice_status_callback_serializer.rb
Ruby
mit
95
develop
3,119
module TwilioAPI module Webhook class VoiceStatusCallbackSerializer < TwilioAPISerializer # https://www.twilio.com/docs/voice/api/call-resource#statuscallback # | Parameter | Description ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/webhook/message_serializer.rb
Ruby
mit
95
develop
2,652
module TwilioAPI module Webhook class MessageSerializer < TwilioAPISerializer # https://www.twilio.com/docs/messaging/guides/webhook-request # | Parameter | Description | # |-----------...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/webhook/recording_status_callback_serializer.rb
Ruby
mit
95
develop
3,273
module TwilioAPI module Webhook class RecordingStatusCallbackSerializer < TwilioAPISerializer # https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback # | Parameter | Description ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/webhook/message_status_callback_serializer.rb
Ruby
mit
95
develop
259
module TwilioAPI module Webhook class MessageStatusCallbackSerializer < MessageSerializer def attributes super.merge( "MessageStatus" => nil ) end def MessageStatus status end end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/verify/verification_check_serializer.rb
Ruby
mit
95
develop
337
module TwilioAPI module Verify class VerificationCheckSerializer < ResourceSerializer def attributes super.merge( service_sid: nil, to: nil, channel: nil, status: nil ) end def service_sid object.verification_service_id end ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/verify/verification_serializer.rb
Ruby
mit
95
develop
766
module TwilioAPI module Verify class VerificationSerializer < ResourceSerializer def attributes super.merge( service_sid: nil, to: nil, channel: nil, status: nil, url: nil, send_code_attempts: nil ) end def send_code_at...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/verify/resource_serializer.rb
Ruby
mit
95
develop
756
module TwilioAPI module Verify class ResourceSerializer < TwilioAPISerializer def attributes super.merge( "sid" => nil, "account_sid" => nil, "date_created" => nil, "date_updated" => nil ) end def sid object.id end def...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/verify/service_serializer.rb
Ruby
mit
95
develop
385
module TwilioAPI module Verify class ServiceSerializer < ResourceSerializer def attributes super.merge( friendly_name: nil, url: nil, code_length: nil ) end def friendly_name name end def url url_helpers.api_twilio_verif...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/verify/pagination_serializer.rb
Ruby
mit
95
develop
665
module TwilioAPI module Verify class PaginationSerializer attr_reader :pagination_info, :key def initialize(pagination_info, key:) @pagination_info = pagination_info @key = key end def serializable_hash { meta: { url: pagination_info.uri, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/twilio_api/verify/verification_delivery_attempt_serializer.rb
Ruby
mit
95
develop
358
module TwilioAPI module Verify class VerificationDeliveryAttemptSerializer < ApplicationSerializer def attributes super.merge( attempt_sid: nil, channel: nil, time: nil ) end def attempt_sid id end def time created_at.ut...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/csv_serializer/account_serializer.rb
Ruby
mit
95
develop
276
module CSVSerializer class AccountSerializer < ResourceSerializer def attributes super.merge( "sid" => nil, "name" => nil, "status" => nil ) end def sid id end def status super.humanize end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/csv_serializer/tts_event_serializer.rb
Ruby
mit
95
develop
270
module CSVSerializer class TTSEventSerializer < ResourceSerializer def attributes super.merge( "sid" => nil, "account_sid" => nil, "phone_call_sid" => nil, "voice" => nil, "characters" => nil ) end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/csv_serializer/phone_number_serializer.rb
Ruby
mit
95
develop
551
module CSVSerializer class PhoneNumberSerializer < ResourceSerializer def attributes super.merge( "number" => nil, "type" => nil, "visibility" => nil, "country" => nil, "price" => nil, "currency" => nil, "region" => nil, "locality" => nil, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/csv_serializer/resource_serializer.rb
Ruby
mit
95
develop
485
module CSVSerializer class ResourceSerializer < ApplicationSerializer def attributes { created_at: nil, updated_at: nil } end def as_csv serializable_hash.values end def headers attributes.keys end def created_at format_time(super) end ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/csv_serializer/phone_number_plan_serializer.rb
Ruby
mit
95
develop
347
module CSVSerializer class PhoneNumberPlanSerializer < ResourceSerializer def attributes super.merge( "account_sid" => nil, "number" => nil, "status" => nil, "canceled_at" => nil, "amount" => nil, "currency" => nil ) end def account_sid ac...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/csv_serializer/message_serializer.rb
Ruby
mit
95
develop
433
module CSVSerializer class MessageSerializer < ResourceSerializer def attributes super.merge( "sid" => nil, "account_sid" => nil, "phone_number_sid" => nil, "from" => nil, "to" => nil, "price" => nil, "price_unit" => nil, "direction" => nil, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/csv_serializer/phone_call_serializer.rb
Ruby
mit
95
develop
462
module CSVSerializer class PhoneCallSerializer < ResourceSerializer def attributes super.merge( "sid" => nil, "account_sid" => nil, "phone_number_sid" => nil, "from" => nil, "to" => nil, "duration" => nil, "price" => nil, "price_unit" => nil, ...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/carrier_api/phone_call_serializer.rb
Ruby
mit
95
develop
244
module CarrierAPI class PhoneCallSerializer < ResourceSerializer attributes :to, :from, :price_unit, :duration, :direction, :status belongs_to :account attribute :price do |object| object.price_formatted end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/carrier_api/message_serializer.rb
Ruby
mit
95
develop
238
module CarrierAPI class MessageSerializer < ResourceSerializer attributes :to, :from, :price_unit, :direction, :status, :body belongs_to :account attribute :price do |object| object.price_formatted end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/carrier_api/phone_number_serializer.rb
Ruby
mit
95
develop
486
module CarrierAPI class PhoneNumberSerializer < ResourceSerializer attributes :number, :country, :visibility, :type, :locality, :rate_center, :lata, :latitude, :longitude, :metadata attribute :currency do |object| object.currency.iso_code end attribute :price do |object| object.price.to_...
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/carrier_api/aggregate_data_serializer.rb
Ruby
mit
95
develop
316
module CarrierAPI class AggregateDataSerializer < JSONAPISerializer attribute :statistic do |object| statistic = {} object.groups.each_with_index do |group, index| statistic[group.name] = object.key[index] end statistic[:value] = object.value statistic end end end
github
somleng/somleng
https://github.com/somleng/somleng
app/serializers/carrier_api/account_serializer.rb
Ruby
mit
95
develop
326
module CarrierAPI class AccountSerializer < ResourceSerializer attributes :name, :metadata, :status, :type, :billing_enabled, :billing_mode attribute :auth_token, if: proc { |record| record.carrier_managed? } attribute :default_tts_voice do |object| object.default_tts_voice.identifier end en...