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
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/proceeding_json_builder.rb
Ruby
mit
19
main
2,648
class ProceedingJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, proceeding_case_id:, lead_proceeding:, ccms_code:, meaning:, description:, substantive_cost_limitation:, delegated_functions_cost_limitation:, used_delegated_func...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/savings_amount_json_builder.rb
Ruby
mit
19
main
655
class SavingsAmountJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, offline_current_accounts:, cash:, other_person_account:, national_savings:, plc_shares:, peps_unit_trusts_capital_bonds_gov_stocks:, life_assurance_endowment_policy:...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/office_json_builder.rb
Ruby
mit
19
main
249
class OfficeJsonBuilder < BaseJsonBuilder def as_json { id:, created_at:, updated_at:, ccms_id:, code:, firm_id:, schedules: schedules.map { |s| ScheduleJsonBuilder.build(s).as_json }, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/opponents_application_json_builder.rb
Ruby
mit
19
main
225
class OpponentsApplicationJsonBuilder < BaseJsonBuilder def as_json { id:, proceeding_id:, has_opponents_application:, reason_for_applying:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/matter_opposition_json_builder.rb
Ruby
mit
19
main
208
class MatterOppositionJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, reason:, created_at:, updated_at:, matter_opposed:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/legal_framework_merits_task_list_json_builder.rb
Ruby
mit
19
main
206
class LegalFrameworkMeritsTaskListJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, serialized_data:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/vehicle_json_builder.rb
Ruby
mit
19
main
282
class VehicleJsonBuilder < BaseJsonBuilder def as_json { id:, estimated_value:, payment_remaining:, used_regularly:, legal_aid_application_id:, created_at:, updated_at:, more_than_three_years_old:, owner:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/bank_provider_json_builder.rb
Ruby
mit
19
main
593
class BankProviderJsonBuilder < BaseJsonBuilder # TODO: AP-6376 DO WE NEED TO SEND THIS AT ALL, IF SO WAIT UNTIL DATATSTORE USED AUTHENTICATION def as_json { id:, applicant_id:, # true_layer_response:, # credentials_id:, name:, # true_layer_provider_id:, created_at:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/legal_aid_application_transaction_type_json_builder.rb
Ruby
mit
19
main
336
class LegalAidApplicationTransactionTypeJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, transaction_type_id:, transaction_type: TransactionTypeJsonBuilder.build(transaction_type).as_json, created_at:, updated_at:, owner_type:, owner_id:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/address_json_builder.rb
Ruby
mit
19
main
521
class AddressJsonBuilder < BaseJsonBuilder def as_json { id:, address_line_one:, address_line_two:, city:, county:, postcode:, applicant_id:, created_at:, updated_at:, organisation:, lookup_used:, lookup_id:, building_number_name:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/capital_disregard_json_builder.rb
Ruby
mit
19
main
282
class CapitalDisregardJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, name:, mandatory:, amount:, date_received:, payment_reason:, account_name:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/appeal_json_builder.rb
Ruby
mit
19
main
230
class AppealJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, second_appeal:, original_judge_level:, court_type:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/dwp_override_json_builder.rb
Ruby
mit
19
main
225
class DWPOverrideJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, passporting_benefit:, has_evidence_of_benefit:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/cfe_submission_json_builder.rb
Ruby
mit
19
main
249
class CFESubmissionJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, assessment_id:, aasm_state:, error_message:, cfe_result:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/employment_payment_json_builder.rb
Ruby
mit
19
main
588
class EmploymentPaymentJsonBuilder < BaseJsonBuilder # TODO: AP-6376 DO WE NEED TO SEND THIS AT ALL, IF SO WAIT UNTIL DATATSTORE USES AUTHENTICATION def as_json { id:, employment_id:, date:, # EXCLUDED FOR NOW AS CONTAINS SENSITVE DATA. DO WE NEED TO QUERY OUR PERMISSIONS TO SHARE THIS W...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/latest_incident_json_builder.rb
Ruby
mit
19
main
247
class LatestIncidentJsonBuilder < BaseJsonBuilder def as_json { id:, occurred_on:, details:, legal_aid_application_id:, created_at:, updated_at:, told_on:, first_contact_date:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/hmrc_response_json_builder.rb
Ruby
mit
19
main
567
class HMRCResponseJsonBuilder < BaseJsonBuilder # TODO: AP-6376 DO WE NEED TO SEND THIS AT ALL, IF SO WAIT UNTIL DATATSTORE USES AUTHENTICATION def as_json { id:, legal_aid_application_id:, submission_id:, use_case:, # response:, EXCLUDED FOR NOW AS CONTAINS SESNITVE DATA, AS JSON,...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/undertaking_json_builder.rb
Ruby
mit
19
main
212
class UndertakingJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, offered:, additional_information:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/opponent_json_builder.rb
Ruby
mit
19
main
1,252
class OpponentJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, created_at:, updated_at:, ccms_opponent_id:, opposable_type:, opposable_id:, exists_in_ccms:, opposable:, # Mappings used by Datastore/Decide opponent_type:,...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/child_care_assessment_json_builder.rb
Ruby
mit
19
main
210
class ChildCareAssessmentJsonBuilder < BaseJsonBuilder def as_json { id:, proceeding_id:, assessed:, result:, details:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/parties_mental_capacity_json_builder.rb
Ruby
mit
19
main
265
class PartiesMentalCapacityJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, understands_terms_of_court_order:, understands_terms_of_court_order_details:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/partner_json_builder.rb
Ruby
mit
19
main
640
class PartnerJsonBuilder < BaseJsonBuilder def as_json { id:, first_name:, last_name:, date_of_birth:, has_national_insurance_number:, national_insurance_number:, legal_aid_application_id:, created_at:, updated_at:, shared_benefit_with_applicant:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/bank_account_holder_json_builder.rb
Ruby
mit
19
main
349
class BankAccountHolderJsonBuilder < BaseJsonBuilder # TODO: AP-6376 DO WE NEED TO SEND THIS AT ALL, IF SO WAIT UNTIL DATATSTORE USES AUTHENTICATION def as_json { id:, addresses:, bank_provider_id:, created_at:, date_of_birth:, full_name:, # true_layer_response:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/base_json_builder.rb
Ruby
mit
19
main
710
class BaseJsonBuilder def initialize(object) @object = object end attr_reader :object # :nocov: def as_json(*) raise NotImplementedError, "#{self.class} must implement #as_json" end # delegate all missing method calls to the object being serialized def method_missing(method, ...) if objec...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/bank_transaction_json_builder.rb
Ruby
mit
19
main
597
class BankTransactionJsonBuilder < BaseJsonBuilder # TODO: AP-6376 DO WE NEED TO SEND THIS AT ALL, IF SO WAIT UNTIL DATATSTORE USES AUTHENTICATION def as_json { id:, # amount:, # bank_account_id:, created_at:, currency:, description:, # flags:, happened_at:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/individual_polymorph_json_builder.rb
Ruby
mit
19
main
398
class IndividualPolymorphJsonBuilder < BaseJsonBuilder def as_json { first_name:, last_name:, date_of_birth:, details:, type:, } end private def details { todo: "Details like addresses?" } end # TODO: Implement other individual types when we know what the API inten...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/allegation_json_builder.rb
Ruby
mit
19
main
214
class AllegationJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, denies_all:, additional_information:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/applicant_json_builder.rb
Ruby
mit
19
main
1,095
class ApplicantJsonBuilder < BaseJsonBuilder def as_json { id:, first_name:, date_of_birth:, created_at:, updated_at:, last_name:, email:, national_insurance_number:, employed:, self_employed:, armed_forces:, has_national_insurance_number:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/state_machine_json_builder.rb
Ruby
mit
19
main
218
class StateMachineJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, type:, aasm_state:, created_at:, updated_at:, ccms_reason:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/domestic_abuse_summary_json_builder.rb
Ruby
mit
19
main
358
class DomesticAbuseSummaryJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, warning_letter_sent:, warning_letter_sent_details:, police_notified:, police_notified_details:, bail_conditions_set:, bail_conditions_set_details:, created_at...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/other_assets_declaration_json_builder.rb
Ruby
mit
19
main
441
class OtherAssetsDeclarationJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, second_home_value:, second_home_mortgage:, second_home_percentage:, timeshare_property_value:, land_value:, valuable_items_value:, inherited_assets_value:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/benefit_check_result_json_builder.rb
Ruby
mit
19
main
203
class BenefitCheckResultJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, result:, dwp_ref:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/provider_json_builder.rb
Ruby
mit
19
main
305
class ProviderJsonBuilder < BaseJsonBuilder def as_json { id:, username:, type:, roles:, created_at:, updated_at:, office_codes:, firm_id:, selected_office_id:, name:, email:, ccms_contact_id:, silas_id:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/urgency_json_builder.rb
Ruby
mit
19
main
264
class UrgencyJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, nature_of_urgency:, hearing_date_set:, hearing_date:, additional_information:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/bank_account_json_builder.rb
Ruby
mit
19
main
542
class BankAccountJsonBuilder < BaseJsonBuilder # TODO: AP-6376 DO WE NEED TO SEND THIS AT ALL, IF SO WAIT UNTIL DATATSTORE USES AUTHENTICATION def as_json { id:, # account_number:, account_type:, # balance:, bank_provider_id:, created_at:, currency:, name:, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/dependant_json_builder.rb
Ruby
mit
19
main
367
class DependantJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, number:, name:, date_of_birth:, created_at:, updated_at:, relationship:, monthly_income:, has_income:, in_full_time_education:, has_assets_more_than_th...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/scope_limitation_json_builder.rb
Ruby
mit
19
main
249
class ScopeLimitationJsonBuilder < BaseJsonBuilder def as_json { id:, scope_type:, code:, meaning:, description:, hearing_date:, limitation_note:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/statement_of_case_json_builder.rb
Ruby
mit
19
main
245
class StatementOfCaseJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, statement:, created_at:, updated_at:, provider_uploader_id:, upload:, typed:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/chances_of_success_json_builder.rb
Ruby
mit
19
main
268
class ChancesOfSuccessJsonBuilder < BaseJsonBuilder def as_json { id:, proceeding_id:, application_purpose:, success_prospect:, success_prospect_details:, success_likely:, created_at:, updated_at:, } end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/builders/regular_transaction_json_builder.rb
Ruby
mit
19
main
373
class RegularTransactionJsonBuilder < BaseJsonBuilder def as_json { id:, legal_aid_application_id:, transaction_type_id:, transaction_type: TransactionTypeJsonBuilder.build(transaction_type).as_json, amount:, frequency:, created_at:, updated_at:, description:,...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/submission_confirmation_mailer.rb
Ruby
mit
19
main
746
class SubmissionConfirmationMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def notify(legal_aid_application_id, feedback_url) @legal_aid_application = LegalAidApplication.find(legal_aid_application_id) template_name :submission_confirmation ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/citizen_confirmation_mailer.rb
Ruby
mit
19
main
445
class CitizenConfirmationMailer < BaseApplyMailer # Require relative statement required as concern not found when loaded from sidekiq on retry require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def citizen_complete_email(app_id, email, client_name) template_name :citizen_comp...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/undeliverable_email_alert_mailer.rb
Ruby
mit
19
main
903
class UndeliverableEmailAlertMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def notify_apply_team(scheduled_mail_id) scheduled_mail = ScheduledMailing.find(scheduled_mail_id) template_name :undeliverable_alert set_personalisation( emai...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/citizen_completed_means_mailer.rb
Ruby
mit
19
main
563
class CitizenCompletedMeansMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def notify_provider(application_id, provider_name, applicant_name, application_url, to = Rails.configuration.x.support_email_address) application = LegalAidApplication.find(ap...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/resend_link_request_mailer.rb
Ruby
mit
19
main
398
class ResendLinkRequestMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def notify(app_id, email, application_url, client_name) template_name :new_link_to_client set_personalisation( application_url:, client_name:, ref_number: ap...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/submit_provider_financial_reminder_mailer.rb
Ruby
mit
19
main
685
class SubmitProviderFinancialReminderMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def self.eligible_for_delivery?(scheduled_mailing) scheduled_mailing.legal_aid_application.provider_step == "client_completed_means" end def notify_provider(app...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/base_apply_mailer.rb
Ruby
mit
19
main
300
class BaseApplyMailer < GovukNotifyRails::Mailer # this is a hook method that ScheduledMailing can call to see if the mail # still needs to be sent. Override in the subclass if you want anything # other than always true def self.eligible_for_delivery?(_scheduled_mailing) true end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/submit_citizen_financial_reminder_mailer.rb
Ruby
mit
19
main
702
class SubmitCitizenFinancialReminderMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def self.eligible_for_delivery?(scheduled_mailing) scheduled_mailing.legal_aid_application.provider_step == "check_provider_answers" end def notify_citizen(appli...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/notify_mailer.rb
Ruby
mit
19
main
539
class NotifyMailer < BaseApplyMailer # Require relative statement required as concern not found when loaded from sidekiq on retry require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def citizen_start_email(app_id, email, application_url, client_name, provider_firm) template_na...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/exception_alert_mailer.rb
Ruby
mit
19
main
280
class ExceptionAlertMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods def notify(environment:, details:, to:) template_name :exception_alert set_personalisation(environment:, details:) mail to: end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/submit_application_reminder_mailer.rb
Ruby
mit
19
main
985
class SubmitApplicationReminderMailer < BaseApplyMailer require_relative "concerns/notify_template_methods" include NotifyTemplateMethods INELIGIBLE_STATES = %w[use_ccms generating_reports submitting_assessment assessment_submitted].freeze def self.eligible_for_delivery?(scheduled_mailing) !scheduled_mail...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/mailers/concerns/notify_template_methods.rb
Ruby
mit
19
main
329
module NotifyTemplateMethods def template_name(template_name) template_id = template_ids.fetch(template_name) set_template(template_id) end def template_ids @template_ids ||= Rails.configuration.govuk_notify_templates end def url_expiry_date (Time.zone.today + 7.days).strftime("%-d %B %Y") ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/form_builders/form_builder_extensions/field_helpers.rb
Ruby
mit
19
main
355
module FormBuilderExtensions module FieldHelpers def moj_date_picker_field(attribute_name, options = {}) content_tag(:div, class: "moj-datepicker", data: { module: "moj-date-picker" }) do govuk_text_field( attribute_name, **options, class: "moj-js-datepicker-input", ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/page_history_service.rb
Ruby
mit
19
main
442
class PageHistoryService def initialize(page_history_id:) @page_history_id = page_history_id end def write(page_history) redis.set(redis_key, page_history) end def read redis.get(redis_key) end private def redis @redis ||= Redis.new(url: redis_url) end def redis_url Rails.conf...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/scope_limitation_detail_builder.rb
Ruby
mit
19
main
1,239
class ScopeLimitationDetailBuilder attr_reader :scope_limitation def self.call(scope_limitation) new(scope_limitation).call end def initialize(scope_limitation) @scope_limitation = scope_limitation end def call [scope_limitation_meaning, scope_limitation_description, scope_limitation_addition...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/citizen_email_service.rb
Ruby
mit
19
main
899
class CitizenEmailService include Rails.application.routes.url_helpers def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end def send_email ScheduledMailing.send_now!( mailer_klass: NotifyMailer, mailer_method: :citizen_start_email, legal_aid_applic...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/submit_application_reminder_service.rb
Ruby
mit
19
main
1,417
class SubmitApplicationReminderService attr_reader :application def initialize(application) @application = application end def send_email return unless application.substantive_application_deadline_on return if application.substantive_application_deadline_on < Date.current scheduled_mail.pres...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/malware_scanner.rb
Ruby
mit
19
main
1,691
class MalwareScanner ScanResult = Struct.new(:result, :status, :error) def self.call(**) new(**).call end def initialize(file_path:, uploader: nil, file_details: nil, save_result: true) @file_path = file_path @uploader = uploader @file_details = file_details @save_result = save_res...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/address_lookup_service.rb
Ruby
mit
19
main
1,284
class AddressLookupService prepend SimpleCommand ORDNANCE_SURVEY_URL = "https://api.os.uk/search/places/v1/postcode".freeze attr_reader :postcode def initialize(postcode) @postcode = postcode end def call MapAddressLookupResults.call(results) end private def query_params { key: R...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pdf_attachment_creator.rb
Ruby
mit
19
main
1,701
class PDFAttachmentCreator def self.call(attachment_id) new(attachment_id).call end attr_reader :attachment_id def initialize(attachment_id) @attachment_id = attachment_id @original_attachment = Attachment.find_by(id: attachment_id) end def call return if @original_attachment&.pdf_attachm...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/currency_cleaner.rb
Ruby
mit
19
main
571
class CurrencyCleaner THOUSANDS_SEPARATOR_REGEX = /,(?=\d{3}\b)/ LEADING_POUND_SIGN_REGEX = /^£/ PURE_NUMERIC_REGEX = /^-?\d+\.?\d+?$/ def initialize(value) @original_value = value.to_s end # will remove all commas if valid i.e. followed by 3 digits # if invalid, the original String is returned de...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/destroy_purgeable_service.rb
Ruby
mit
19
main
344
class DestroyPurgeableService START_OF_EPOCH = Date.new(1970, 1, 1).in_time_zone.freeze def self.call new.call end def call ids = LegalAidApplication.where(purgeable_on: START_OF_EPOCH..Time.zone.today, updated_at: START_OF_EPOCH..730.days.ago).pluck(:id) ids.each { |id| LegalAidApplication.find(i...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/provider_email_service.rb
Ruby
mit
19
main
1,080
class ProviderEmailService include Rails.application.routes.url_helpers def initialize(application) @application = application end def send_email ScheduledMailing.send_now!(mailer_klass: CitizenCompletedMeansMailer, mailer_method: :notify_provider, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer_error_decoder.rb
Ruby
mit
19
main
1,155
class TrueLayerErrorDecoder # expects an array, the third item of which is a JSON-encoded hash # # [ # "bank_data_import", # "import_account_holders", # "{\"TrueLayerError\" : {\"error_description\":\"<details of the error>\",\"error\":\"provider_error\",\"error_details\":{}}}" # ] # # ERR...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/job_queue.rb
Ruby
mit
19
main
1,310
class JobQueue END_OF_TIME = Time.zone.local(9999, 12, 31, 23, 59, 59) # returns true if the named class is queued for execution within its # default delay time # def self.enqueued?(klass) next_job_due(klass) < Time.current + klass::DEFAULT_DELAY end def self.next_job_due(klass) ss = Sidekiq::Sc...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/map_address_lookup_results.rb
Ruby
mit
19
main
2,275
class MapAddressLookupResults NUMBER = %w[SUB_BUILDING_NAME BUILDING_NUMBER].freeze NUMBER_NAME = %w[SUB_BUILDING_NAME BUILDING_NAME BUILDING_NUMBER].freeze FULL_NAME = %w[SUB_BUILDING_NAME BUILDING_NAME].freeze ROAD = %w[DEPENDENT_THOROUGHFARE_NAME THOROUGHFARE_NAME].freeze def self.call(results) result...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/substantive_application_deadline_calculator.rb
Ruby
mit
19
main
407
class SubstantiveApplicationDeadlineCalculator def self.call(df_date) new(df_date).deadline end def initialize(df_date) @df_date = df_date end def deadline WorkingDayCalculator.call( working_days: number_of_days_to_deadline, from: @df_date, ) end def number_of_days_to_deadli...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/results_panel_selector.rb
Ruby
mit
19
main
1,483
class ResultsPanelSelector def self.call(legal_aid_application) new(legal_aid_application).call end def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end attr_reader :legal_aid_application delegate :has_restrictions?, :policy_disregards?, :...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/mock_benefit_check_service.rb
Ruby
mit
19
main
1,115
# frozen_string_literal: true class MockBenefitCheckService KNOWN = { "SMITH" => { nino: "ZZ123459A", dob: "11-Jan-99" }, "JONES" => { nino: "ZZ123458A", dob: "1-Jun-80" }, "BLOGGS" => { nino: "ZZ123457A", dob: "4-Jan-90" }, "WRINKLE" => { nino: "ZZ010150A", dob: "01-Jan-50" }, "WALKER" => { nino...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/applicant_complete_means.rb
Ruby
mit
19
main
552
class ApplicantCompleteMeans def self.call(legal_aid_application) new(legal_aid_application).call end attr_reader :legal_aid_application def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end def call legal_aid_application.update!( provider_step: intend...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/manual_review_detailer.rb
Ruby
mit
19
main
873
class ManualReviewDetailer def self.call(legal_aid_application) new(legal_aid_application).call end def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end attr_reader :legal_aid_application delegate :has_restrictions?, :policy_disregards?, :...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/benefit_check_service.rb
Ruby
mit
19
main
2,467
class BenefitCheckService class BenefitCheckError < StandardError; end USE_MOCK = ActiveModel::Type::Boolean.new.cast(Rails.configuration.x.bc_use_dev_mock) NAMESPACES = { "xmlns:xsd": "http://www.w3.org/2001/XMLSchema", "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance", "xmlns:wsdl": "https:/...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/digest_extractor.rb
Ruby
mit
19
main
440
class DigestExtractor def self.call new.call end def initialize @start_time = Time.zone.now @last_run_date = Setting.setting.digest_extracted_at @application_ids = LegalAidApplication.where(updated_at: @last_run_date..Time.zone.now).pluck(:id) end def call @application_ids.each { |laa_id...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/mark_purgeable_service.rb
Ruby
mit
19
main
580
class MarkPurgeableService def self.call new.call end def initialize @threshold_date = 23.months.ago end def call # update all records whose updated date is more than 23 months ago and set the purgeable_on date to the updated date + 2 years. connection = ActiveRecord::Base.connection.raw_con...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/document_category_populator.rb
Ruby
mit
19
main
397
require "csv" class DocumentCategoryPopulator def self.call new.call end def call file_path = Rails.root.join("db/seeds/document_categories.csv").freeze CSV.read(file_path, headers: true, header_converters: :symbol).each do |row| document_category = DocumentCategory.where(name: row[:name]).fi...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/submit_citizen_reminder_service.rb
Ruby
mit
19
main
1,290
class SubmitCitizenReminderService include Rails.application.routes.url_helpers def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end def send_email [day_after_initial_email, day_before_link_expires].each do |scheduled_time| ScheduledMailing.send_later!( ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/delegated_functions_date_service.rb
Ruby
mit
19
main
1,177
class DelegatedFunctionsDateService delegate :earliest_delegated_functions_date, to: :laa attr_reader :laa def self.call(laa, draft_selected: false) new(laa, draft_selected).call end def initialize(laa, draft_selected) @laa = laa @draft_selected = draft_selected end def call update_dea...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/bank_holiday_store.rb
Ruby
mit
19
main
1,904
class BankHolidayStore attr_reader :redis def initialize @redis = Redis.new(url: Rails.configuration.x.redis.bank_holidays_url) end def self.write(date_values) new.write(date_values) end def self.read(fallback_to_api_for_cache_miss: true) new.read(fallback_to_api_for_cache_miss:) end def...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/oauth_session_saver.rb
Ruby
mit
19
main
617
class OauthSessionSaver TIME_TO_LIVE_IN_SECONDS = 600 def self.store(key, session) new.store(key, session) end def self.get(key) new.get(key) end def self.destroy!(key) new.destroy!(key) end def initialize @redis = Redis.new(url: Rails.configuration.x.redis.oauth_session_url) end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/working_day_calculator.rb
Ruby
mit
19
main
936
class WorkingDayCalculator ParameterError = Class.new(StandardError) def self.working_days_from_now(number) call(working_days: number) end def self.call(working_days:, from: Time.zone.today) new(from).working_days_from_date(working_days) end def self.working_days_between(date1, date2) new(dat...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/reference_number.rb
Ruby
mit
19
main
760
class ReferenceNumber PREFIX = "L".freeze DISALLOWED_CHARACTERS = %w[G I O Q S Z].freeze def self.generate new.generate end def generate unique_reference_number end private def unique_reference_number loop do reference_number = random_reference_number return reference_number un...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/document_category_analyser.rb
Ruby
mit
19
main
2,400
class DocumentCategoryAnalyser def self.call(application) new(application).call end def initialize(application) @application = application end def call allowed_document_categories = [] allowed_document_categories << "benefit_evidence" if @application.dwp_override&.has_evidence_of_benefit? ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/bank_holiday_retriever.rb
Ruby
mit
19
main
1,030
# frozen_string_literal: true class BankHolidayRetriever UnsuccessfulRetrievalError = Class.new(StandardError) DEFAULT_GROUP = "england-and-wales" def self.dates(group: DEFAULT_GROUP) new.dates(group) end def data return raise_error unless response.success? @data ||= JSON.parse(response.body) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/secure_application_finder.rb
Ruby
mit
19
main
381
class SecureApplicationFinder def initialize(token) @token = token end def error :expired if expired? end delegate :legal_aid_application, to: :citizen_access_token private def citizen_access_token @citizen_access_token ||= Citizen::AccessToken.find_by!(token: @token) end def expired? ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/submit_provider_reminder_service.rb
Ruby
mit
19
main
884
class SubmitProviderReminderService include Rails.application.routes.url_helpers def initialize(application) @application = application end def send_email ScheduledMailing.send_later!( mailer_klass: SubmitProviderFinancialReminderMailer, mailer_method: :notify_provider, legal_aid_app...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/citizen_completion_email_service.rb
Ruby
mit
19
main
749
class CitizenCompletionEmailService include Rails.application.routes.url_helpers def initialize(application) @application = application end def send_email ScheduledMailing.send_now!(mailer_klass: CitizenConfirmationMailer, mailer_method: :citizen_complete_email, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/submission_builder.rb
Ruby
mit
19
main
2,986
module CFECivil class SubmissionBuilder < BaseService delegate :cfe_result, to: :submission attr_reader :legal_aid_application def initialize(legal_aid_application) super() @legal_aid_application = legal_aid_application end def self.call(legal_aid_application) new(legal_aid_app...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/base_service.rb
Ruby
mit
19
main
586
module CFECivil class BaseService HEADER_VERSION = 1.0 CFE_VERSION = "6".freeze def call @response = query_cfe_service process_response end private def conn @conn ||= Faraday.new(url: cfe_url_host, headers:) end def cfe_url_host Rails.configuration.x.cfe_civil...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/component_list.rb
Ruby
mit
19
main
2,014
module CFECivil class ComponentList attr_reader :object PASSPORTED_SERVICES = [ Components::Assessment, Components::ProceedingTypes, Components::Applicant, Components::Capitals, Components::Vehicles, Components::Properties, Components::ExplicitRemarks, Componen...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/obtain_state_benefit_types_service.rb
Ruby
mit
19
main
473
module CFECivil class ObtainStateBenefitTypesService < BaseService def self.call new.call end private def cfe_url_path "/state_benefit_type" end def query_cfe_service conn.get cfe_url_path end def process_response return JSON.parse(@response.body) if @response...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/submission_error.rb
Ruby
mit
19
main
237
module CFECivil class SubmissionError < StandardError include Nesty::NestedError attr_reader :http_status def initialize(message, http_status = nil) @http_status = http_status super(message) end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/other_income.rb
Ruby
mit
19
main
1,426
module CFECivil module Components class OtherIncome < BaseDataBlock def call { other_incomes: other_income_data, }.to_json end private def other_income_data grouped_transactions.keys.sort_by(&:name).each_with_object([]) do |transaction_type, array| ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/state_benefits.rb
Ruby
mit
19
main
1,417
module CFECivil module Components class StateBenefits < BaseDataBlock def call { state_benefits: build_transactions, }.to_json end private def build_transactions result = [] raise CFECivil::SubmissionError, "Benefit transactions un-coded" if bank_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/regular_transactions.rb
Ruby
mit
19
main
748
module CFECivil module Components class RegularTransactions < BaseDataBlock def call { regular_transactions: build_regular_transactions, }.to_json end private def party @party ||= legal_aid_application.send(owner_type.downcase) end def build_r...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/partner.rb
Ruby
mit
19
main
2,069
module CFECivil module Components class Partner < BaseDataBlock delegate :partner, to: :legal_aid_application def call return {}.to_json if partner.blank? result = base_partner # Most records are stored with an Owner field that is tied to Applicant or Partner models, using th...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/base_data_block.rb
Ruby
mit
19
main
433
module CFECivil module Components class BaseDataBlock attr_reader :legal_aid_application, :owner_type def self.call(legal_aid_application, owner_type = "Applicant") new(legal_aid_application, owner_type).call end def initialize(legal_aid_application, owner_type = "Applicant") ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/properties.rb
Ruby
mit
19
main
1,229
module CFECivil module Components class Properties < BaseDataBlock delegate :other_assets_declaration, to: :legal_aid_application def call { properties: { main_home:, additional_properties: [second_home], }, }.to_json end private ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/employments.rb
Ruby
mit
19
main
1,782
module CFECivil module Components class Employments < BaseDataBlock def call if employment_and_payments? if owner_type.eql?("Partner") { employments: employment_income_payload }.to_json else { employment_income: employment_income_payload }.to_json ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/assessment.rb
Ruby
mit
19
main
386
module CFECivil module Components class Assessment < BaseDataBlock def call { assessment: { client_reference_id: legal_aid_application.application_ref, submission_date: legal_aid_application.calculation_date.strftime("%Y-%m-%d"), level_of_help: "certific...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/applicant.rb
Ruby
mit
19
main
525
module CFECivil module Components class Applicant < BaseDataBlock delegate :applicant, to: :legal_aid_application def call { applicant: { date_of_birth: applicant.date_of_birth.strftime("%Y-%m-%d"), employed: applicant.employed, involvement_type: ...