siret_validator 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/README_fr.md +82 -1
- metadata +10 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6f06476bd7c889ebe09ba554aac60a8c48d524bbe114bf37e13ad773253ad21
|
|
4
|
+
data.tar.gz: 036b633b1f9981403fbd50149bd76efef283f001cc4f322b7683ea40da21437d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e73a121e0fb5bb8778fb23fe326350722747e07199ffe1dac41feaf4ef9f62e4a61455c77ff44e841754c67e9ebc4ec71f100b0e33e8432e892e51b9345530de
|
|
7
|
+
data.tar.gz: d27499a5a26030d4ccfb2aacc81d01b467762271eaaec56f2eb73300b0b62ec491507b2c59180adcceb98429826d4326f804baac49510085ad08c216dac48c12
|
data/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
 
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
>
|
|
5
|
+
> Ce README est aussi [disponible en français](README_fr.md).
|
|
2
6
|
|
|
3
7
|
# siret_validator
|
|
4
8
|
|
|
@@ -17,13 +21,13 @@ This gem provides a Rails validator for french [SIRET numbers](https://entrepren
|
|
|
17
21
|
Install the gem and add to the application's Gemfile by executing:
|
|
18
22
|
|
|
19
23
|
```bash
|
|
20
|
-
bundle add
|
|
24
|
+
bundle add siret_validator
|
|
21
25
|
```
|
|
22
26
|
|
|
23
27
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
gem install
|
|
30
|
+
gem install siret_validator
|
|
27
31
|
```
|
|
28
32
|
|
|
29
33
|
Alternatively, you can vendor the gem by just copy-pasting the `lib/siret_validator.rb` file into your `app/validators` directory.
|
|
@@ -62,7 +66,7 @@ By default, the siret validator may emit two different error messages:
|
|
|
62
66
|
|
|
63
67
|
## Development
|
|
64
68
|
|
|
65
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
|
|
69
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake test` to run the tests.
|
|
66
70
|
|
|
67
71
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `siret_validator.gemspec`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
68
72
|
|
|
@@ -76,4 +80,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
76
80
|
|
|
77
81
|
## Code of Conduct
|
|
78
82
|
|
|
79
|
-
Everyone interacting in the SiretFormatValidator project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
|
83
|
+
Everyone interacting in the SiretFormatValidator project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/CodeursenLiberte/siret_validator/blob/main/CODE_OF_CONDUCT.md).
|
data/README_fr.md
CHANGED
|
@@ -1 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
 
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
>
|
|
5
|
+
> This README is also [available in english](README.md).
|
|
6
|
+
|
|
7
|
+
# siret_validator
|
|
8
|
+
|
|
9
|
+
Cette gem fournit un validateur Rails pour les [numéros SIRET](https://entreprendre.service-public.fr/vosdroits/F32135) français.
|
|
10
|
+
|
|
11
|
+
## Fonctionnalités
|
|
12
|
+
|
|
13
|
+
* Validation du format SIRET (14 chiffres),
|
|
14
|
+
* Validation du checksum des SIRET classiques (via la somme de Luhn),
|
|
15
|
+
* Validation du checksum des SIRET de La Poste (via la formule de checksum alternative),
|
|
16
|
+
* Messages d'erreur localisés clairs,
|
|
17
|
+
* Support de messages d'erreur personnalisés.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Installez la gem et ajoutez-la au Gemfile de l'application en exécutant :
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bundle add siret_validator
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Si Bundler n'est pas utilisé pour gérer les dépendances, installez la gem en exécutant :
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
gem install siret_validator
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Vous pouvez également intégrer la gem directement en copiant le fichier `lib/siret_validator.rb` dans votre répertoire `app/validators`.
|
|
34
|
+
|
|
35
|
+
## Utilisation
|
|
36
|
+
|
|
37
|
+
### Avec ActiveRecord
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
class TaxesFilling < ApplicationRecord
|
|
41
|
+
validates :company_siret, siret: true
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Avec ActiveModel
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
class TaxesFilling
|
|
49
|
+
include ActiveModel::Validations
|
|
50
|
+
attr_accessor :company_siret
|
|
51
|
+
validates :company_siret, siret: true
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## I18n
|
|
56
|
+
|
|
57
|
+
Par défaut, le validateur SIRET peut émettre deux messages d'erreur distincts :
|
|
58
|
+
|
|
59
|
+
* `:wrong_siret_format` – lorsque la valeur n'est pas une chaîne de 14 chiffres.
|
|
60
|
+
|
|
61
|
+
_Le message est localisé via la clé i18n personnalisée `:wrong_siret_format`. Les locales française et anglaise sont incluses dans la gem._
|
|
62
|
+
* `:invalid` – lorsque le checksum du SIRET est invalide.
|
|
63
|
+
|
|
64
|
+
_Le message est localisé via la clé i18n standard Rails `:invalid`._
|
|
65
|
+
|
|
66
|
+
## Développement
|
|
67
|
+
|
|
68
|
+
Après avoir cloné le dépôt, exécutez `bin/setup` pour installer les dépendances. Ensuite, lancez `bundle exec rake test` pour exécuter les tests.
|
|
69
|
+
|
|
70
|
+
Pour installer cette gem sur votre machine locale, exécutez `bundle exec rake install`. Pour publier une nouvelle version, mettez à jour le numéro de version dans `siret_validator.gemspec`, puis exécutez `bundle exec rake release`. Cela créera un tag Git pour la version, poussera les commits et le tag créé, et publiera le fichier `.gem` sur [rubygems.org](https://rubygems.org).
|
|
71
|
+
|
|
72
|
+
## Contribuer
|
|
73
|
+
|
|
74
|
+
Les rapports de bugs et les pull requests sont les bienvenus sur GitHub à l'adresse https://github.com/CodeursenLiberte/siret_validator. Ce projet se veut un espace sûr et accueillant pour la collaboration ; les contributeurs sont tenus de respecter le [code de conduite](https://github.com/CodeursenLiberte/siret_validator/blob/main/CODE_OF_CONDUCT.md).
|
|
75
|
+
|
|
76
|
+
## Licence
|
|
77
|
+
|
|
78
|
+
Cette gem est mise à disposition sous [licence MIT](https://opensource.org/licenses/MIT).
|
|
79
|
+
|
|
80
|
+
## Code de conduite
|
|
81
|
+
|
|
82
|
+
Toute personne interagissant dans la base de code, les issues, les salons de discussion et les listes de diffusion du projet SiretFormatValidator est tenue de respecter le [code de conduite](https://github.com/CodeursenLiberte/siret_validator/blob/main/CODE_OF_CONDUCT.md).
|
metadata
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: siret_validator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pierre de La Morinerie
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-07-16 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activemodel
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
18
|
version: '7.0'
|
|
19
|
+
- - "<"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '9.0'
|
|
19
22
|
type: :runtime
|
|
20
23
|
prerelease: false
|
|
21
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
25
|
requirements:
|
|
23
|
-
- - "
|
|
26
|
+
- - ">="
|
|
24
27
|
- !ruby/object:Gem::Version
|
|
25
28
|
version: '7.0'
|
|
29
|
+
- - "<"
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '9.0'
|
|
26
32
|
email:
|
|
27
33
|
- pierre@codeureusesenliberte.fr
|
|
28
34
|
executables: []
|