faker-indian 0.1.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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +405 -0
- data/Rakefile +12 -0
- data/lib/faker/indian/address.rb +52 -0
- data/lib/faker/indian/data/address.yml +40 -0
- data/lib/faker/indian/data/food.yml +91 -0
- data/lib/faker/indian/data/identity.yml +50 -0
- data/lib/faker/indian/data/languages.yml +172 -0
- data/lib/faker/indian/data/name.yml +41 -0
- data/lib/faker/indian/data/payment.yml +23 -0
- data/lib/faker/indian/data/vehicle.yml +29 -0
- data/lib/faker/indian/data.rb +46 -0
- data/lib/faker/indian/food.rb +44 -0
- data/lib/faker/indian/identity.rb +61 -0
- data/lib/faker/indian/languages.rb +70 -0
- data/lib/faker/indian/name.rb +39 -0
- data/lib/faker/indian/payment.rb +54 -0
- data/lib/faker/indian/phone.rb +23 -0
- data/lib/faker/indian/vehicle.rb +40 -0
- data/lib/faker/indian/version.rb +7 -0
- data/lib/faker/indian.rb +20 -0
- data/lib/faker-indian.rb +3 -0
- data/sig/faker/indian.rbs +6 -0
- metadata +89 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: de6eb2615cdfb3ca1ad1a1186da1d98522b9da95827b507266b1ae188b79c670
|
|
4
|
+
data.tar.gz: d8fe29db43869ea2c43b9f6037aeeea829e4caf12adeec923f34989b08a135ca
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c13a7c3db4650cd13149feff73e962ef257e13b4bb07ea0410dfd86878e410375ca43633ffca6ce178d650bd8347e195d5831bc7315a3b8ecc79daf85c13e0fc
|
|
7
|
+
data.tar.gz: 2b4ad2eeabbc018525ba738f838515abe10e65ae46c57fe1c32a26a47e2d0b575fd9efd7ff44bf45a42b1a285917e705f7fab1d7ebba29d6e0249917bf83679d
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official email address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[INSERT CONTACT METHOD].
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
|
86
|
+
actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
+
ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
+
community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
+
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jyoti Sharma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# faker-indian
|
|
2
|
+
|
|
3
|
+
India-first fake data generator for Ruby apps.
|
|
4
|
+
|
|
5
|
+
`faker-indian` helps you generate realistic fake Indian data such as names, PAN numbers, Aadhaar numbers, GSTINs, UPI IDs, vehicle registration numbers, phone numbers, addresses, regional-language names, food items, and more.
|
|
6
|
+
|
|
7
|
+
Perfect for:
|
|
8
|
+
|
|
9
|
+
- Rails seed data
|
|
10
|
+
- FactoryBot fixtures
|
|
11
|
+
- API mocks
|
|
12
|
+
- Testing & development
|
|
13
|
+
- Demo applications
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- 🇮🇳 Indian-first fake data generation
|
|
20
|
+
- 👤 Indian names & identities
|
|
21
|
+
- 🌐 Regional language names (Hindi, Tamil, Telugu, and more)
|
|
22
|
+
- 💳 Payment & banking details
|
|
23
|
+
- 🚗 Vehicle registration numbers
|
|
24
|
+
- 🏠 Indian addresses & PIN codes
|
|
25
|
+
- 📞 Mobile numbers
|
|
26
|
+
- 🍛 Indian dishes, cuisines, and restaurants
|
|
27
|
+
- 📁 YAML-backed data — easy to extend without changing logic
|
|
28
|
+
- ⚡ Lightweight and easy to use
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Add this line to your application's Gemfile:
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
gem 'faker-indian'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then execute:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
bundle install
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or install manually:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
gem install faker-indian
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Quick Start
|
|
55
|
+
|
|
56
|
+
```ruby
|
|
57
|
+
require "faker/indian"
|
|
58
|
+
|
|
59
|
+
Faker::Indian::Name.full_name
|
|
60
|
+
# => "Arjun Sharma"
|
|
61
|
+
|
|
62
|
+
Faker::Indian::Identity.pan
|
|
63
|
+
# => "ABCDE1234F"
|
|
64
|
+
|
|
65
|
+
Faker::Indian::Identity.aadhaar
|
|
66
|
+
# => "4567 8912 3456"
|
|
67
|
+
|
|
68
|
+
Faker::Indian::Identity.aadhaar
|
|
69
|
+
# => "4567 8912 3456"
|
|
70
|
+
|
|
71
|
+
Faker::Indian::Payment.upi_id
|
|
72
|
+
# => "rahul123@paytm"
|
|
73
|
+
Faker::Vehicle::
|
|
74
|
+
Faker::Indian::Languages.full_name(language: :tamil)
|
|
75
|
+
# => "Karthik Iyer"
|
|
76
|
+
|
|
77
|
+
Faker::Indian::Food.dish
|
|
78
|
+
# => "Masala Dosa"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Available Generators
|
|
84
|
+
|
|
85
|
+
### Name
|
|
86
|
+
|
|
87
|
+
Generate Indian names.
|
|
88
|
+
|
|
89
|
+
```ruby
|
|
90
|
+
Faker::Indian::Name.first_name
|
|
91
|
+
# => "Priya"
|
|
92
|
+
|
|
93
|
+
Faker::Indian::Name.last_name
|
|
94
|
+
# => "Patel"
|
|
95
|
+
|
|
96
|
+
Faker::Indian::Name.full_name
|
|
97
|
+
# => "Rohan Verma"
|
|
98
|
+
|
|
99
|
+
Faker::Indian::Name.prefix
|
|
100
|
+
# => "Dr."
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Languages
|
|
106
|
+
|
|
107
|
+
Generate names and metadata for major Indian languages.
|
|
108
|
+
|
|
109
|
+
Supported languages: Hindi, Tamil, Telugu, Bengali, Marathi, Gujarati, Kannada, Malayalam, and Punjabi.
|
|
110
|
+
|
|
111
|
+
Pass a language as a symbol (`:hindi`), language name, or ISO-style code (`"hi"`, `"ta"`). Omit `language:` to pick one at random.
|
|
112
|
+
|
|
113
|
+
```ruby
|
|
114
|
+
Faker::Indian::Languages.name
|
|
115
|
+
# => "Tamil"
|
|
116
|
+
|
|
117
|
+
Faker::Indian::Languages.name(language: :hindi)
|
|
118
|
+
# => "Hindi"
|
|
119
|
+
|
|
120
|
+
Faker::Indian::Languages.native_name(language: :tamil)
|
|
121
|
+
# => "தமிழ்"
|
|
122
|
+
|
|
123
|
+
Faker::Indian::Languages.code(language: :bengali)
|
|
124
|
+
# => "bn"
|
|
125
|
+
|
|
126
|
+
Faker::Indian::Languages.first_name(language: :punjabi)
|
|
127
|
+
# => "Simran"
|
|
128
|
+
|
|
129
|
+
Faker::Indian::Languages.full_name(language: :gujarati)
|
|
130
|
+
# => "Jay Patel"
|
|
131
|
+
|
|
132
|
+
Faker::Indian::Languages.available
|
|
133
|
+
# => [:hindi, :tamil, :telugu, :bengali, :marathi, :gujarati, :kannada, :malayalam, :punjabi]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Identity
|
|
139
|
+
|
|
140
|
+
Generate Indian identity-related data.
|
|
141
|
+
|
|
142
|
+
```ruby
|
|
143
|
+
Faker::Indian::Identity.pan
|
|
144
|
+
# => "ABCDE1234F"
|
|
145
|
+
|
|
146
|
+
Faker::Indian::Identity.aadhaar
|
|
147
|
+
# => "1234 5678 9012"
|
|
148
|
+
|
|
149
|
+
Faker::Indian::Identity.gstin
|
|
150
|
+
# => "27ABCDE1234F1Z5"
|
|
151
|
+
|
|
152
|
+
Faker::Indian::Identity.voter_id
|
|
153
|
+
# => "ABC1234567"
|
|
154
|
+
|
|
155
|
+
Faker::Indian::Identity.passport
|
|
156
|
+
# => "N1234567"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### Payment
|
|
162
|
+
|
|
163
|
+
Generate fake Indian banking and payment data.
|
|
164
|
+
|
|
165
|
+
```ruby
|
|
166
|
+
Faker::Indian::Payment.upi_id
|
|
167
|
+
# => "amit@oksbi"
|
|
168
|
+
|
|
169
|
+
Faker::Indian::Payment.ifsc
|
|
170
|
+
# => "HDFC0001234"
|
|
171
|
+
|
|
172
|
+
Faker::Indian::Payment.bank_name
|
|
173
|
+
# => "State Bank of India"
|
|
174
|
+
|
|
175
|
+
Faker::Indian::Payment.account_number
|
|
176
|
+
# => "123456789012"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Aliases: `upi` (for `upi_id`), `ifsc_code` (for `ifsc`).
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### Vehicle
|
|
184
|
+
|
|
185
|
+
Generate Indian vehicle registration numbers.
|
|
186
|
+
|
|
187
|
+
```ruby
|
|
188
|
+
Faker::Indian::Vehicle.registration_number
|
|
189
|
+
# => "KA01MJ4587"
|
|
190
|
+
|
|
191
|
+
Faker::Indian::Vehicle.state_code
|
|
192
|
+
# => "MH"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### Address
|
|
198
|
+
|
|
199
|
+
Generate realistic Indian addresses.
|
|
200
|
+
|
|
201
|
+
```ruby
|
|
202
|
+
Faker::Indian::Address.city
|
|
203
|
+
# => "Pune"
|
|
204
|
+
|
|
205
|
+
Faker::Indian::Address.state
|
|
206
|
+
# => "Maharashtra"
|
|
207
|
+
|
|
208
|
+
Faker::Indian::Address.pincode
|
|
209
|
+
# => "411001"
|
|
210
|
+
|
|
211
|
+
Faker::Indian::Address.full_address
|
|
212
|
+
# => "221 MG Road, Pune, Maharashtra - 411001"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### Phone
|
|
218
|
+
|
|
219
|
+
Generate Indian mobile numbers.
|
|
220
|
+
|
|
221
|
+
```ruby
|
|
222
|
+
Faker::Indian::Phone.mobile_number
|
|
223
|
+
# => "+91 9876543210"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### Food
|
|
229
|
+
|
|
230
|
+
Generate Indian food-related data.
|
|
231
|
+
|
|
232
|
+
```ruby
|
|
233
|
+
Faker::Indian::Food.dish
|
|
234
|
+
# => "Hyderabadi Biryani"
|
|
235
|
+
|
|
236
|
+
Faker::Indian::Food.restaurant_name
|
|
237
|
+
# => "Saravana Bhavan"
|
|
238
|
+
|
|
239
|
+
Faker::Indian::Food.cuisine
|
|
240
|
+
# => "South Indian"
|
|
241
|
+
|
|
242
|
+
Faker::Indian::Food.street_food
|
|
243
|
+
# => "Pani Puri"
|
|
244
|
+
|
|
245
|
+
Faker::Indian::Food.sweet
|
|
246
|
+
# => "Gulab Jamun"
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Data Files
|
|
252
|
+
|
|
253
|
+
Static data lives in YAML files under `lib/faker/indian/data/` and is loaded by `Faker::Indian::Data`:
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
| File | Used by |
|
|
257
|
+
| --------------- | ----------- |
|
|
258
|
+
| `name.yml` | `Name` |
|
|
259
|
+
| `languages.yml` | `Languages` |
|
|
260
|
+
| `identity.yml` | `Identity` |
|
|
261
|
+
| `payment.yml` | `Payment` |
|
|
262
|
+
| `vehicle.yml` | `Vehicle` |
|
|
263
|
+
| `address.yml` | `Address` |
|
|
264
|
+
| `food.yml` | `Food` |
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
To add entries, edit the relevant YAML file. To add a new generator, create a new YAML file and a matching Ruby class that calls `Data.load(:your_file)`.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Rails Usage
|
|
272
|
+
|
|
273
|
+
### Seeds
|
|
274
|
+
|
|
275
|
+
```ruby
|
|
276
|
+
10.times do
|
|
277
|
+
User.create!(
|
|
278
|
+
name: Faker::Indian::Name.full_name,
|
|
279
|
+
phone: Faker::Indian::Phone.mobile_number,
|
|
280
|
+
pan: Faker::Indian::Identity.pan,
|
|
281
|
+
upi: Faker::Indian::Payment.upi_id
|
|
282
|
+
)
|
|
283
|
+
end
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### FactoryBot
|
|
287
|
+
|
|
288
|
+
```ruby
|
|
289
|
+
FactoryBot.define do
|
|
290
|
+
factory :user do
|
|
291
|
+
name { Faker::Indian::Name.full_name }
|
|
292
|
+
phone { Faker::Indian::Phone.mobile_number }
|
|
293
|
+
pan { Faker::Indian::Identity.pan }
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
factory :restaurant do
|
|
297
|
+
name { Faker::Indian::Food.restaurant_name }
|
|
298
|
+
cuisine { Faker::Indian::Food.cuisine }
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Validation Notice
|
|
306
|
+
|
|
307
|
+
This gem generates fake but format-valid data intended only for:
|
|
308
|
+
|
|
309
|
+
- Testing
|
|
310
|
+
- Development
|
|
311
|
+
- Mock APIs
|
|
312
|
+
- Demo applications
|
|
313
|
+
|
|
314
|
+
Generated values are **not real identities** and must not be used for fraud, impersonation, or verification systems.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Roadmap
|
|
319
|
+
|
|
320
|
+
Planned generators:
|
|
321
|
+
|
|
322
|
+
- Driving License Number
|
|
323
|
+
- CIN Number
|
|
324
|
+
- Demat Account
|
|
325
|
+
- Regional language names
|
|
326
|
+
- Telecom operators
|
|
327
|
+
- Railway PNR
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Contributing
|
|
332
|
+
|
|
333
|
+
Bug reports and pull requests are welcome.
|
|
334
|
+
|
|
335
|
+
1. Fork the repository
|
|
336
|
+
2. Create your feature branch
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
git checkout -b feature/my-feature
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
1. Commit changes
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
git commit -m "Add new generator"
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
1. Push to branch
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
git push origin feature/my-feature
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
1. Open a Pull Request
|
|
355
|
+
|
|
356
|
+
When adding generators, include YAML data, Ruby class, and RSpec tests.
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Development
|
|
361
|
+
|
|
362
|
+
Run tests:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
bundle exec rspec
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Run linting:
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
bundle exec rubocop
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## License
|
|
377
|
+
|
|
378
|
+
Released under the MIT License.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Example Output
|
|
383
|
+
|
|
384
|
+
```ruby
|
|
385
|
+
{
|
|
386
|
+
name: "Sneha Kulkarni",
|
|
387
|
+
regional_name: "அருண் ஐயர்",
|
|
388
|
+
pan: "BQWPE1234K",
|
|
389
|
+
aadhaar: "4567 1234 8910",
|
|
390
|
+
phone: "+91 9123456789",
|
|
391
|
+
upi: "sneha@okicici",
|
|
392
|
+
vehicle: "MH14DT4321",
|
|
393
|
+
address: "221 FC Road, Pune, Maharashtra - 411001",
|
|
394
|
+
dish: "Masala Dosa",
|
|
395
|
+
sweet: "Gulab Jamun"
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Why faker-indian?
|
|
402
|
+
|
|
403
|
+
Most fake-data libraries are heavily US-centric.
|
|
404
|
+
|
|
405
|
+
`faker-indian` focuses specifically on Indian systems, formats, and identifiers, making it easier to build and test applications for the Indian market.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faker"
|
|
4
|
+
|
|
5
|
+
module Faker
|
|
6
|
+
module Indian
|
|
7
|
+
class Address
|
|
8
|
+
_data = Data.load(:address)
|
|
9
|
+
|
|
10
|
+
LOCATIONS = _data.fetch(:locations).freeze
|
|
11
|
+
STREETS = _data.fetch(:streets).freeze
|
|
12
|
+
|
|
13
|
+
class << self
|
|
14
|
+
def city
|
|
15
|
+
sample_location[:city]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def state
|
|
19
|
+
sample_location[:state]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def pincode
|
|
23
|
+
sample_location[:pincode]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def full_address
|
|
27
|
+
loc = sample_location
|
|
28
|
+
"#{random_street_number} #{random_street}, #{loc[:city]}, #{loc[:state]} - #{loc[:pincode]}"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def random
|
|
34
|
+
Faker::Config.random
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def sample_location
|
|
38
|
+
city_name, details = LOCATIONS.to_a.sample(random: random)
|
|
39
|
+
{ city: city_name, state: details[:state], pincode: details[:pincode] }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def random_street
|
|
43
|
+
STREETS.sample(random: random)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def random_street_number
|
|
47
|
+
random.rand(1..999)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
locations:
|
|
2
|
+
Mumbai:
|
|
3
|
+
state: Maharashtra
|
|
4
|
+
pincode: "400001"
|
|
5
|
+
Pune:
|
|
6
|
+
state: Maharashtra
|
|
7
|
+
pincode: "411001"
|
|
8
|
+
Delhi:
|
|
9
|
+
state: Delhi
|
|
10
|
+
pincode: "110001"
|
|
11
|
+
Bengaluru:
|
|
12
|
+
state: Karnataka
|
|
13
|
+
pincode: "560001"
|
|
14
|
+
Chennai:
|
|
15
|
+
state: Tamil Nadu
|
|
16
|
+
pincode: "600001"
|
|
17
|
+
Hyderabad:
|
|
18
|
+
state: Telangana
|
|
19
|
+
pincode: "500001"
|
|
20
|
+
Ahmedabad:
|
|
21
|
+
state: Gujarat
|
|
22
|
+
pincode: "380001"
|
|
23
|
+
Kolkata:
|
|
24
|
+
state: West Bengal
|
|
25
|
+
pincode: "700001"
|
|
26
|
+
Jaipur:
|
|
27
|
+
state: Rajasthan
|
|
28
|
+
pincode: "302001"
|
|
29
|
+
Lucknow:
|
|
30
|
+
state: Uttar Pradesh
|
|
31
|
+
pincode: "226001"
|
|
32
|
+
|
|
33
|
+
streets:
|
|
34
|
+
- MG Road
|
|
35
|
+
- FC Road
|
|
36
|
+
- Park Street
|
|
37
|
+
- Brigade Road
|
|
38
|
+
- Linking Road
|
|
39
|
+
- Anna Salai
|
|
40
|
+
- Ring Road
|