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/services/cfe_civil/components/cash_transactions.rb
Ruby
mit
19
main
1,367
module CFECivil module Components class CashTransactions < BaseDataBlock delegate :cash_transactions, to: :legal_aid_application def call { cash_transactions: { income: build_cash_transactions_for(:credit), outgoings: build_cash_transactions_for(:debit), ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/capitals.rb
Ruby
mit
19
main
3,576
module CFECivil module Components class Capitals < BaseDataBlock OTHER_ASSET_FIELDS = { timeshare_property_value: "Timeshare property", land_value: "Land", valuable_items_value: "Any valuable items worth more than £500", inherited_assets_value: "Money or assets from the estat...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/explicit_remarks.rb
Ruby
mit
19
main
437
module CFECivil module Components class ExplicitRemarks < BaseDataBlock delegate :policy_disregards, to: :legal_aid_application def call { explicit_remarks: policy_disregard_builder, }.to_json end private def policy_disregard_builder payload = [] ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/irregular_incomes.rb
Ruby
mit
19
main
1,340
module CFECivil module Components class IrregularIncomes < BaseDataBlock def call payment_data.to_json end private def payment_data if student_finance_data? && owner_type.eql?("Partner") { irregular_incomes: [ { income_typ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/dependants.rb
Ruby
mit
19
main
406
module CFECivil module Components class Dependants < BaseDataBlock def call { dependants: dependants_data, }.to_json end private def dependants_data legal_aid_application.dependants.each_with_object([]) { |d, arr| arr << dependant_data(d) } end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/proceeding_types.rb
Ruby
mit
19
main
480
module CFECivil module Components class ProceedingTypes < BaseDataBlock def call { proceeding_types: proceeding_type_details, }.to_json end private def proceedings legal_aid_application.proceedings.order(:ccms_code) end def proceeding_type_det...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/vehicles.rb
Ruby
mit
19
main
919
module CFECivil module Components class Vehicles < BaseDataBlock def self.call(legal_aid_application, owner_type = :client) new(legal_aid_application, owner_type).call end def initialize(legal_aid_application, owner_type = :client) super end def call { ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/cfe_civil/components/outgoings.rb
Ruby
mit
19
main
1,349
module CFECivil module Components class Outgoings < BaseDataBlock def call { outgoings: build_transactions, }.to_json end private def build_transactions bank_transactions.each_with_object([]) do |(transaction_type_id, array), result| name = Trans...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pdf/convert_file.rb
Ruby
mit
19
main
342
module PDF class ConvertFile def initialize(source_temp_file) @source_temp_file = source_temp_file end def self.call(source_temp_file) new(source_temp_file).call end def call file = Tempfile.new Libreconv.convert(@source_temp_file.path, file.path) file.close f...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/banks_retriever.rb
Ruby
mit
19
main
862
module TrueLayer class BanksRetriever UnsuccessfulRetrievalError = Class.new(StandardError) API_URL_OPEN_BANKING = "https://auth.truelayer.com/api/providers/oauth/openbanking".freeze API_URL_OAUTH = "https://auth.truelayer.com/api/providers/oauth".freeze def self.banks new.banks end d...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/sample_transactions_csv_parser.rb
Ruby
mit
19
main
1,481
require "csv" module TrueLayer class SampleTransactionsCsvParser def self.call new.call end def call @transaction_ids = [] CSV.read(Rails.root.join(Setting.bank_transaction_filename), headers: true).map do |row| parse_transaction_csv_row(row.to_h.symbolize_keys) end e...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/api_client.rb
Ruby
mit
19
main
1,726
module TrueLayer class ApiClient ApiError = Class.new(StandardError) TRUE_LAYER_URL = "https://api.truelayer.com".freeze def initialize(token) @token = token end def provider perform_lookup("/data/v1/me") end def account_holders perform_lookup("/data/v1/info") end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/bank_data_import_service.rb
Ruby
mit
19
main
2,717
module TrueLayer class BankDataImportService prepend SimpleCommand def initialize(legal_aid_application:) @legal_aid_application = legal_aid_application end def call ActiveRecord::Base.transaction do import_bank_data raise ActiveRecord::Rollback if error end s...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/api_client_mock.rb
Ruby
mit
19
main
494
module TrueLayer class ApiClientMock < ApiClient def provider SimpleResult.new(value: SampleData::PROVIDERS) end def account_holders SimpleResult.new(value: SampleData::ACCOUNT_HOLDERS) end def accounts SimpleResult.new(value: SampleData::ACCOUNTS) end def transactions...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/sample_data.rb
Ruby
mit
19
main
912
module TrueLayer module SampleData PROVIDERS = [ { credentials_id: "ihYXzOOCbi5MpjYIM3LSnfje4znMKo43qKK01+wGbKA=", client_id: "client_id", provider: { display_name: "Mock", provider_id: "sample", }, }, ].freeze ACCOUNT_HOLDERS = [ { ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/importers/import_account_holders_service.rb
Ruby
mit
19
main
1,161
module TrueLayer module Importers class ImportAccountHoldersService prepend SimpleCommand def initialize(api_client, bank_provider) @api_client = api_client @bank_provider = bank_provider end def call if true_layer_error errors.add(:import_account_holder...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/importers/import_provider_service.rb
Ruby
mit
19
main
1,274
module TrueLayer module Importers class ImportProviderService prepend SimpleCommand def initialize(api_client:, applicant:) @api_client = api_client @applicant = applicant end def call if true_layer_error errors.add(:import_provider, true_layer_error) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/importers/import_accounts_service.rb
Ruby
mit
19
main
1,462
module TrueLayer module Importers class ImportAccountsService prepend SimpleCommand def initialize(api_client, bank_provider) @api_client = api_client @bank_provider = bank_provider end def call if true_layer_error errors.add(:import_accounts, true_layer...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/importers/import_account_balance_service.rb
Ruby
mit
19
main
960
module TrueLayer module Importers class ImportAccountBalanceService prepend SimpleCommand def initialize(api_client, bank_account) @api_client = api_client @bank_account = bank_account end def call if true_layer_error errors.add(:import_account_balance, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/true_layer/importers/import_transactions_service.rb
Ruby
mit
19
main
1,613
module TrueLayer module Importers class ImportTransactionsService prepend SimpleCommand def initialize(api_client, bank_account, start_at:, finish_at:) @api_client = api_client @bank_account = bank_account @start_at = start_at @finish_at = finish_at end de...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/faraday/soap_call.rb
Ruby
mit
19
main
1,335
module Faraday class SoapError < StandardError; end class SoapCall attr_reader :url, :type, :timeout def initialize(wsdl_or_url, type, timeout = 30) @type = type @timeout = timeout raise StandardError, "Unable to parse url" unless parse_url(wsdl_or_url) end def call(xml_body) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pda/mock_provider_details_updater.rb
Ruby
mit
19
main
589
require "webmock" require Rails.root.join("spec/services/pda/provider_details_request_stubs") module PDA class MockProviderDetailsUpdater < ProviderDetailsUpdater include WebMock::API def initialize(provider, office_code) WebMock.enable! WebMock.allow_net_connect! load_stubs super ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pda/office_address_retriever.rb
Ruby
mit
19
main
2,205
module PDA class OfficeAddressRetriever ApiError = Class.new(StandardError) NotFoundError = Class.new(StandardError) class OfficeAddressStruct attr_reader :code, :firm_name, :address_line_one, :address_line_two, :address_line_three, :address_line_four, :county, :city, :post_code def initiali...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pda/connection.rb
Ruby
mit
19
main
584
module PDA class Connection extend Forwardable attr_reader :connection def_delegators :connection, :post, :get def initialize @connection = Faraday.new(url:, headers:) end private def url Rails.configuration.x.pda.url end def headers { "Content-Type" =...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pda/schedule_validator.rb
Ruby
mit
19
main
2,155
module PDA class ScheduleValidator attr_accessor :errors Error = Struct.new(:attribute, :message) APPLICABLE_DEVOLVED_POWER_STATUSES = ["Yes - Excluding JR Proceedings", "Yes - Including JR Proceedings"].freeze APPLICABLE_AUTHORISATION_STATUSES = %w[APPROVED].freeze APPLICABLE_SCHEDULE_STATUSES ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pda/current_contracts.rb
Ruby
mit
19
main
1,624
module PDA class CurrentContracts def initialize(office_code) @office_code = office_code end def self.call(office_code) new(office_code).call end def call body = response.body # TODO: 16 September 2024 Colin Bruce - Replace once data has been analysed and responses can b...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/pda/provider_details_updater.rb
Ruby
mit
19
main
4,811
module PDA class ProviderDetailsUpdater ApiError = Class.new(StandardError) # Only save schedule details that are relevant to civil apply APPLICABLE_CATEGORIES_OF_LAW = %w[MAT].freeze APPLICABLE_AREAS_OF_LAW = ["LEGAL HELP"].freeze attr_reader :connection delegate :get, to: :connection ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/uploaded_evidence/base.rb
Ruby
mit
19
main
4,073
module UploadedEvidence class Base delegate :legal_aid_application, to: :controller attr_reader :controller, :successful_upload, :error_message, :successfully_deleted, :next_action def self.call(controller) new(controller).call end def initialize(controller) @controller...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/uploaded_evidence/uploader_service.rb
Ruby
mit
19
main
485
module UploadedEvidence class UploaderService < Base def call upload_form.upload_button_pressed = true if upload_form.valid? && upload_form.save @successful_upload = successful_upload else @error_message = error_message end DocumentCategoryAnalyser.call(legal_aid_app...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/uploaded_evidence/save_and_continue_service.rb
Ruby
mit
19
main
881
module UploadedEvidence class SaveAndContinueService < Base def call if save_or_continue convert_new_files_to_pdf else populate_upload_form @next_action = :show end self end private def save_or_continue no_files = params[:uploaded_evidence_collect...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/uploaded_evidence/deletion_service.rb
Ruby
mit
19
main
1,248
module UploadedEvidence class DeletionService < Base attr_reader :successfully_deleted, :upload_form def call original_file = delete_original_and_pdf_files @successfully_deleted = files_deleted_message(original_file.original_filename) unless original_file.nil? populate_upload_form @ne...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/opponent_task_update_service.rb
Ruby
mit
19
main
1,707
module LegalFramework class OpponentTaskUpdateService def initialize(legal_aid_application) @legal_aid_application = legal_aid_application @merits_task_list = @legal_aid_application.legal_framework_merits_task_list @application_tasks = @merits_task_list.task_list.tasks[:application] end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/add_opponent_organisation_service.rb
Ruby
mit
19
main
838
module LegalFramework class AddOpponentOrganisationService def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end def call(lfa_organisation) ActiveRecord::Base.transaction do organisation = ApplicationMeritsTask::Organisation.create!( name: ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/base_api_call.rb
Ruby
mit
19
main
419
module LegalFramework class BaseApiCall def self.call(params = nil) params.nil? ? new.call : new(params).call end private def request conn.get url end def conn @conn ||= Faraday.new(url:, headers:) end def url "#{Rails.configuration.x.legal_framework_api_host}...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/merits_tasks_retriever_service.rb
Ruby
mit
19
main
698
module LegalFramework class MeritsTasksRetrieverService < BaseService ENDPOINT = "/civil_merits_questions".freeze def url_path ENDPOINT end def request_body { request_id:, proceedings: proceedings_data, }.to_json end private def proceedings_data le...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/merits_tasks_service.rb
Ruby
mit
19
main
2,017
module LegalFramework class MeritsTasksService attr_reader :legal_aid_application def self.call(legal_aid_application) new(legal_aid_application).call end def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end def call @response = merits_t...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/base_service.rb
Ruby
mit
19
main
3,226
module LegalFramework class BaseService def self.call(submission = nil) new(submission).call end attr_reader :submission def initialize(submission) @submission = submission end def call @response = query_legal_framework_api end def legal_framework_url File.j...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/remove_proceeding_service.rb
Ruby
mit
19
main
371
module LegalFramework class RemoveProceedingService def self.call(legal_aid_application, proceeding) new(legal_aid_application, proceeding).call end def initialize(legal_aid_application, proceeding) @legal_aid_application = legal_aid_application @proceeding = proceeding end def...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/add_proceeding_service.rb
Ruby
mit
19
main
1,572
module LegalFramework class AddProceedingService def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end def call(params) return false unless params[:ccms_code] new_proceeding = nil @ccms_code = params[:ccms_code] ActiveRecord::Base.transac...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/lead_proceeding_assignment_service.rb
Ruby
mit
19
main
858
# assigns the first domestic abuse proceeding type as lead if one isn't assigned already # not an error condition if there are no domestic abuse proceedings. # module LegalFramework class LeadProceedingAssignmentService def self.call(legal_aid_application) new(legal_aid_application).call end def in...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/submission_error.rb
Ruby
mit
19
main
243
module LegalFramework 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/legal_framework/proceeding_types/proceeding.rb
Ruby
mit
19
main
2,107
module LegalFramework module ProceedingTypes class Proceeding class Response attr_reader :success, :ccms_code, :meaning, :ccms_category_law_code, :ccms_matter_code, :name, :descrip...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/proceeding_types/all.rb
Ruby
mit
19
main
2,350
module LegalFramework module ProceedingTypes class All < BaseApiCall class NoMatchingProceedingsFoundError < StandardError; end class ProceedingTypeStruct attr_reader :ccms_code, :meaning, :description, :ccms_category_law, :ccms_matter_code, :ccms_matter, :sca_core, :sca_related, :plf ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/proceeding_types/defaults.rb
Ruby
mit
19
main
1,117
module LegalFramework module ProceedingTypes class Defaults PATH = "/proceeding_type_defaults".freeze def self.call(proceeding, emergency) new(proceeding, emergency).call end def initialize(proceeding, emergency) @proceeding = proceeding @emergency = emergency ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/proceeding_types/scopes.rb
Ruby
mit
19
main
1,295
module LegalFramework module ProceedingTypes class Scopes PATH = "/proceeding_type_scopes".freeze def self.call(proceeding, emergency) new(proceeding, emergency).call end def initialize(proceeding, emergency) @proceeding = proceeding @level_of_service_code = emerg...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/non_uk_home_addresses/all.rb
Ruby
mit
19
main
573
module LegalFramework module NonUkHomeAddresses class All < LegalFramework::BaseApiCall class CountryNames attr_reader :code, :description def initialize(country_names_hash) @code = country_names_hash["code"] @description = country_names_hash["description"] end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/client_involvement_types/proceeding.rb
Ruby
mit
19
main
1,072
module LegalFramework module ClientInvolvementTypes class Proceeding < LegalFramework::BaseApiCall class ClientInvolvementTypeStruct attr_reader :ccms_code, :description def initialize(cit_hash) @ccms_code = cit_hash["ccms_code"] @description = update_description(cit_has...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/organisations/all.rb
Ruby
mit
19
main
707
module LegalFramework module Organisations class All < BaseApiCall class OrganisationStruct attr_reader :name, :ccms_type_code, :ccms_type_text, :ccms_opponent_id def initialize(org_hash) @name = org_hash["name"] @ccms_type_code = org_hash["ccms_type_code"] @cc...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_framework/organisation_types/all.rb
Ruby
mit
19
main
556
module LegalFramework module OrganisationTypes class All < LegalFramework::BaseApiCall class OrganisationTypeStruct attr_reader :ccms_code, :description def initialize(organisation_type_hash) @ccms_code = organisation_type_hash["ccms_code"] @description = organisation_ty...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/migration_helpers/state_changer.rb
Ruby
mit
19
main
2,608
module MigrationHelpers class StateChanger STATE_CHANGES = [ [:initiated, :entering_applicant_details, %(provider_step != 'address_lookups')], [:checking_client_details_answers, :checking_applicant_details, nil], [:client_details_answers_checked, :applicant_details_checked, %(provider_step = 'ch...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/govuk_emails/monitor.rb
Ruby
mit
19
main
2,791
module GovukEmails class Monitor attr_reader :scheduled_mail delegate :legal_aid_application, to: :scheduled_mail delegate :applicant, :provider, to: :legal_aid_application def self.call(scheduled_mail_id) new(scheduled_mail_id).call end def initialize(scheduled_mail_id) @schedu...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/govuk_emails/delivery_man.rb
Ruby
mit
19
main
1,189
module GovukEmails class DeliveryMan attr_reader :scheduled_mail delegate :arguments, :mailer_klass, :mailer_method, to: :scheduled_mail def self.call(scheduled_mail_id) new(scheduled_mail_id).call end def initialize(scheduled_mail_id) @scheduled_mail = Sch...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/govuk_emails/email.rb
Ruby
mit
19
main
841
module GovukEmails class Email attr_reader :id delegate :status, to: :response # states documentation: # https://docs.notifications.service.gov.uk/ruby.html#status-optional RESENDABLE_STATUS = %w[temporary-failure technical-failure].freeze PERMANENTLY_FAILED_STATUS = "permanent-failure".free...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/query/incomplete_proceedings.rb
Ruby
mit
19
main
1,531
module Query class IncompleteProceedings def initialize(legal_aid_application) @legal_aid_application = legal_aid_application end def self.call(legal_aid_application) new(legal_aid_application).call end def call results = ActiveRecord::Base.connection.execute(query) Proce...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/slack/send_message.rb
Ruby
mit
19
main
602
module Slack class SendMessage def self.call(message) new(message).call end def initialize(message) raise "No slack webhook found" if webhook.nil? @message = message end def call request.body end private def webhook @webhook ||= ENV.fetch("SLACK_ALERT_W...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/legal_aid_applications/calculation_date_service.rb
Ruby
mit
19
main
685
module LegalAidApplications class CalculationDateService attr_accessor :legal_aid_application delegate( :used_delegated_functions_on, :used_delegated_functions?, :applicant_receives_benefit?, :transaction_period_finish_on, to: :legal_aid_application ) def self.call(*) new(*).call ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/mock_interface_response_service.rb
Ruby
mit
19
main
3,422
module HMRC class MockInterfaceResponseService MATCHED = { single_employment: { first_name: "Langley", last_name: "Yorke", nino: "MN212451D", dob: "1992-07-22" }, multiple_employments: { first_name: "Ida", last_name: "Paisley", nino: "OE726113A", dob: "1987-11-24" }, weekly_multiple_employment: ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/create_responses_service.rb
Ruby
mit
19
main
1,228
module HMRC class CreateResponsesService USE_CASES = %w[one two].freeze def initialize(legal_aid_application) @legal_aid_application = legal_aid_application @legal_aid_application.set_transaction_period end def self.call(legal_aid_application) new(legal_aid_application).call en...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/status_analyzer.rb
Ruby
mit
19
main
1,475
module HMRC class StatusAnalyzer delegate :provider, :applicant, to: :legal_aid_application delegate :has_multiple_employments?, :hmrc_employment_income?, :eligible_employment_payments, to: :applicant attr_reader :legal_aid_application ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/partner_status_analyzer.rb
Ruby
mit
19
main
1,275
module HMRC class PartnerStatusAnalyzer < StatusAnalyzer delegate :provider, :partner, to: :legal_aid_application delegate :has_multiple_employments?, :hmrc_employment_income?, :eligible_employment_payments, to: :partner attr_reader :legal_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/interface/result_service.rb
Ruby
mit
19
main
594
module HMRC module Interface class ResultService < BaseService def call raw_response = run_get_request parsed_response = parse_json_response(raw_response.body) case raw_response.status when 200, 202 parsed_response else raise HMRC::InterfaceError.n...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/interface/base_service.rb
Ruby
mit
19
main
1,695
module HMRC module Interface class BaseService def self.call(hmrc_response) new(hmrc_response).call end def initialize(hmrc_response) @hmrc_response = hmrc_response end private def conn @conn ||= Faraday.new(url: host, headers:) end def bea...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/interface/submission_service.rb
Ruby
mit
19
main
1,499
module HMRC module Interface class SubmissionService < BaseService def call raw_response = post_request parsed_response = parse_json_response(raw_response.body) case raw_response.status when 202 parsed_response else raise HMRC::InterfaceError.new(d...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/parsed_response/validator.rb
Ruby
mit
19
main
4,297
module HMRC module ParsedResponse class Validator attr_accessor :errors Error = Struct.new(:attribute, :message) # person can be Applicant or Partner def self.call(hmrc_response, person:) new(hmrc_response, person:).call end def initialize(hmrc_response, person:) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/hmrc/parsed_response/persistor.rb
Ruby
mit
19
main
2,863
module HMRC module ParsedResponse class Persistor def self.call(hmrc_response) new(hmrc_response).call end def initialize(hmrc_response) @hmrc_response = hmrc_response @application = hmrc_response.legal_aid_application @person = @hmrc_response.owner end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/ccms_user/connection.rb
Ruby
mit
19
main
584
module CCMSUser class Connection extend Forwardable attr_reader :conn def_delegators :conn, :get def initialize @conn = Faraday.new(url:, headers:) end private def url Rails.configuration.x.ccms_user_api.url end def headers { "Content-Type" => "applica...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/ccms_user/user_details.rb
Ruby
mit
19
main
980
module CCMSUser class UserDetails ApiError = Class.new(StandardError) UserNotFound = Class.new(StandardError) extend Forwardable def self.call(silas_id) new(silas_id).call end def initialize(silas_id) @silas_id = silas_id end def call response = request if ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/check_provider_answers.rb
Ruby
mit
19
main
2,253
module TaskStatus class CheckProviderAnswers < Base # Check your answers validation/completion logic: # Rules: # 1. If not all prior sections completed then it is "Not ready yet" # 2. If all prior sections completed but CYA page not completed(*1) then it is "Not started" # 3. If all prior se...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/value_object.rb
Ruby
mit
19
main
1,352
module TaskStatus StatusData = Data.define(:value, :colour) class ValueObject attr_accessor :value STATUSES = [ NOT_NEEDED = StatusData.new(:not_needed, nil), CANNOT_START = StatusData.new(:cannot_start, nil), NOT_READY = StatusData.new(:not_ready, "grey"), NOT_STARTED = StatusData...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/dwp_outcome.rb
Ruby
mit
19
main
1,765
module TaskStatus class DWPOutcome < Base def perform(status) status.not_ready! if not_ready? status.not_started! if not_started? status.in_progress! if in_progress? status.completed! if completed? end private def not_ready? return @not_ready if defined?(@not_ready) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/proceedings_types.rb
Ruby
mit
19
main
940
module TaskStatus class ProceedingsTypes < Base private def perform(status) status.cannot_start! status.in_progress! if in_progress? status.not_started! if not_started? status.completed! if completed? end def not_started? return @not_started if defined?(@not_started) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/make_link.rb
Ruby
mit
19
main
681
module TaskStatus class MakeLink < Base private def perform(status) status.not_started! if not_started? status.cannot_start! if cannot_start? status.in_progress! if in_progress? status.completed! if completed? end def not_started? application.linked_application_completed....
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/applicants.rb
Ruby
mit
19
main
438
module TaskStatus class Applicants < Base private def perform(status) status.in_progress! status.not_started! unless applicant status.completed! if completed? end def completed? return @completed if defined?(@completed) @completed = applicants_validator.valid? end ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/base.rb
Ruby
mit
19
main
1,506
# A task status object is responsible for determining what the status # of a particular task is. It is a Task status analyzer or service class! # # There should be a task status subclass for, and named after, each task # presenter object. # # Each task status object should respond to `call` and return a tast status # v...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/partner.rb
Ruby
mit
19
main
1,156
module TaskStatus class Partner < Base private def perform(status) status.cannot_start! unless previous_tasks_completed? status.not_started! if not_started? status.in_progress! if in_progress? status.completed! if completed? status.not_needed! if not_needed? end def not_n...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/validators/dwp_override.rb
Ruby
mit
19
main
570
module TaskStatus module Validators class DWPOverride < Base private def forms [ received_benefit_confirmation_form, has_evidence_of_benefit_form, ] end def received_benefit_confirmation_form @received_benefit_confirmation_form ||= ::Providers::R...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/validators/applicants.rb
Ruby
mit
19
main
1,102
module TaskStatus module Validators class Applicants < Base private def forms [ basic_details_form, has_national_insurance_number_form, previous_reference_form, ] end # models that have validation or "completion" logic across multiple forms wil...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/validators/proceedings_types.rb
Ruby
mit
19
main
4,367
module TaskStatus module Validators class ProceedingsTypes < Base def valid? return false if proceedings.empty? super end private delegate :proceedings, to: :application def forms proceedings.flat_map { |proceeding| forms_for(proceeding) } << emergency_cost_...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/validators/partner.rb
Ruby
mit
19
main
656
module TaskStatus module Validators class Partner < Base def valid? return false if missing_details? return true unless applicant&.has_partner? applicant.partner_has_contrary_interest? || partner_details_form.valid? end private delegate :partner, :applicant, to: :a...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/validators/base.rb
Ruby
mit
19
main
594
module TaskStatus module Validators class Base attr_reader :application delegate :applicant, :dwp_override, to: :application delegate :address, to: :applicant def initialize(application) @application = application end def valid? forms.all?(&:valid?) && ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/task_status/validators/address.rb
Ruby
mit
19
main
1,436
module TaskStatus module Validators class Address def initialize(applicant) @applicant = applicant end def valid? address? end private attr_reader :applicant delegate :address, to: :applicant def address? applicant.correspondence_address_c...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/copy_case/cloner_service.rb
Ruby
mit
19
main
4,155
module CopyCase class ClonerService class ClonerServiceError < StandardError; end attr_accessor :target, :source def self.call(target, source) new(target, source).call end def initialize(target, source) @target = target @source = source end def call clone_involv...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/base_flow_service.rb
Ruby
mit
19
main
2,369
module Flow class BaseFlowService class << self attr_reader :steps def use_steps(steps) @steps = steps end def flow_service_for(journey_type, **) klass = case journey_type when :citizens Flow::CitizenFlowService when :prov...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/provider_flow_service.rb
Ruby
mit
19
main
825
module Flow class ProviderFlowService < BaseFlowService steps = {}.deep_merge(Flows::ProviderStart::STEPS) .deep_merge(Flows::ProviderProceedingInterrupts::STEPS) .deep_merge(Flows::ProviderPartner::STEPS) .deep_merge(Flows::ProviderMeansStateBenefits::STEPS) ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/citizen_flow_service.rb
Ruby
mit
19
main
202
module Flow class CitizenFlowService < BaseFlowService steps = {}.deep_merge(Flows::CitizenStart::STEPS) .deep_merge(Flows::CitizenEnd::STEPS) use_steps(steps.freeze) end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/proceeding_loop.rb
Ruby
mit
19
main
5,268
module Flow class ProceedingLoop LOOP_CONTROLLERS = %w[client_involvement_type delegated_functions confirm_delegated_functions_date emergency_defaults emergency_level_of_service emerge...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/merits_loop.rb
Ruby
mit
19
main
2,526
module Flow class MeritsLoop def initialize(legal_aid_application, group) @legal_aid_application = legal_aid_application @group = group end def self.forward_flow(legal_aid_application, group) new(legal_aid_application, group).forward_flow end def forward_flow next_task ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/key_point.rb
Ruby
mit
19
main
1,387
module Flow # Used to define the point in the flow by labels that are relevant to their place in the flow rather than the role of # the page itself. In particular, points where the flow forks, branches rejoin the flow, or the start/end of sequences. class KeyPoint KEY_POINTS = { citizens: {}, prov...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_partner.rb
Ruby
mit
19
main
2,069
module Flow module Flows class ProviderPartner STEPS = { client_has_partners: Steps::Partner::ClientHasPartnersStep, contrary_interests: Steps::Partner::ContraryInterestsStep, partner_employed_but_no_hmrc_data_interrupts: Steps::Partner::EmployedButNoHMRCDataInterruptsStep, p...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/citizen_start.rb
Ruby
mit
19
main
604
module Flow module Flows class CitizenStart STEPS = { legal_aid_applications: Steps::CitizenStart::LegalAidApplicationsStep, consents: Steps::CitizenStart::ConsentsStep, contact_providers: Steps::CitizenStart::ContactProviderStep, banks: Steps::CitizenStart::BanksStep, ...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_income.rb
Ruby
mit
19
main
1,970
module Flow module Flows class ProviderIncome STEPS = { client_completed_means: Steps::ProviderIncome::ClientCompletedMeansStep, employed_but_no_hmrc_data_interrupts: Steps::ProviderIncome::EmployedButNoHMRCDataInterruptsStep, hmrc_unavailable_interrupts: Steps::ProviderIncome::HMRCU...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_dwp_override.rb
Ruby
mit
19
main
379
module Flow module Flows class ProviderDWPOverride STEPS = { check_client_details: Steps::ProviderDWPOverride::CheckClientDetailsStep, received_benefit_confirmations: Steps::ProviderDWPOverride::ReceivedBenefitConfirmationsStep, has_evidence_of_benefits: Steps::ProviderDWPOverride::H...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_proceeding_loop.rb
Ruby
mit
19
main
1,032
module Flow module Flows class ProviderProceedingLoop STEPS = { client_involvement_type: Steps::ProviderProceedingLoop::ClientInvolvementTypeStep, delegated_functions: Steps::ProviderProceedingLoop::DelegatedFunctionsStep, confirm_delegated_functions_date: Steps::ProviderProceedingLo...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_means_state_benefits.rb
Ruby
mit
19
main
460
module Flow module Flows class ProviderMeansStateBenefits STEPS = { receives_state_benefits: Steps::ProviderMeansStateBenefits::ReceivesStateBenefitsStep, state_benefits: Steps::ProviderMeansStateBenefits::StateBenefitsStep, add_other_state_benefits: Steps::ProviderMeansStateBenefits...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_capital.rb
Ruby
mit
19
main
1,703
module Flow module Flows class ProviderCapital STEPS = { capital_introductions: Steps::ProviderCapital::IntroductionsStep, own_homes: Steps::ProviderCapital::OwnHomesStep, property_details: Steps::ProviderCapital::PropertyDetailsStep, property_details_interrupts: Steps::Provi...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_dependants.rb
Ruby
mit
19
main
401
module Flow module Flows class ProviderDependants STEPS = { has_dependants: Steps::ProviderDependants::HasDependantsStep, dependants: Steps::ProviderDependants::DependantsStep, has_other_dependants: Steps::ProviderDependants::HasOtherDependantsStep, remove_dependants: Flow::S...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_capital_disregards.rb
Ruby
mit
19
main
384
module Flow module Flows class ProviderCapitalDisregards STEPS = { capital_disregards_discretionary: Steps::ProviderCapitalDisregards::DiscretionaryStep, capital_disregards_mandatory: Steps::ProviderCapitalDisregards::MandatoryStep, capital_disregards_add_details: Steps::ProviderCapi...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_start.rb
Ruby
mit
19
main
4,014
module Flow module Flows class ProviderStart STEPS = { providers_home: Steps::ProvidersHomeStep, delete: Steps::DeleteStep, applicants: Steps::ProviderStart::ApplicantsStep, applicant_details: Steps::ProviderStart::ApplicantDetailsStep, previous_references: Steps::Pro...
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/citizen_end.rb
Ruby
mit
19
main
226
module Flow module Flows class CitizenEnd STEPS = { check_answers: Steps::CitizenEnd::CheckAnswersStep, means_test_results: Steps::CitizenEnd::MeansTestResultsStep, }.freeze end end end
github
ministryofjustice/laa-apply-for-legal-aid
https://github.com/ministryofjustice/laa-apply-for-legal-aid
app/services/flow/flows/provider_merits.rb
Ruby
mit
19
main
4,012
module Flow module Flows class ProviderMerits STEPS = { start_involved_children_task: Steps::ProviderMerits::StartInvolvedChildrenTaskStep, involved_children: Steps::ProviderMerits::InvolvedChildrenStep, has_other_involved_children: Steps::ProviderMerits::HasOtherInvolvedChildrenStep...