diff --git a/docs/code_samples/payslip_fra_v2_async.txt b/docs/code_samples/payslip_fra_v2_async.txt deleted file mode 100644 index 552ad0f5..00000000 --- a/docs/code_samples/payslip_fra_v2_async.txt +++ /dev/null @@ -1,24 +0,0 @@ -# -# Install the Ruby client library by running: -# gem install mindee -# - -require 'mindee' - -# Init a new client -mindee_client = Mindee::Client.new(api_key: 'my-api-key') - -# Load a file from disk -input_source = mindee_client.source_from_path('/path/to/the/file.ext') - -# Parse the file -result = mindee_client.parse( - input_source, - Mindee::Product::FR::Payslip::PayslipV2 -) - -# Print a full summary of the parsed data in RST format -puts result.document - -# Print the document-level parsed data -# puts result.document.inference.prediction diff --git a/lib/mindee/product.rb b/lib/mindee/product.rb index 489b76ce..61cce8af 100644 --- a/lib/mindee/product.rb +++ b/lib/mindee/product.rb @@ -15,7 +15,6 @@ require_relative 'product/fr/health_card/health_card_v1' require_relative 'product/fr/id_card/id_card_v1' require_relative 'product/fr/id_card/id_card_v2' -require_relative 'product/fr/payslip/payslip_v2' require_relative 'product/fr/payslip/payslip_v3' require_relative 'product/ind/indian_passport/indian_passport_v1' require_relative 'product/international_id/international_id_v2' diff --git a/lib/mindee/product/fr/payslip/payslip_v2.rb b/lib/mindee/product/fr/payslip/payslip_v2.rb deleted file mode 100644 index 68eb1239..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' -require_relative 'payslip_v2_document' -require_relative 'payslip_v2_page' - -module Mindee - module Product - module FR - # Payslip module. - module Payslip - # Payslip API version 2 inference prediction. - class PayslipV2 < Mindee::Parsing::Common::Inference - @endpoint_name = 'payslip_fra' - @endpoint_version = '2' - @has_async = true - @has_sync = false - - # @param prediction [Hash] - def initialize(prediction) - super - @prediction = PayslipV2Document.new(prediction['prediction'], nil) - @pages = [] - prediction['pages'].each do |page| - @pages.push(PayslipV2Page.new(page)) - end - end - - class << self - # Name of the endpoint for this product. - # @return [String] - attr_reader :endpoint_name - # Version for this product. - # @return [String] - attr_reader :endpoint_version - # Whether this product has access to an asynchronous endpoint. - # @return [bool] - attr_reader :has_async - # Whether this product has access to synchronous endpoint. - # @return [bool] - attr_reader :has_sync - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb b/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb deleted file mode 100644 index fd43efb9..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Information about the employee's bank account. - class PayslipV2BankAccountDetail < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The name of the bank. - # @return [String] - attr_reader :bank_name - # The IBAN of the bank account. - # @return [String] - attr_reader :iban - # The SWIFT code of the bank. - # @return [String] - attr_reader :swift - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @bank_name = prediction['bank_name'] - @iban = prediction['iban'] - @swift = prediction['swift'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:bank_name] = format_for_display(@bank_name) - printable[:iban] = format_for_display(@iban) - printable[:swift] = format_for_display(@swift) - printable - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :Bank Name: #{printable[:bank_name]}" - out_str << "\n :IBAN: #{printable[:iban]}" - out_str << "\n :SWIFT: #{printable[:swift]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_document.rb b/lib/mindee/product/fr/payslip/payslip_v2_document.rb deleted file mode 100644 index 1643fde6..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_document.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' -require_relative 'payslip_v2_employee' -require_relative 'payslip_v2_employer' -require_relative 'payslip_v2_bank_account_detail' -require_relative 'payslip_v2_employment' -require_relative 'payslip_v2_salary_details' -require_relative 'payslip_v2_pay_detail' -require_relative 'payslip_v2_pto' -require_relative 'payslip_v2_pay_period' - -module Mindee - module Product - module FR - module Payslip - # Payslip API version 2.0 document data. - class PayslipV2Document < Mindee::Parsing::Common::Prediction - include Mindee::Parsing::Standard - # Information about the employee's bank account. - # @return [Mindee::Product::FR::Payslip::PayslipV2BankAccountDetail] - attr_reader :bank_account_details - # Information about the employee. - # @return [Mindee::Product::FR::Payslip::PayslipV2Employee] - attr_reader :employee - # Information about the employer. - # @return [Mindee::Product::FR::Payslip::PayslipV2Employer] - attr_reader :employer - # Information about the employment. - # @return [Mindee::Product::FR::Payslip::PayslipV2Employment] - attr_reader :employment - # Detailed information about the pay. - # @return [Mindee::Product::FR::Payslip::PayslipV2PayDetail] - attr_reader :pay_detail - # Information about the pay period. - # @return [Mindee::Product::FR::Payslip::PayslipV2PayPeriod] - attr_reader :pay_period - # Information about paid time off. - # @return [Mindee::Product::FR::Payslip::PayslipV2Pto] - attr_reader :pto - # Detailed information about the earnings. - # @return [Mindee::Product::FR::Payslip::PayslipV2SalaryDetails] - attr_reader :salary_details - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @bank_account_details = Product::FR::Payslip::PayslipV2BankAccountDetail.new( - prediction['bank_account_details'], - page_id - ) - @employee = Product::FR::Payslip::PayslipV2Employee.new( - prediction['employee'], - page_id - ) - @employer = Product::FR::Payslip::PayslipV2Employer.new( - prediction['employer'], - page_id - ) - @employment = Product::FR::Payslip::PayslipV2Employment.new( - prediction['employment'], - page_id - ) - @pay_detail = Product::FR::Payslip::PayslipV2PayDetail.new( - prediction['pay_detail'], - page_id - ) - @pay_period = Product::FR::Payslip::PayslipV2PayPeriod.new( - prediction['pay_period'], - page_id - ) - @pto = Product::FR::Payslip::PayslipV2Pto.new(prediction['pto'], page_id) - @salary_details = Product::FR::Payslip::PayslipV2SalaryDetails.new(prediction['salary_details'], page_id) - end - - # @return [String] - def to_s - employee = @employee.to_s - employer = @employer.to_s - bank_account_details = @bank_account_details.to_s - employment = @employment.to_s - salary_details = salary_details_to_s - pay_detail = @pay_detail.to_s - pto = @pto.to_s - pay_period = @pay_period.to_s - out_str = String.new - out_str << "\n:Employee:" - out_str << employee - out_str << "\n:Employer:" - out_str << employer - out_str << "\n:Bank Account Details:" - out_str << bank_account_details - out_str << "\n:Employment:" - out_str << employment - out_str << "\n:Salary Details:" - out_str << salary_details - out_str << "\n:Pay Detail:" - out_str << pay_detail - out_str << "\n:PTO:" - out_str << pto - out_str << "\n:Pay Period:" - out_str << pay_period - out_str[1..].to_s - end - - private - - # @param char [String] - # @return [String] - def salary_details_separator(char) - out_str = String.new - out_str << ' ' - out_str << "+#{char * 14}" - out_str << "+#{char * 11}" - out_str << "+#{char * 38}" - out_str << "+#{char * 11}" - out_str << '+' - out_str - end - - # @return [String] - def salary_details_to_s - return '' if @salary_details.empty? - - line_items = @salary_details.map(&:to_table_line).join("\n#{salary_details_separator('-')}\n ") - out_str = String.new - out_str << "\n#{salary_details_separator('-')}" - out_str << "\n |" - out_str << ' Amount |' - out_str << ' Base |' - out_str << ' Description |' - out_str << ' Rate |' - out_str << "\n#{salary_details_separator('=')}" - out_str << "\n #{line_items}" - out_str << "\n#{salary_details_separator('-')}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_employee.rb b/lib/mindee/product/fr/payslip/payslip_v2_employee.rb deleted file mode 100644 index 9dd1d2da..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Information about the employee. - class PayslipV2Employee < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The address of the employee. - # @return [String] - attr_reader :address - # The date of birth of the employee. - # @return [String] - attr_reader :date_of_birth - # The first name of the employee. - # @return [String] - attr_reader :first_name - # The last name of the employee. - # @return [String] - attr_reader :last_name - # The phone number of the employee. - # @return [String] - attr_reader :phone_number - # The registration number of the employee. - # @return [String] - attr_reader :registration_number - # The social security number of the employee. - # @return [String] - attr_reader :social_security_number - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @address = prediction['address'] - @date_of_birth = prediction['date_of_birth'] - @first_name = prediction['first_name'] - @last_name = prediction['last_name'] - @phone_number = prediction['phone_number'] - @registration_number = prediction['registration_number'] - @social_security_number = prediction['social_security_number'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:address] = format_for_display(@address) - printable[:date_of_birth] = format_for_display(@date_of_birth) - printable[:first_name] = format_for_display(@first_name) - printable[:last_name] = format_for_display(@last_name) - printable[:phone_number] = format_for_display(@phone_number) - printable[:registration_number] = format_for_display(@registration_number) - printable[:social_security_number] = format_for_display(@social_security_number) - printable - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :Address: #{printable[:address]}" - out_str << "\n :Date of Birth: #{printable[:date_of_birth]}" - out_str << "\n :First Name: #{printable[:first_name]}" - out_str << "\n :Last Name: #{printable[:last_name]}" - out_str << "\n :Phone Number: #{printable[:phone_number]}" - out_str << "\n :Registration Number: #{printable[:registration_number]}" - out_str << "\n :Social Security Number: #{printable[:social_security_number]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_employer.rb b/lib/mindee/product/fr/payslip/payslip_v2_employer.rb deleted file mode 100644 index d7452651..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Information about the employer. - class PayslipV2Employer < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The address of the employer. - # @return [String] - attr_reader :address - # The company ID of the employer. - # @return [String] - attr_reader :company_id - # The site of the company. - # @return [String] - attr_reader :company_site - # The NAF code of the employer. - # @return [String] - attr_reader :naf_code - # The name of the employer. - # @return [String] - attr_reader :name - # The phone number of the employer. - # @return [String] - attr_reader :phone_number - # The URSSAF number of the employer. - # @return [String] - attr_reader :urssaf_number - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @address = prediction['address'] - @company_id = prediction['company_id'] - @company_site = prediction['company_site'] - @naf_code = prediction['naf_code'] - @name = prediction['name'] - @phone_number = prediction['phone_number'] - @urssaf_number = prediction['urssaf_number'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:address] = format_for_display(@address) - printable[:company_id] = format_for_display(@company_id) - printable[:company_site] = format_for_display(@company_site) - printable[:naf_code] = format_for_display(@naf_code) - printable[:name] = format_for_display(@name) - printable[:phone_number] = format_for_display(@phone_number) - printable[:urssaf_number] = format_for_display(@urssaf_number) - printable - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :Address: #{printable[:address]}" - out_str << "\n :Company ID: #{printable[:company_id]}" - out_str << "\n :Company Site: #{printable[:company_site]}" - out_str << "\n :NAF Code: #{printable[:naf_code]}" - out_str << "\n :Name: #{printable[:name]}" - out_str << "\n :Phone Number: #{printable[:phone_number]}" - out_str << "\n :URSSAF Number: #{printable[:urssaf_number]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_employment.rb b/lib/mindee/product/fr/payslip/payslip_v2_employment.rb deleted file mode 100644 index 1221a046..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Information about the employment. - class PayslipV2Employment < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The category of the employment. - # @return [String] - attr_reader :category - # The coefficient of the employment. - # @return [Float] - attr_reader :coefficient - # The collective agreement of the employment. - # @return [String] - attr_reader :collective_agreement - # The job title of the employee. - # @return [String] - attr_reader :job_title - # The position level of the employment. - # @return [String] - attr_reader :position_level - # The start date of the employment. - # @return [String] - attr_reader :start_date - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @category = prediction['category'] - @coefficient = prediction['coefficient'] - @collective_agreement = prediction['collective_agreement'] - @job_title = prediction['job_title'] - @position_level = prediction['position_level'] - @start_date = prediction['start_date'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:category] = format_for_display(@category) - printable[:coefficient] = - @coefficient.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@coefficient) - printable[:collective_agreement] = format_for_display(@collective_agreement) - printable[:job_title] = format_for_display(@job_title) - printable[:position_level] = format_for_display(@position_level) - printable[:start_date] = format_for_display(@start_date) - printable - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :Category: #{printable[:category]}" - out_str << "\n :Coefficient: #{printable[:coefficient]}" - out_str << "\n :Collective Agreement: #{printable[:collective_agreement]}" - out_str << "\n :Job Title: #{printable[:job_title]}" - out_str << "\n :Position Level: #{printable[:position_level]}" - out_str << "\n :Start Date: #{printable[:start_date]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_page.rb b/lib/mindee/product/fr/payslip/payslip_v2_page.rb deleted file mode 100644 index 05e8914b..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_page.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' -require_relative 'payslip_v2_document' - -module Mindee - module Product - module FR - module Payslip - # Payslip API version 2.0 page data. - class PayslipV2Page < Mindee::Parsing::Common::Page - # @param prediction [Hash] - def initialize(prediction) - super - @prediction = if prediction['prediction'].empty? - nil - else - PayslipV2PagePrediction.new( - prediction['prediction'], - prediction['id'] - ) - end - end - end - - # Payslip V2 page prediction. - class PayslipV2PagePrediction < PayslipV2Document - # @return [String] - def to_s - out_str = String.new - out_str << "\n#{super}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb b/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb deleted file mode 100644 index 8ebe6ca0..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +++ /dev/null @@ -1,122 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Detailed information about the pay. - class PayslipV2PayDetail < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The gross salary of the employee. - # @return [Float] - attr_reader :gross_salary - # The year-to-date gross salary of the employee. - # @return [Float] - attr_reader :gross_salary_ytd - # The income tax rate of the employee. - # @return [Float] - attr_reader :income_tax_rate - # The income tax withheld from the employee's pay. - # @return [Float] - attr_reader :income_tax_withheld - # The net paid amount of the employee. - # @return [Float] - attr_reader :net_paid - # The net paid amount before tax of the employee. - # @return [Float] - attr_reader :net_paid_before_tax - # The net taxable amount of the employee. - # @return [Float] - attr_reader :net_taxable - # The year-to-date net taxable amount of the employee. - # @return [Float] - attr_reader :net_taxable_ytd - # The total cost to the employer. - # @return [Float] - attr_reader :total_cost_employer - # The total taxes and deductions of the employee. - # @return [Float] - attr_reader :total_taxes_and_deductions - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @gross_salary = prediction['gross_salary'] - @gross_salary_ytd = prediction['gross_salary_ytd'] - @income_tax_rate = prediction['income_tax_rate'] - @income_tax_withheld = prediction['income_tax_withheld'] - @net_paid = prediction['net_paid'] - @net_paid_before_tax = prediction['net_paid_before_tax'] - @net_taxable = prediction['net_taxable'] - @net_taxable_ytd = prediction['net_taxable_ytd'] - @total_cost_employer = prediction['total_cost_employer'] - @total_taxes_and_deductions = prediction['total_taxes_and_deductions'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:gross_salary] = - @gross_salary.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@gross_salary) - printable[:gross_salary_ytd] = - @gross_salary_ytd.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@gross_salary_ytd) - printable[:income_tax_rate] = - @income_tax_rate.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@income_tax_rate) - printable[:income_tax_withheld] = - if @income_tax_withheld.nil? - '' - else - Parsing::Standard::BaseField.float_to_string(@income_tax_withheld) - end - printable[:net_paid] = - @net_paid.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@net_paid) - printable[:net_paid_before_tax] = - if @net_paid_before_tax.nil? - '' - else - Parsing::Standard::BaseField.float_to_string(@net_paid_before_tax) - end - printable[:net_taxable] = - @net_taxable.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@net_taxable) - printable[:net_taxable_ytd] = - @net_taxable_ytd.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@net_taxable_ytd) - printable[:total_cost_employer] = - if @total_cost_employer.nil? - '' - else - Parsing::Standard::BaseField.float_to_string(@total_cost_employer) - end - printable[:total_taxes_and_deductions] = - if @total_taxes_and_deductions.nil? - '' - else - Parsing::Standard::BaseField.float_to_string(@total_taxes_and_deductions) - end - printable - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :Gross Salary: #{printable[:gross_salary]}" - out_str << "\n :Gross Salary YTD: #{printable[:gross_salary_ytd]}" - out_str << "\n :Income Tax Rate: #{printable[:income_tax_rate]}" - out_str << "\n :Income Tax Withheld: #{printable[:income_tax_withheld]}" - out_str << "\n :Net Paid: #{printable[:net_paid]}" - out_str << "\n :Net Paid Before Tax: #{printable[:net_paid_before_tax]}" - out_str << "\n :Net Taxable: #{printable[:net_taxable]}" - out_str << "\n :Net Taxable YTD: #{printable[:net_taxable_ytd]}" - out_str << "\n :Total Cost Employer: #{printable[:total_cost_employer]}" - out_str << "\n :Total Taxes and Deductions: #{printable[:total_taxes_and_deductions]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb b/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb deleted file mode 100644 index 6d731f1d..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Information about the pay period. - class PayslipV2PayPeriod < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The end date of the pay period. - # @return [String] - attr_reader :end_date - # The month of the pay period. - # @return [String] - attr_reader :month - # The date of payment for the pay period. - # @return [String] - attr_reader :payment_date - # The start date of the pay period. - # @return [String] - attr_reader :start_date - # The year of the pay period. - # @return [String] - attr_reader :year - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @end_date = prediction['end_date'] - @month = prediction['month'] - @payment_date = prediction['payment_date'] - @start_date = prediction['start_date'] - @year = prediction['year'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:end_date] = format_for_display(@end_date) - printable[:month] = format_for_display(@month) - printable[:payment_date] = format_for_display(@payment_date) - printable[:start_date] = format_for_display(@start_date) - printable[:year] = format_for_display(@year) - printable - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :End Date: #{printable[:end_date]}" - out_str << "\n :Month: #{printable[:month]}" - out_str << "\n :Payment Date: #{printable[:payment_date]}" - out_str << "\n :Start Date: #{printable[:start_date]}" - out_str << "\n :Year: #{printable[:year]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_pto.rb b/lib/mindee/product/fr/payslip/payslip_v2_pto.rb deleted file mode 100644 index 22387410..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Information about paid time off. - class PayslipV2Pto < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The amount of paid time off accrued in this period. - # @return [Float] - attr_reader :accrued_this_period - # The balance of paid time off at the end of the period. - # @return [Float] - attr_reader :balance_end_of_period - # The amount of paid time off used in this period. - # @return [Float] - attr_reader :used_this_period - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @accrued_this_period = prediction['accrued_this_period'] - @balance_end_of_period = prediction['balance_end_of_period'] - @used_this_period = prediction['used_this_period'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:accrued_this_period] = - if @accrued_this_period.nil? - '' - else - Parsing::Standard::BaseField.float_to_string(@accrued_this_period) - end - printable[:balance_end_of_period] = - if @balance_end_of_period.nil? - '' - else - Parsing::Standard::BaseField.float_to_string(@balance_end_of_period) - end - printable[:used_this_period] = - @used_this_period.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@used_this_period) - printable - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :Accrued This Period: #{printable[:accrued_this_period]}" - out_str << "\n :Balance End of Period: #{printable[:balance_end_of_period]}" - out_str << "\n :Used This Period: #{printable[:used_this_period]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb b/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb deleted file mode 100644 index 48328cf1..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true - -require_relative '../../../parsing' - -module Mindee - module Product - module FR - module Payslip - # Detailed information about the earnings. - class PayslipV2SalaryDetail < Mindee::Parsing::Standard::FeatureField - include Mindee::Parsing::Standard - # The amount of the earnings. - # @return [Float] - attr_reader :amount - # The base value of the earnings. - # @return [Float] - attr_reader :base - # The description of the earnings. - # @return [String] - attr_reader :description - # The rate of the earnings. - # @return [Float] - attr_reader :rate - - # @param prediction [Hash] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - super - @amount = prediction['amount'] - @base = prediction['base'] - @description = prediction['description'] - @rate = prediction['rate'] - @page_id = page_id - end - - # @return [Hash] - def printable_values - printable = {} - printable[:amount] = - @amount.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@amount) - printable[:base] = - @base.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@base) - printable[:description] = format_for_display(@description) - printable[:rate] = - @rate.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@rate) - printable - end - - # @return [Hash] - def table_printable_values - printable = {} - printable[:amount] = - @amount.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@amount) - printable[:base] = - @base.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@base) - printable[:description] = format_for_display(@description, 36) - printable[:rate] = - @rate.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@rate) - printable - end - - # @return [String] - def to_table_line - printable = table_printable_values - out_str = String.new - out_str << format('| %- 13s', printable[:amount]) - out_str << format('| %- 10s', printable[:base]) - out_str << format('| %- 37s', printable[:description]) - out_str << format('| %- 10s', printable[:rate]) - out_str << '|' - end - - # @return [String] - def to_s - printable = printable_values - out_str = String.new - out_str << "\n :Amount: #{printable[:amount]}" - out_str << "\n :Base: #{printable[:base]}" - out_str << "\n :Description: #{printable[:description]}" - out_str << "\n :Rate: #{printable[:rate]}" - out_str - end - end - end - end - end -end diff --git a/lib/mindee/product/fr/payslip/payslip_v2_salary_details.rb b/lib/mindee/product/fr/payslip/payslip_v2_salary_details.rb deleted file mode 100644 index f5d5cd5f..00000000 --- a/lib/mindee/product/fr/payslip/payslip_v2_salary_details.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -require_relative 'payslip_v2_employee' -require_relative 'payslip_v2_employer' -require_relative 'payslip_v2_bank_account_detail' -require_relative 'payslip_v2_employment' -require_relative 'payslip_v2_salary_detail' -require_relative 'payslip_v2_pay_detail' -require_relative 'payslip_v2_pto' -require_relative 'payslip_v2_pay_period' - -module Mindee - module Product - module FR - module Payslip - # Detailed information about the earnings. - class PayslipV2SalaryDetails < Array - # Entries. - # @return [Array] - attr_reader :entries - - # @param prediction [Array] - # @param page_id [Integer, nil] - def initialize(prediction, page_id) - entries = prediction.map do |entry| - Payslip::PayslipV2SalaryDetail.new(entry, page_id) - end - super(entries) - end - - # Creates a line of rST table-compliant string separators. - # @param char [String] Character to use as a separator. - # @return [String] - def self.line_items_separator(char) - out_str = String.new - out_str << "+#{char * 14}" - out_str << "+#{char * 11}" - out_str << "+#{char * 38}" - out_str << "+#{char * 11}" - out_str - end - - # @return [String] - def to_s - return '' if empty? - - lines = map do |entry| - "\n #{entry.to_table_line}\n#{self.class.line_items_separator('-')}" - end.join - out_str = String.new - out_str << "\n#{self.class.line_items_separator('-')}\n " - out_str << ' | Amount ' - out_str << ' | Base ' - out_str << ' | Description ' - out_str << ' | Rate ' - out_str << " |\n#{self.class.line_items_separator('=')}" - out_str + lines - end - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2.rbs b/sig/mindee/product/fr/payslip/payslip_v2.rbs deleted file mode 100644 index 9e3660bb..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2.rbs +++ /dev/null @@ -1,13 +0,0 @@ -# lib/mindee/product/../payslip/payslip_v2.rb - -module Mindee - module Product - module FR - module Payslip - class PayslipV2 < Parsing::Common::Inference - def initialize: (Hash[String | Symbol, untyped]) -> void - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs deleted file mode 100644 index 4885054e..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rbs +++ /dev/null @@ -1,16 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2BankAccountDetail < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def bank_name: -> String - def iban: -> String - def swift: -> String - def printable_values: -> Hash[String | Symbol, untyped] - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_document.rbs b/sig/mindee/product/fr/payslip/payslip_v2_document.rbs deleted file mode 100644 index fcc5273c..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_document.rbs +++ /dev/null @@ -1,24 +0,0 @@ -# lib/mindee/product/../payslip/payslip_v2_document.rb - -module Mindee - module Product - module FR - module Payslip - class PayslipV2Document < Parsing::Common::Prediction - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def bank_account_details: -> (Product::FR::Payslip::PayslipV2BankAccountDetail) - def employee: -> (Product::FR::Payslip::PayslipV2Employee) - def employer: -> (Product::FR::Payslip::PayslipV2Employer) - def employment: -> (Product::FR::Payslip::PayslipV2Employment) - def pay_detail: -> (Product::FR::Payslip::PayslipV2PayDetail) - def pay_period: -> (Product::FR::Payslip::PayslipV2PayPeriod) - def pto: -> (Product::FR::Payslip::PayslipV2Pto) - def salary_details: -> (Product::FR::Payslip::PayslipV2SalaryDetails) - def salary_details_separator: (String) -> String - def salary_details_to_s: -> String - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs b/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs deleted file mode 100644 index 9551d048..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_employee.rbs +++ /dev/null @@ -1,20 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2Employee < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def address: -> String - def date_of_birth: -> String - def first_name: -> String - def last_name: -> String - def phone_number: -> String - def registration_number: -> String - def social_security_number: -> String - def printable_values: -> Hash[String | Symbol, untyped] - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs b/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs deleted file mode 100644 index da57db7f..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_employer.rbs +++ /dev/null @@ -1,20 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2Employer < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def address: -> String - def company_id: -> String - def company_site: -> String - def naf_code: -> String - def name: -> String - def phone_number: -> String - def urssaf_number: -> String - def printable_values: -> Hash[String | Symbol, untyped] - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs b/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs deleted file mode 100644 index 2aa5dbb6..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_employment.rbs +++ /dev/null @@ -1,19 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2Employment < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def category: -> String - def coefficient: -> Float - def collective_agreement: -> String - def job_title: -> String - def position_level: -> String - def start_date: -> String - def printable_values: -> Hash[String | Symbol, untyped] - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_page.rbs b/sig/mindee/product/fr/payslip/payslip_v2_page.rbs deleted file mode 100644 index 4b9e3e14..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_page.rbs +++ /dev/null @@ -1,17 +0,0 @@ -# lib/mindee/product/../payslip/payslip_v2_page.rb - -module Mindee - module Product - module FR - module Payslip - class PayslipV2Page < Parsing::Common::Page - def initialize: (Hash[String | Symbol, untyped]) -> void - end - class PayslipV2PagePrediction < PayslipV2Document - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs deleted file mode 100644 index 082f7311..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_pay_detail.rbs +++ /dev/null @@ -1,23 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2PayDetail < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def gross_salary: -> Float - def gross_salary_ytd: -> Float - def income_tax_rate: -> Float - def income_tax_withheld: -> Float - def net_paid: -> Float - def net_paid_before_tax: -> Float - def net_taxable: -> Float - def net_taxable_ytd: -> Float - def total_cost_employer: -> Float - def total_taxes_and_deductions: -> Float - def printable_values: -> Hash[String | Symbol, untyped] - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs b/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs deleted file mode 100644 index 10097ae1..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_pay_period.rbs +++ /dev/null @@ -1,18 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2PayPeriod < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def end_date: -> String - def month: -> String - def payment_date: -> String - def start_date: -> String - def year: -> String - def printable_values: -> Hash[String | Symbol, untyped] - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs b/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs deleted file mode 100644 index 45aae433..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_pto.rbs +++ /dev/null @@ -1,16 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2Pto < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def accrued_this_period: -> Float - def balance_end_of_period: -> Float - def used_this_period: -> Float - def printable_values: -> Hash[String | Symbol, untyped] - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs b/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs deleted file mode 100644 index f6deb33a..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_salary_detail.rbs +++ /dev/null @@ -1,19 +0,0 @@ -module Mindee - module Product - module FR - module Payslip - class PayslipV2SalaryDetail < Parsing::Standard::FeatureField - def initialize: (Hash[String | Symbol, untyped], Integer?) -> void - def amount: -> Float - def base: -> Float - def description: -> String - def rate: -> Float - def printable_values: -> Hash[String | Symbol, untyped] - def table_printable_values: -> Hash[String | Symbol, untyped] - def to_table_line: -> String - def to_s: -> String - end - end - end - end -end diff --git a/sig/mindee/product/fr/payslip/payslip_v2_salary_details.rbs b/sig/mindee/product/fr/payslip/payslip_v2_salary_details.rbs deleted file mode 100644 index 913529a2..00000000 --- a/sig/mindee/product/fr/payslip/payslip_v2_salary_details.rbs +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Mindee - module Product - module FR - module Payslip - class PayslipV2SalaryDetails < Array[PayslipV2SalaryDetail] - def initialize: (Array[untyped], Integer?) -> void - def self.line_items_separator: (String) -> String - def to_s: -> String - end - end - end - end -end diff --git a/spec/v1/product/fr/payslip_v2_spec.rb b/spec/v1/product/fr/payslip_v2_spec.rb deleted file mode 100644 index ef839cf0..00000000 --- a/spec/v1/product/fr/payslip_v2_spec.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -require 'json' -require 'mindee/product' -require 'mindee/parsing' - -require_relative '../../../data' - -DIR_FR_PAYSLIP_V2 = File.join(V1_DATA_DIR, 'products', 'payslip_fra', 'response_v2').freeze - -describe Mindee::Product::FR::Payslip::PayslipV2 do - context 'A Payslip V2' do - it 'should load an empty document prediction' do - response = load_json(DIR_FR_PAYSLIP_V2, 'empty.json') - inference = Mindee::Parsing::Common::Document.new( - Mindee::Product::FR::Payslip::PayslipV2, - response['document'] - ).inference - expect(inference.product.type).to eq('standard') - end - - it 'should load a complete document prediction' do - to_string = read_file(DIR_FR_PAYSLIP_V2, 'summary_full.rst') - response = load_json(DIR_FR_PAYSLIP_V2, 'complete.json') - document = Mindee::Parsing::Common::Document.new( - Mindee::Product::FR::Payslip::PayslipV2, - response['document'] - ) - expect(document.to_s).to eq(to_string) - end - end -end