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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
dishes:
|
|
2
|
+
- Butter Chicken
|
|
3
|
+
- Masala Dosa
|
|
4
|
+
- Hyderabadi Biryani
|
|
5
|
+
- Chole Bhature
|
|
6
|
+
- Pav Bhaji
|
|
7
|
+
- Rogan Josh
|
|
8
|
+
- Dal Makhani
|
|
9
|
+
- Idli Sambar
|
|
10
|
+
- Vada Pav
|
|
11
|
+
- Fish Curry
|
|
12
|
+
- Paneer Tikka
|
|
13
|
+
- Palak Paneer
|
|
14
|
+
- Aloo Paratha
|
|
15
|
+
|
|
16
|
+
restaurants:
|
|
17
|
+
- Saravana Bhavan
|
|
18
|
+
- Bademiya
|
|
19
|
+
- Karim's
|
|
20
|
+
- MTR
|
|
21
|
+
- Britannia & Co.
|
|
22
|
+
- Indian Coffee House
|
|
23
|
+
- Paradise Biryani
|
|
24
|
+
- Trishna
|
|
25
|
+
- Gajalee
|
|
26
|
+
- Sagar Ratna
|
|
27
|
+
- Punjabi Dhaba
|
|
28
|
+
- Punjab Grill
|
|
29
|
+
- Punjab Biryani House
|
|
30
|
+
- Haldiram's
|
|
31
|
+
- Taj Hotel
|
|
32
|
+
- Leela Palace
|
|
33
|
+
- Oberoi Hotel
|
|
34
|
+
- ITC Hotel
|
|
35
|
+
- Hyatt Hotel
|
|
36
|
+
- Marriott Hotel
|
|
37
|
+
- Hilton Hotel
|
|
38
|
+
- Sheraton Hotel
|
|
39
|
+
- Radisson Hotel
|
|
40
|
+
- Novotel Hotel
|
|
41
|
+
- Hyatt Regency
|
|
42
|
+
- Marriott Regency
|
|
43
|
+
- Hilton Regency
|
|
44
|
+
- Sheraton Regency
|
|
45
|
+
- Radisson Regency
|
|
46
|
+
- Novotel Regency
|
|
47
|
+
- Hyatt Regency
|
|
48
|
+
- Marriott Regency
|
|
49
|
+
- Hilton Regency
|
|
50
|
+
- Sheraton Regency
|
|
51
|
+
- Radisson Regency
|
|
52
|
+
- Novotel Regency
|
|
53
|
+
- Hyatt Regency
|
|
54
|
+
- Marriott Regency
|
|
55
|
+
- Hilton Regency
|
|
56
|
+
- Sheraton Regency
|
|
57
|
+
|
|
58
|
+
sweets:
|
|
59
|
+
- Ras Malai
|
|
60
|
+
- Gajar Halwa
|
|
61
|
+
- Gulab Jamun
|
|
62
|
+
- Jalebi
|
|
63
|
+
- Rasgulla
|
|
64
|
+
- Kaju Katli
|
|
65
|
+
- Peda
|
|
66
|
+
- Barfi
|
|
67
|
+
|
|
68
|
+
cuisines:
|
|
69
|
+
- North Indian
|
|
70
|
+
- South Indian
|
|
71
|
+
- Bengali
|
|
72
|
+
- Gujarati
|
|
73
|
+
- Punjabi
|
|
74
|
+
- Rajasthani
|
|
75
|
+
- Maharashtrian
|
|
76
|
+
- Coastal
|
|
77
|
+
- Chettinad
|
|
78
|
+
- Mughlai
|
|
79
|
+
|
|
80
|
+
street_food:
|
|
81
|
+
- Pani Puri
|
|
82
|
+
- Samosa
|
|
83
|
+
- Kachori
|
|
84
|
+
- Vada Pav
|
|
85
|
+
- Dahi Puri
|
|
86
|
+
- Bhel Puri
|
|
87
|
+
- Kathi Roll
|
|
88
|
+
- Momos
|
|
89
|
+
- Jalebi
|
|
90
|
+
- Kulfi
|
|
91
|
+
- Poha
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
pan_entity_types:
|
|
2
|
+
- P
|
|
3
|
+
- C
|
|
4
|
+
- H
|
|
5
|
+
- F
|
|
6
|
+
- A
|
|
7
|
+
- T
|
|
8
|
+
- B
|
|
9
|
+
- L
|
|
10
|
+
- J
|
|
11
|
+
- G
|
|
12
|
+
|
|
13
|
+
gstin_state_codes:
|
|
14
|
+
- "01"
|
|
15
|
+
- "02"
|
|
16
|
+
- "03"
|
|
17
|
+
- "04"
|
|
18
|
+
- "05"
|
|
19
|
+
- "06"
|
|
20
|
+
- "07"
|
|
21
|
+
- "08"
|
|
22
|
+
- "09"
|
|
23
|
+
- "10"
|
|
24
|
+
- "11"
|
|
25
|
+
- "12"
|
|
26
|
+
- "13"
|
|
27
|
+
- "14"
|
|
28
|
+
- "15"
|
|
29
|
+
- "16"
|
|
30
|
+
- "17"
|
|
31
|
+
- "18"
|
|
32
|
+
- "19"
|
|
33
|
+
- "20"
|
|
34
|
+
- "21"
|
|
35
|
+
- "22"
|
|
36
|
+
- "23"
|
|
37
|
+
- "24"
|
|
38
|
+
- "25"
|
|
39
|
+
- "26"
|
|
40
|
+
- "27"
|
|
41
|
+
- "28"
|
|
42
|
+
- "29"
|
|
43
|
+
- "30"
|
|
44
|
+
- "31"
|
|
45
|
+
- "32"
|
|
46
|
+
- "33"
|
|
47
|
+
- "34"
|
|
48
|
+
- "35"
|
|
49
|
+
- "36"
|
|
50
|
+
- "37"
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
hindi:
|
|
2
|
+
code: hi
|
|
3
|
+
name: Hindi
|
|
4
|
+
native_name: "हिन्दी"
|
|
5
|
+
first_names:
|
|
6
|
+
- Arjun
|
|
7
|
+
- Priya
|
|
8
|
+
- Rohan
|
|
9
|
+
- Ananya
|
|
10
|
+
- Vikram
|
|
11
|
+
- Kavya
|
|
12
|
+
last_names:
|
|
13
|
+
- Sharma
|
|
14
|
+
- Verma
|
|
15
|
+
- Singh
|
|
16
|
+
- Gupta
|
|
17
|
+
- Yadav
|
|
18
|
+
- Mishra
|
|
19
|
+
|
|
20
|
+
tamil:
|
|
21
|
+
code: ta
|
|
22
|
+
name: Tamil
|
|
23
|
+
native_name: "தமிழ்"
|
|
24
|
+
first_names:
|
|
25
|
+
- Karthik
|
|
26
|
+
- Divya
|
|
27
|
+
- Arun
|
|
28
|
+
- Lakshmi
|
|
29
|
+
- Suresh
|
|
30
|
+
- Meena
|
|
31
|
+
last_names:
|
|
32
|
+
- Iyer
|
|
33
|
+
- Reddy
|
|
34
|
+
- Natarajan
|
|
35
|
+
- Subramanian
|
|
36
|
+
- Krishnan
|
|
37
|
+
- Pillai
|
|
38
|
+
|
|
39
|
+
telugu:
|
|
40
|
+
code: te
|
|
41
|
+
name: Telugu
|
|
42
|
+
native_name: "తెలుగు"
|
|
43
|
+
first_names:
|
|
44
|
+
- Ravi
|
|
45
|
+
- Swathi
|
|
46
|
+
- Prasad
|
|
47
|
+
- Anjali
|
|
48
|
+
- Venkat
|
|
49
|
+
- Padma
|
|
50
|
+
last_names:
|
|
51
|
+
- Rao
|
|
52
|
+
- Reddy
|
|
53
|
+
- Naidu
|
|
54
|
+
- Chowdary
|
|
55
|
+
- Goud
|
|
56
|
+
- Prasad
|
|
57
|
+
|
|
58
|
+
bengali:
|
|
59
|
+
code: bn
|
|
60
|
+
name: Bengali
|
|
61
|
+
native_name: "বাংলা"
|
|
62
|
+
first_names:
|
|
63
|
+
- Arnab
|
|
64
|
+
- Riya
|
|
65
|
+
- Sourav
|
|
66
|
+
- Debjani
|
|
67
|
+
- Anirban
|
|
68
|
+
- Mitali
|
|
69
|
+
last_names:
|
|
70
|
+
- Banerjee
|
|
71
|
+
- Chatterjee
|
|
72
|
+
- Mukherjee
|
|
73
|
+
- Das
|
|
74
|
+
- Ghosh
|
|
75
|
+
- Sen
|
|
76
|
+
|
|
77
|
+
marathi:
|
|
78
|
+
code: mr
|
|
79
|
+
name: Marathi
|
|
80
|
+
native_name: "मराठी"
|
|
81
|
+
first_names:
|
|
82
|
+
- Ajay
|
|
83
|
+
- Sayali
|
|
84
|
+
- Nikhil
|
|
85
|
+
- Shruti
|
|
86
|
+
- Sachin
|
|
87
|
+
- Pooja
|
|
88
|
+
last_names:
|
|
89
|
+
- Patil
|
|
90
|
+
- Deshmukh
|
|
91
|
+
- Kulkarni
|
|
92
|
+
- Joshi
|
|
93
|
+
- Pawar
|
|
94
|
+
- Jadhav
|
|
95
|
+
|
|
96
|
+
gujarati:
|
|
97
|
+
code: gu
|
|
98
|
+
name: Gujarati
|
|
99
|
+
native_name: "ગુજરાતી"
|
|
100
|
+
first_names:
|
|
101
|
+
- Harsh
|
|
102
|
+
- Nisha
|
|
103
|
+
- Jay
|
|
104
|
+
- Kinjal
|
|
105
|
+
- Mitul
|
|
106
|
+
- Heena
|
|
107
|
+
- Harshal
|
|
108
|
+
- Harshad
|
|
109
|
+
last_names:
|
|
110
|
+
- Patel
|
|
111
|
+
- Shah
|
|
112
|
+
- Mehta
|
|
113
|
+
- Desai
|
|
114
|
+
- Gandhi
|
|
115
|
+
- Thakkar
|
|
116
|
+
|
|
117
|
+
kannada:
|
|
118
|
+
code: kn
|
|
119
|
+
name: Kannada
|
|
120
|
+
native_name: "ಕನ್ನಡ"
|
|
121
|
+
first_names:
|
|
122
|
+
- Prakash
|
|
123
|
+
- Asha
|
|
124
|
+
- Manjunath
|
|
125
|
+
- Kavitha
|
|
126
|
+
- Ramesh
|
|
127
|
+
- Sunitha
|
|
128
|
+
last_names:
|
|
129
|
+
- Gowda
|
|
130
|
+
- Shetty
|
|
131
|
+
- Rao
|
|
132
|
+
- Murthy
|
|
133
|
+
- Hegde
|
|
134
|
+
- Bhat
|
|
135
|
+
|
|
136
|
+
malayalam:
|
|
137
|
+
code: ml
|
|
138
|
+
name: Malayalam
|
|
139
|
+
native_name: "മലയാളം"
|
|
140
|
+
first_names:
|
|
141
|
+
- Unni
|
|
142
|
+
- Meera
|
|
143
|
+
- Anoop
|
|
144
|
+
- Reshma
|
|
145
|
+
- Sajan
|
|
146
|
+
- Deepa
|
|
147
|
+
last_names:
|
|
148
|
+
- Nair
|
|
149
|
+
- Menon
|
|
150
|
+
- Pillai
|
|
151
|
+
- Kurup
|
|
152
|
+
- Varma
|
|
153
|
+
- Panicker
|
|
154
|
+
|
|
155
|
+
punjabi:
|
|
156
|
+
code: pa
|
|
157
|
+
name: Punjabi
|
|
158
|
+
native_name: "ਪੰਜਾਬੀ"
|
|
159
|
+
first_names:
|
|
160
|
+
- Harpreet
|
|
161
|
+
- Simran
|
|
162
|
+
- Gurpreet
|
|
163
|
+
- Navjot
|
|
164
|
+
- Manpreet
|
|
165
|
+
- Jasleen
|
|
166
|
+
last_names:
|
|
167
|
+
- Singh
|
|
168
|
+
- Kaur
|
|
169
|
+
- Gill
|
|
170
|
+
- Sandhu
|
|
171
|
+
- Brar
|
|
172
|
+
- Dhillon
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
first_names:
|
|
2
|
+
- Arjun
|
|
3
|
+
- Priya
|
|
4
|
+
- Rohan
|
|
5
|
+
- Sneha
|
|
6
|
+
- Amit
|
|
7
|
+
- Rahul
|
|
8
|
+
- Ananya
|
|
9
|
+
- Vikram
|
|
10
|
+
- Kavya
|
|
11
|
+
- Dev
|
|
12
|
+
- Ishaan
|
|
13
|
+
- Meera
|
|
14
|
+
- Aditya
|
|
15
|
+
- Nisha
|
|
16
|
+
- Sanjay
|
|
17
|
+
- Pooja
|
|
18
|
+
|
|
19
|
+
last_names:
|
|
20
|
+
- Sharma
|
|
21
|
+
- Patel
|
|
22
|
+
- Verma
|
|
23
|
+
- Singh
|
|
24
|
+
- Gupta
|
|
25
|
+
- Kumar
|
|
26
|
+
- Reddy
|
|
27
|
+
- Iyer
|
|
28
|
+
- Joshi
|
|
29
|
+
- Nair
|
|
30
|
+
- Mehta
|
|
31
|
+
- Kulkarni
|
|
32
|
+
- Desai
|
|
33
|
+
- Rao
|
|
34
|
+
- Malhotra
|
|
35
|
+
|
|
36
|
+
prefixes:
|
|
37
|
+
- Mr.
|
|
38
|
+
- Mrs.
|
|
39
|
+
- Ms.
|
|
40
|
+
- Dr.
|
|
41
|
+
- Prof.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
handles:
|
|
2
|
+
- ybl
|
|
3
|
+
- oksbi
|
|
4
|
+
- okhdfcbank
|
|
5
|
+
- paytm
|
|
6
|
+
- ibl
|
|
7
|
+
- okicici
|
|
8
|
+
- okaxis
|
|
9
|
+
|
|
10
|
+
banks:
|
|
11
|
+
HDFC: HDFC Bank
|
|
12
|
+
SBIN: State Bank of India
|
|
13
|
+
ICIC: ICICI Bank
|
|
14
|
+
AXIS: Axis Bank
|
|
15
|
+
KKBK: Kotak Mahindra Bank
|
|
16
|
+
PNB: Punjab National Bank
|
|
17
|
+
|
|
18
|
+
names:
|
|
19
|
+
- rahul
|
|
20
|
+
- priya
|
|
21
|
+
- amit
|
|
22
|
+
- sneha
|
|
23
|
+
- arjun
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
state_codes:
|
|
2
|
+
- MH
|
|
3
|
+
- KA
|
|
4
|
+
- DL
|
|
5
|
+
- TN
|
|
6
|
+
- GJ
|
|
7
|
+
- UP
|
|
8
|
+
- WB
|
|
9
|
+
- RJ
|
|
10
|
+
- AP
|
|
11
|
+
- TS
|
|
12
|
+
- KL
|
|
13
|
+
- MP
|
|
14
|
+
- HR
|
|
15
|
+
- PB
|
|
16
|
+
- BR
|
|
17
|
+
- OR
|
|
18
|
+
- CG
|
|
19
|
+
- JH
|
|
20
|
+
- AS
|
|
21
|
+
- UK
|
|
22
|
+
- HP
|
|
23
|
+
- JK
|
|
24
|
+
- GA
|
|
25
|
+
- MN
|
|
26
|
+
- TR
|
|
27
|
+
- NL
|
|
28
|
+
- SK
|
|
29
|
+
- AR
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "yaml"
|
|
4
|
+
|
|
5
|
+
module Faker
|
|
6
|
+
module Indian
|
|
7
|
+
module Data
|
|
8
|
+
DATA_ROOT = ::File.expand_path("data", __dir__)
|
|
9
|
+
|
|
10
|
+
class << self
|
|
11
|
+
def load(name)
|
|
12
|
+
@cache ||= {}
|
|
13
|
+
@cache[name] ||= read_file(name)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def fetch(name, *keys)
|
|
17
|
+
keys.reduce(load(name)) { |data, key| data.fetch(key) }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def reset!
|
|
21
|
+
@cache = {}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def read_file(name)
|
|
27
|
+
path = ::File.join(DATA_ROOT, "#{name}.yml")
|
|
28
|
+
raise Error, "missing data file: #{path}" unless ::File.exist?(path)
|
|
29
|
+
|
|
30
|
+
deep_symbolize(YAML.safe_load_file(path))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def deep_symbolize(value)
|
|
34
|
+
case value
|
|
35
|
+
when Hash
|
|
36
|
+
value.transform_keys(&:to_sym).transform_values { |v| deep_symbolize(v) }
|
|
37
|
+
when Array
|
|
38
|
+
value.map { |item| deep_symbolize(item) }
|
|
39
|
+
else
|
|
40
|
+
value
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faker"
|
|
4
|
+
|
|
5
|
+
module Faker
|
|
6
|
+
module Indian
|
|
7
|
+
class Food
|
|
8
|
+
_data = Data.load(:food)
|
|
9
|
+
|
|
10
|
+
DISHES = _data.fetch(:dishes).freeze
|
|
11
|
+
RESTAURANTS = _data.fetch(:restaurants).freeze
|
|
12
|
+
CUISINES = _data.fetch(:cuisines).freeze
|
|
13
|
+
STREET_FOOD = _data.fetch(:street_food).freeze
|
|
14
|
+
SWEETS = _data.fetch(:sweets).freeze
|
|
15
|
+
class << self
|
|
16
|
+
def dish
|
|
17
|
+
DISHES.sample(random: random)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def restaurant_name
|
|
21
|
+
RESTAURANTS.sample(random: random)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def cuisine
|
|
25
|
+
CUISINES.sample(random: random)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def street_food
|
|
29
|
+
STREET_FOOD.sample(random: random)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def sweet
|
|
33
|
+
SWEETS.sample(random: random)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def random
|
|
39
|
+
Faker::Config.random
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faker"
|
|
4
|
+
|
|
5
|
+
module Faker
|
|
6
|
+
module Indian
|
|
7
|
+
class Identity
|
|
8
|
+
_data = Data.load(:identity)
|
|
9
|
+
|
|
10
|
+
LETTERS = ("A".."Z").to_a.freeze
|
|
11
|
+
PAN_ENTITY_TYPES = _data.fetch(:pan_entity_types).freeze
|
|
12
|
+
GSTIN_STATE_CODES = _data.fetch(:gstin_state_codes).freeze
|
|
13
|
+
CHECKSUM_CHARS = (("0".."9").to_a + LETTERS).freeze
|
|
14
|
+
|
|
15
|
+
class << self
|
|
16
|
+
def pan
|
|
17
|
+
first_three = Array.new(3) { sample_letter }.join
|
|
18
|
+
entity_type = PAN_ENTITY_TYPES.sample(random: random)
|
|
19
|
+
surname_initial = sample_letter
|
|
20
|
+
numbers = random.rand(1000..9999)
|
|
21
|
+
last = sample_letter
|
|
22
|
+
|
|
23
|
+
"#{first_three}#{entity_type}#{surname_initial}#{numbers}#{last}"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def aadhaar
|
|
27
|
+
Array.new(12) { random.rand(0..9) }
|
|
28
|
+
.join
|
|
29
|
+
.scan(/.{1,4}/)
|
|
30
|
+
.join(" ")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def gstin
|
|
34
|
+
state = GSTIN_STATE_CODES.sample(random: random)
|
|
35
|
+
entity_number = random.rand(1..9)
|
|
36
|
+
checksum = CHECKSUM_CHARS.sample(random: random)
|
|
37
|
+
|
|
38
|
+
"#{state}#{pan}#{entity_number}Z#{checksum}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def voter_id
|
|
42
|
+
"#{Array.new(3) { sample_letter }.join}#{random.rand(1_000_000..9_999_999)}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def passport
|
|
46
|
+
"#{sample_letter}#{random.rand(1_000_000..9_999_999)}"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def random
|
|
52
|
+
Faker::Config.random
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def sample_letter
|
|
56
|
+
LETTERS.sample(random: random)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faker"
|
|
4
|
+
|
|
5
|
+
module Faker
|
|
6
|
+
module Indian
|
|
7
|
+
class Languages
|
|
8
|
+
_data = Data.load(:languages)
|
|
9
|
+
|
|
10
|
+
LANGUAGES = _data.freeze
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
def name(language: nil)
|
|
14
|
+
entry(language)[:name]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def native_name(language: nil)
|
|
18
|
+
entry(language)[:native_name]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def code(language: nil)
|
|
22
|
+
entry(language)[:code]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def first_name(language: nil)
|
|
26
|
+
entry(language).fetch(:first_names).sample(random: random)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def last_name(language: nil)
|
|
30
|
+
entry(language).fetch(:last_names).sample(random: random)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def full_name(language: nil)
|
|
34
|
+
lang = language || sample_language_key
|
|
35
|
+
"#{first_name(language: lang)} #{last_name(language: lang)}"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def available
|
|
39
|
+
LANGUAGES.keys
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def random
|
|
45
|
+
Faker::Config.random
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def entry(language)
|
|
49
|
+
LANGUAGES.fetch(resolve_key(language))
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def resolve_key(language)
|
|
53
|
+
return sample_language_key if language.nil?
|
|
54
|
+
|
|
55
|
+
key = language.to_s.downcase.tr("-", "_").to_sym
|
|
56
|
+
return key if LANGUAGES.key?(key)
|
|
57
|
+
|
|
58
|
+
match = LANGUAGES.find { |_, data| data[:code] == key.to_s }
|
|
59
|
+
return match.first if match
|
|
60
|
+
|
|
61
|
+
raise Error, "unknown language: #{language}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def sample_language_key
|
|
65
|
+
LANGUAGES.keys.sample(random: random)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faker"
|
|
4
|
+
|
|
5
|
+
module Faker
|
|
6
|
+
module Indian
|
|
7
|
+
class Name
|
|
8
|
+
_data = Data.load(:name)
|
|
9
|
+
|
|
10
|
+
FIRST_NAMES = _data.fetch(:first_names).freeze
|
|
11
|
+
LAST_NAMES = _data.fetch(:last_names).freeze
|
|
12
|
+
PREFIXES = _data.fetch(:prefixes).freeze
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def first_name
|
|
16
|
+
FIRST_NAMES.sample(random: random)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def last_name
|
|
20
|
+
LAST_NAMES.sample(random: random)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def full_name
|
|
24
|
+
"#{first_name} #{last_name}"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def prefix
|
|
28
|
+
PREFIXES.sample(random: random)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def random
|
|
34
|
+
Faker::Config.random
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faker"
|
|
4
|
+
|
|
5
|
+
module Faker
|
|
6
|
+
module Indian
|
|
7
|
+
class Payment
|
|
8
|
+
_data = Data.load(:payment)
|
|
9
|
+
|
|
10
|
+
HANDLES = _data.fetch(:handles).freeze
|
|
11
|
+
BANK_CODES = _data.fetch(:banks).freeze
|
|
12
|
+
NAMES = _data.fetch(:names).freeze
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def upi_id
|
|
16
|
+
"#{sample_name}#{random.rand(10..99)}@#{sample_handle}"
|
|
17
|
+
end
|
|
18
|
+
alias upi upi_id
|
|
19
|
+
|
|
20
|
+
def ifsc
|
|
21
|
+
code = sample_bank_code
|
|
22
|
+
"#{code}0#{random.rand(100_000..999_999)}"
|
|
23
|
+
end
|
|
24
|
+
alias ifsc_code ifsc
|
|
25
|
+
|
|
26
|
+
def bank_name
|
|
27
|
+
BANK_CODES[sample_bank_code]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def account_number
|
|
31
|
+
random.rand(100_000_000_000..999_999_999_999).to_s
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def random
|
|
37
|
+
Faker::Config.random
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def sample_name
|
|
41
|
+
NAMES.sample(random: random)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def sample_handle
|
|
45
|
+
HANDLES.sample(random: random)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def sample_bank_code
|
|
49
|
+
BANK_CODES.keys.sample(random: random)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|