Sha256: 44ce2f6287929085f64ebff9b3af8cc244a2c722a18eef28fefcd82f39b03112

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

# frozen_string_literal: true

module FFakerTW
  module CompanyFR
    extend ModuleUtils
    extend self

    SUFFIXES = %w[SA et\ fils SARL Groupe].freeze

    def name
      case rand(0..2)
      when 0 then "#{NameFR.last_name} #{suffix}"
      when 1 then "#{NameFR.last_name}-#{NameFR.last_name}"
      when 2 then format('%s, %s and %s', NameFR.last_name, NameFR.last_name, NameFR.last_name)
      end
    end

    def suffix
      fetch_sample(SUFFIXES)
    end

    # Get a random French SIREN number. See more here https://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27identification_du_r%C3%A9pertoire_des_entreprises
    def siren
      base = FFakerTW.numerify('########')
      base + luhn_check(base).to_s
    end

    # Produces a company french siret number.
    def siret
      location = rand(0..99).to_s.rjust(4, '0')
      org_no = siren + location
      org_no + luhn_check(org_no).to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffakerTW-0.1.0 lib/ffakerTW/company_fr.rb