faker-indian 0.1.0 → 0.2.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.
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ module Indian
5
+ class Profile
6
+ class << self
7
+ def generate
8
+ {
9
+ name: Name.full_name,
10
+ phone: Phone.mobile_number,
11
+ pan: Identity.pan,
12
+ aadhaar: Identity.aadhaar,
13
+ gstin: Identity.gstin,
14
+ upi: Payment.upi_id,
15
+ vehicle: Vehicle.registration_number,
16
+ address: Address.full_address,
17
+ dish: Food.dish
18
+ }
19
+ end
20
+ end
21
+ end
22
+
23
+ def self.profile
24
+ Profile.generate
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faker"
4
+
5
+ module Faker
6
+ module Indian
7
+ class Travel
8
+ data = Data.load(:travel)
9
+
10
+ STATIONS = data.fetch(:stations).freeze
11
+ TRAINS = data.fetch(:trains).freeze
12
+
13
+ class << self
14
+ def pnr
15
+ random.rand(1_000_000_000..9_999_999_999).to_s
16
+ end
17
+
18
+ def train_name
19
+ TRAINS.sample(random: random)
20
+ end
21
+
22
+ def station
23
+ STATIONS.sample(random: random)
24
+ end
25
+
26
+ private
27
+
28
+ def random
29
+ Faker::Config.random
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -9,22 +9,36 @@ module Faker
9
9
  LETTERS = ("A".."Z").to_a.freeze
10
10
 
11
11
  class << self
12
- def registration_number
13
- "#{state_code}#{rto_code}#{series}#{number}"
12
+ def registration_number(state: nil)
13
+ "#{resolve_state_code(state)}#{rto_code}#{series}#{number}"
14
14
  end
15
15
 
16
16
  def state_code
17
17
  STATE_CODES.sample(random: random)
18
18
  end
19
19
 
20
+ def rto_code
21
+ format("%02d", random.rand(1..99))
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def random
23
27
  Faker::Config.random
24
28
  end
25
29
 
26
- def rto_code
27
- format("%02d", random.rand(1..99))
30
+ def resolve_state_code(state)
31
+ return state_code if state.nil?
32
+
33
+ normalized = state.to_s
34
+ return normalized.upcase if normalized.length == 2
35
+
36
+ match = Address::STATE_CODES.find do |name, code|
37
+ name.casecmp?(normalized) || code.casecmp?(normalized)
38
+ end
39
+ return match.last if match
40
+
41
+ raise Error, "unknown state: #{state}"
28
42
  end
29
43
 
30
44
  def series
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faker
4
4
  module Indian
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
data/lib/faker/indian.rb CHANGED
@@ -5,13 +5,16 @@ require "faker"
5
5
  require_relative "indian/version"
6
6
  require_relative "indian/data"
7
7
  require_relative "indian/name"
8
+ require_relative "indian/languages"
8
9
  require_relative "indian/identity"
9
10
  require_relative "indian/payment"
10
11
  require_relative "indian/vehicle"
11
12
  require_relative "indian/address"
12
13
  require_relative "indian/phone"
13
14
  require_relative "indian/food"
14
- require_relative "indian/languages"
15
+ require_relative "indian/company"
16
+ require_relative "indian/travel"
17
+ require_relative "indian/profile"
15
18
 
16
19
  module Faker
17
20
  module Indian
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faker-indian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jyoti Sharma
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-17 00:00:00.000000000 Z
11
+ date: 2026-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faker
@@ -42,13 +42,17 @@ files:
42
42
  - lib/faker-indian.rb
43
43
  - lib/faker/indian.rb
44
44
  - lib/faker/indian/address.rb
45
+ - lib/faker/indian/company.rb
45
46
  - lib/faker/indian/data.rb
46
47
  - lib/faker/indian/data/address.yml
48
+ - lib/faker/indian/data/company.yml
47
49
  - lib/faker/indian/data/food.yml
48
50
  - lib/faker/indian/data/identity.yml
49
51
  - lib/faker/indian/data/languages.yml
50
52
  - lib/faker/indian/data/name.yml
51
53
  - lib/faker/indian/data/payment.yml
54
+ - lib/faker/indian/data/phone.yml
55
+ - lib/faker/indian/data/travel.yml
52
56
  - lib/faker/indian/data/vehicle.yml
53
57
  - lib/faker/indian/food.rb
54
58
  - lib/faker/indian/identity.rb
@@ -56,6 +60,8 @@ files:
56
60
  - lib/faker/indian/name.rb
57
61
  - lib/faker/indian/payment.rb
58
62
  - lib/faker/indian/phone.rb
63
+ - lib/faker/indian/profile.rb
64
+ - lib/faker/indian/travel.rb
59
65
  - lib/faker/indian/vehicle.rb
60
66
  - lib/faker/indian/version.rb
61
67
  - sig/faker/indian.rbs
@@ -75,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
81
  requirements:
76
82
  - - ">="
77
83
  - !ruby/object:Gem::Version
78
- version: 3.1.0
84
+ version: 2.0.0
79
85
  required_rubygems_version: !ruby/object:Gem::Requirement
80
86
  requirements:
81
87
  - - ">="