pattana 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/android-icon-144x144.png +0 -0
- data/app/assets/images/android-icon-192x192.png +0 -0
- data/app/assets/images/android-icon-36x36.png +0 -0
- data/app/assets/images/android-icon-48x48.png +0 -0
- data/app/assets/images/android-icon-72x72.png +0 -0
- data/app/assets/images/android-icon-96x96.png +0 -0
- data/app/assets/images/apple-icon-114x114.png +0 -0
- data/app/assets/images/apple-icon-120x120.png +0 -0
- data/app/assets/images/apple-icon-144x144.png +0 -0
- data/app/assets/images/apple-icon-152x152.png +0 -0
- data/app/assets/images/apple-icon-180x180.png +0 -0
- data/app/assets/images/apple-icon-57x57.png +0 -0
- data/app/assets/images/apple-icon-60x60.png +0 -0
- data/app/assets/images/apple-icon-72x72.png +0 -0
- data/app/assets/images/apple-icon-76x76.png +0 -0
- data/app/assets/images/apple-icon-precomposed.png +0 -0
- data/app/assets/images/apple-icon.png +0 -0
- data/app/assets/images/browserconfig.xml +1 -8
- data/app/assets/images/favicon-16x16.png +0 -0
- data/app/assets/images/favicon-32x32.png +0 -0
- data/app/assets/images/favicon-96x96.png +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/logo-on-white.png +0 -0
- data/app/assets/images/logo-small.png +0 -0
- data/app/assets/images/logo.png +0 -0
- data/app/assets/images/manifest.json +39 -16
- data/app/assets/images/ms-icon-144x144.png +0 -0
- data/app/assets/images/ms-icon-150x150.png +0 -0
- data/app/assets/images/ms-icon-310x310.png +0 -0
- data/app/assets/images/ms-icon-70x70.png +0 -0
- data/app/assets/sketches/logo.sketch +0 -0
- data/import.md +105 -0
- data/lib/pattana/engine.rb +19 -0
- data/lib/pattana/factories.rb +8 -0
- data/lib/pattana/version.rb +1 -1
- data/lib/tasks/make_data.rake +52 -50
- data/lib/tasks/master_data.rake +36 -34
- data/spec/dummy/spec/factories/city.rb +21 -0
- data/spec/dummy/spec/factories/country.rb +41 -0
- data/spec/dummy/spec/factories/region.rb +19 -0
- metadata +32 -60
- data/app/assets/images/android-chrome-192x192.png +0 -0
- data/app/assets/images/android-chrome-512x512.png +0 -0
- data/app/assets/images/apple-touch-icon-114x114.png +0 -0
- data/app/assets/images/apple-touch-icon-120x120.png +0 -0
- data/app/assets/images/apple-touch-icon-144x144.png +0 -0
- data/app/assets/images/apple-touch-icon-152x152.png +0 -0
- data/app/assets/images/apple-touch-icon-180x180.png +0 -0
- data/app/assets/images/apple-touch-icon-57x57.png +0 -0
- data/app/assets/images/apple-touch-icon-60x60.png +0 -0
- data/app/assets/images/apple-touch-icon-72x72.png +0 -0
- data/app/assets/images/apple-touch-icon-76x76.png +0 -0
- data/app/assets/images/apple-touch-icon.png +0 -0
- data/app/assets/images/mstile-150x150.png +0 -0
- data/app/assets/images/safari-pinned-tab.svg +0 -25
- data/db/archives/cities.zip +0 -0
- data/db/archives/countries_lat_lon_master.csv +0 -462
- data/db/archives/countries_master.xlsx +0 -0
- data/db/archives/future_database/cities1000.zip +0 -0
- data/db/archives/future_database/cities15000.zip +0 -0
- data/db/archives/future_database/cities5000.zip +0 -0
- data/db/archives/future_database/cities_millions.zip +0 -0
- data/db/archives/regions.csv +0 -4149
- data/db/archives/regions.xlsx +0 -0
- data/db/make_data/cities/cy-3-win-aa.csv +0 -10001
- data/db/make_data/cities/cy-3-win-ab.csv +0 -10189
- data/db/make_data/cities/cy-3-win-ac.csv +0 -10001
- data/db/make_data/cities/cy-3-win-ad.csv +0 -10012
- data/db/make_data/cities/cy-3-win-ae.csv +0 -7868
- data/db/make_data/cities/errors.txt +0 -107
- data/db/make_data/cities/master-1-win.csv +0 -101909
- data/db/make_data/cities/master-2-win.csv +0 -7323
- data/db/make_data/cities/master-3-win.csv +0 -48067
- data/db/make_data/cities/split_csv.sh +0 -51
- data/db/make_data/countries.xlsx +0 -0
- data/db/make_data/countries_lat_lon.csv +0 -462
- data/db/make_data/regions/master-1-win.csv +0 -3941
- data/db/make_data/regions/master-2-win.csv +0 -4149
- data/db/make_data/regions/rg-1-win-aa.csv +0 -1001
- data/db/make_data/regions/rg-1-win-ab.csv +0 -1001
- data/db/make_data/regions/rg-1-win-ac.csv +0 -1001
- data/db/make_data/regions/rg-1-win-ad.csv +0 -941
- data/db/make_data/regions/rg-2-win-aa.csv +0 -1001
- data/db/make_data/regions/rg-2-win-ab.csv +0 -1001
- data/db/make_data/regions/rg-2-win-ac.csv +0 -1001
- data/db/make_data/regions/rg-2-win-ad.csv +0 -1001
- data/db/make_data/regions/rg-2-win-ae.csv +0 -149
- data/db/make_data/regions/split_csv.sh +0 -51
- data/db/migrate/20170000000003_create_countries.rb +0 -47
- data/db/migrate/20170000000004_create_regions.rb +0 -23
- data/db/migrate/20170000000005_create_cities.rb +0 -27
- data/db/test_data/single_file/master.csv +0 -8294
- data/db/test_data/split_files/master.csv +0 -101909
- data/db/test_data/split_files/split_csv.sh +0 -51
- data/lib/tasks/pattana_tasks.rake +0 -4
- data/lib/tasks/template.rake +0 -72
- data/lib/tasks/test_import.rake +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d2b566f1a20f35368c5e99d93fdde8a3b3a9e18
|
4
|
+
data.tar.gz: 688dbf20ca7c12c1af959a0dbf1965ef77ce1a6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9abfefaaff0c9ffc6809b62abc7fb9220394dbc6af6a574c6969df3086cfac245d58feef19e540358621407740483a4365ba38be88b3d49fb8850eef71d3566
|
7
|
+
data.tar.gz: 109ee72c4ee3f9d0693b923a224ad82e21f484296a2d4771edcadbcdcae7554ec319293a58740a7121ac7c8918a23f3d34d3a5ffb33c94a97bb53295a442f0ba
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,9 +1,2 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<browserconfig>
|
3
|
-
<msapplication>
|
4
|
-
<tile>
|
5
|
-
<square150x150logo src="/assets/mstile-150x150.png"/>
|
6
|
-
<TileColor>#ffc40d</TileColor>
|
7
|
-
</tile>
|
8
|
-
</msapplication>
|
9
|
-
</browserconfig>
|
2
|
+
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/app/assets/images/logo.png
CHANGED
Binary file
|
@@ -1,18 +1,41 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
2
|
+
"name": "App",
|
3
|
+
"icons": [
|
4
|
+
{
|
5
|
+
"src": "\/android-icon-36x36.png",
|
6
|
+
"sizes": "36x36",
|
7
|
+
"type": "image\/png",
|
8
|
+
"density": "0.75"
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"src": "\/android-icon-48x48.png",
|
12
|
+
"sizes": "48x48",
|
13
|
+
"type": "image\/png",
|
14
|
+
"density": "1.0"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"src": "\/android-icon-72x72.png",
|
18
|
+
"sizes": "72x72",
|
19
|
+
"type": "image\/png",
|
20
|
+
"density": "1.5"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"src": "\/android-icon-96x96.png",
|
24
|
+
"sizes": "96x96",
|
25
|
+
"type": "image\/png",
|
26
|
+
"density": "2.0"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"src": "\/android-icon-144x144.png",
|
30
|
+
"sizes": "144x144",
|
31
|
+
"type": "image\/png",
|
32
|
+
"density": "3.0"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"src": "\/android-icon-192x192.png",
|
36
|
+
"sizes": "192x192",
|
37
|
+
"type": "image\/png",
|
38
|
+
"density": "4.0"
|
39
|
+
}
|
40
|
+
]
|
18
41
|
}
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/import.md
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
# Importing the data
|
2
|
+
|
3
|
+
Basic Usage
|
4
|
+
|
5
|
+
## Importing Master Data
|
6
|
+
|
7
|
+
Use the following scripts to import master data like countries, regions and cities
|
8
|
+
|
9
|
+
country data is an xlsx file.
|
10
|
+
region data is a csv file.
|
11
|
+
city data is a huge csv file and hence we have split it into small csv files.
|
12
|
+
|
13
|
+
pass verbose=false to avoid printing more details while running these commands.
|
14
|
+
|
15
|
+
### Importing countries
|
16
|
+
|
17
|
+
```rails pattana:import:master_data:countries```
|
18
|
+
|
19
|
+
This will import countries parsing the excel file 'countries.xlsx' located in db/master_data
|
20
|
+
|
21
|
+
### Importing regions
|
22
|
+
|
23
|
+
```rails pattana:import:master_data:regions```
|
24
|
+
|
25
|
+
This will import regions parsing the csv file 'regions.csv' located in db/master_data
|
26
|
+
|
27
|
+
### Importing cities
|
28
|
+
|
29
|
+
```rails pattana:import:master_data:cities```
|
30
|
+
|
31
|
+
This will import cities parsing the cities folder recursively which has multiple small city files located in db/master_data/cities
|
32
|
+
|
33
|
+
|
34
|
+
### Importing all together in one line
|
35
|
+
|
36
|
+
```rails pattana:import:master_data:countries pattana:import:master_data:regions pattana:import:master_data:cities```
|
37
|
+
|
38
|
+
This can also be achieved in a single task
|
39
|
+
|
40
|
+
```rails pattana:import:master_data:all```
|
41
|
+
|
42
|
+
|
43
|
+
## Testing the import scripts
|
44
|
+
|
45
|
+
### Single .csv File Import
|
46
|
+
|
47
|
+
This will import a single file
|
48
|
+
```rails pattana:import:test:csv:single_file RAILS_ENV=test```
|
49
|
+
|
50
|
+
|
51
|
+
### Split Files (.csv) Importing
|
52
|
+
|
53
|
+
This will import all the files in a folder recursevely.
|
54
|
+
Run split_csv.sh script to split a large file into multiple small csv files keeping the header.
|
55
|
+
Make sure that the name of the big file is master.csv
|
56
|
+
|
57
|
+
```rails pattana:import:test:csv:split_files RAILS_ENV=test```
|
58
|
+
|
59
|
+
|
60
|
+
### Single .xlsx File Import
|
61
|
+
|
62
|
+
This will import a single file
|
63
|
+
```rails pattana:import:test:xlsx:single_file RAILS_ENV=test```
|
64
|
+
|
65
|
+
|
66
|
+
### Split Files (.xlsx) Importing
|
67
|
+
|
68
|
+
This will import all the files in a folder recursevely.
|
69
|
+
Run split_csv.sh script to split a large file into multiple small csv files keeping the header.
|
70
|
+
Make sure that the name of the big file is master.csv
|
71
|
+
|
72
|
+
|
73
|
+
```rails pattana:import:test:xlsx:split_files RAILS_ENV=test```
|
74
|
+
|
75
|
+
### Single .sql File Import
|
76
|
+
|
77
|
+
This will import a single file
|
78
|
+
```rails pattana:import:test:sql:file RAILS_ENV=test```
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
# Making the data for import
|
83
|
+
|
84
|
+
About mentioned data is stored in SQL like a backup file with insert statements.
|
85
|
+
|
86
|
+
However, we might have to update these information periodically at times. The make_data rake tasks deals with those.
|
87
|
+
|
88
|
+
## Parse countries.xlsx file and save them to coutries
|
89
|
+
|
90
|
+
```rails pattana:import:master_data:countries```
|
91
|
+
```rails pattana:import:make_data:countries_lat_lon```
|
92
|
+
|
93
|
+
The last command would update the lat and lon for the countries
|
94
|
+
|
95
|
+
|
96
|
+
## Parse regions/*.csv files and save them to coutries
|
97
|
+
|
98
|
+
```rails pattana:import:master_data:regions```
|
99
|
+
|
100
|
+
|
101
|
+
## Parse cities/*.csv files and save them to coutries
|
102
|
+
|
103
|
+
```rails pattana:import:master_data:cities```
|
104
|
+
|
105
|
+
|
data/lib/pattana/engine.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
module Pattana
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
|
4
|
+
# require 'pry'
|
5
|
+
require 'kaminari'
|
6
|
+
require 'kuppayam'
|
7
|
+
require 'colorize'
|
8
|
+
require 'colorized_string'
|
9
|
+
|
3
10
|
isolate_namespace Pattana
|
11
|
+
|
12
|
+
config.before_initialize do
|
13
|
+
config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]
|
14
|
+
end
|
15
|
+
|
16
|
+
config.generators do |g|
|
17
|
+
g.test_framework :rspec, :fixture => false
|
18
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/dummy/spec/factories'
|
19
|
+
g.assets false
|
20
|
+
g.helper false
|
21
|
+
end
|
22
|
+
|
4
23
|
end
|
5
24
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# This is to expose the factories in this gem
|
2
|
+
# By default, only files in /lib is exported
|
3
|
+
# hence this hack.
|
4
|
+
# Read More: https://stackoverflow.com/questions/31700345/how-can-i-share-the-factories-that-i-have-in-a-gem-and-use-it-in-other-project
|
5
|
+
|
6
|
+
GEM_ROOT = File.dirname(File.dirname(File.dirname(__FILE__)))
|
7
|
+
Dir[File.join(GEM_ROOT, 'spec', 'dummy', 'spec', 'factories', '*.rb')].each { |file| require(file) }
|
8
|
+
# binding.pry
|
data/lib/pattana/version.rb
CHANGED
data/lib/tasks/make_data.rake
CHANGED
@@ -2,66 +2,68 @@ require 'csv'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'time'
|
4
4
|
|
5
|
-
namespace '
|
6
|
-
namespace '
|
5
|
+
namespace 'pattana' do
|
6
|
+
namespace 'import' do
|
7
|
+
namespace 'make_data' do
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
9
|
+
# Import from xlsx
|
10
|
+
["Country"].each do |cls_name|
|
11
|
+
name = cls_name.underscore.pluralize
|
12
|
+
desc "Import #{cls_name.pluralize}"
|
13
|
+
task name => :environment do
|
14
|
+
verbose = true
|
15
|
+
verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
|
16
|
+
path = Pattana::Engine.root.join('db', 'make_data', "#{cls_name.constantize.table_name}.xlsx")
|
17
|
+
cls_name.constantize.import_data_file(path, true, verbose)
|
18
|
+
puts "Importing Completed".green if verbose
|
19
|
+
end
|
18
20
|
end
|
19
|
-
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
22
|
+
# # Import from a single CSV file
|
23
|
+
# ["Region"].each do |cls_name|
|
24
|
+
# name = cls_name.underscore.pluralize
|
25
|
+
# desc "Import #{cls_name.pluralize}"
|
26
|
+
# task name => :environment do
|
27
|
+
# verbose = true
|
28
|
+
# verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
|
29
|
+
# path = Pattana::Engine.root.join('db', 'make_data', "#{cls_name.constantize.table_name}.csv")
|
30
|
+
# cls_name.constantize.import_data_file(path, true, verbose)
|
31
|
+
# puts "Importing Completed".green if verbose
|
32
|
+
# end
|
33
|
+
# end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
# Import from multiple split CSV files
|
36
|
+
["Region", "City"].each do |cls_name|
|
37
|
+
name = cls_name.underscore.pluralize
|
38
|
+
desc "Import #{cls_name.pluralize}"
|
39
|
+
task name => :environment do
|
40
|
+
verbose = true
|
41
|
+
verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
|
42
|
+
path = Pattana::Engine.root.join('db', 'make_data', "#{cls_name.constantize.table_name}")
|
43
|
+
cls_name.constantize.import_data_recursively(path, true, verbose)
|
44
|
+
puts "Importing Completed".green if verbose
|
45
|
+
end
|
44
46
|
end
|
45
|
-
end
|
46
47
|
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
# Import Lattitude & Longitude for Countries
|
50
|
+
desc "Import Lat Lon for countries"
|
51
|
+
task "countries_lat_lon" => :environment do
|
52
|
+
path = Pattana::Engine.root.join('db', 'make_data', "countries_lat_lon.csv")
|
53
|
+
CSV.foreach(path, headers: true, header_converters: :symbol) do |row|
|
54
|
+
country = Country.where("iso_alpha_2 = ?", row[:iso]).first
|
55
|
+
if country
|
56
|
+
country.latitude = row[:geo_lat] if row[:geo_lat]
|
57
|
+
country.longitude = row[:geo_lng] if row[:geo_lng]
|
58
|
+
country.save
|
59
|
+
print ".".green
|
60
|
+
end
|
59
61
|
end
|
62
|
+
puts " "
|
63
|
+
puts "Importing Completed".green if verbose
|
60
64
|
end
|
61
|
-
puts " "
|
62
|
-
puts "Importing Completed".green if verbose
|
63
|
-
end
|
64
65
|
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
data/lib/tasks/master_data.rake
CHANGED
@@ -3,47 +3,49 @@ require 'open-uri'
|
|
3
3
|
require 'time'
|
4
4
|
require 'colorize'
|
5
5
|
|
6
|
-
namespace '
|
7
|
-
namespace '
|
6
|
+
namespace 'pattana' do
|
7
|
+
namespace 'import' do
|
8
|
+
namespace 'master_data' do
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
desc "Import all data in sequence"
|
11
|
+
task 'all' => :environment do
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
import_list = ["countries", "regions", "cities"]
|
14
|
+
|
15
|
+
import_list.each do |item|
|
16
|
+
print "Importing #{item.titleize} \t".yellow
|
17
|
+
begin
|
18
|
+
Rake::Task["pattana:import:master_data:#{item}"].invoke
|
19
|
+
rescue ArgumentError => e
|
20
|
+
puts "Loading #{item} - Failed - #{e.message}".red
|
21
|
+
rescue Exception => e
|
22
|
+
puts "Importing #{item.titleize} - Failed - #{e.message}".red
|
23
|
+
puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
|
24
|
+
end
|
23
25
|
end
|
26
|
+
puts " "
|
24
27
|
end
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
|
28
|
+
|
29
|
+
# Import from SQL file
|
30
|
+
["Country", "Region", "City"].each do |cls_name|
|
31
|
+
name = cls_name.underscore.pluralize
|
32
|
+
desc "Import #{cls_name.pluralize}"
|
33
|
+
task name => :environment do
|
34
|
+
path = Pattana::Engine.root.join('db', 'master_data', "#{cls_name.constantize.table_name}.sql")
|
35
|
+
begin
|
36
|
+
system "bundle exec rails db < #{path.to_s}"
|
37
|
+
puts "Imported #{cls_name.pluralize} SQL file successfully".green
|
38
|
+
puts "Saved #{cls_name.constantize.count} rows".green
|
39
|
+
rescue ArgumentError => e
|
40
|
+
puts "Loading #{cls_name} - Failed - #{e.message}".red
|
41
|
+
rescue Exception => e
|
42
|
+
puts "Importing #{cls_name.titleize} - Failed - #{e.message}".red
|
43
|
+
puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
45
|
-
end
|
46
47
|
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :city do
|
4
|
+
|
5
|
+
name "Region Name"
|
6
|
+
iso_code "RG-ISO-CODE"
|
7
|
+
|
8
|
+
country
|
9
|
+
region
|
10
|
+
|
11
|
+
# Lattitude and Longitude
|
12
|
+
latitude 12.00001
|
13
|
+
longitude 45.00001
|
14
|
+
|
15
|
+
population 100000
|
16
|
+
|
17
|
+
priority 1000
|
18
|
+
show_in_api false
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :country do
|
4
|
+
|
5
|
+
name "Country Name"
|
6
|
+
official_name "Official Name"
|
7
|
+
iso_name "OF"
|
8
|
+
|
9
|
+
# Federal Information Processing Standard
|
10
|
+
fips "FIPS"
|
11
|
+
|
12
|
+
iso_alpha_2 "OF"
|
13
|
+
iso_alpha_3 "OFN"
|
14
|
+
|
15
|
+
# Codes assigned by the International Telecommunications Union
|
16
|
+
itu_code "XYZ"
|
17
|
+
|
18
|
+
# International Dialing Prefix
|
19
|
+
dialing_prefix "999"
|
20
|
+
|
21
|
+
# Top Level Domain
|
22
|
+
tld ".world"
|
23
|
+
|
24
|
+
# Lattitude and Longitude
|
25
|
+
latitude 12.00001
|
26
|
+
longitude 45.00001
|
27
|
+
|
28
|
+
# Other Details
|
29
|
+
capital "Capital"
|
30
|
+
continent "Asia"
|
31
|
+
currency_code "ABC"
|
32
|
+
currency_name "AB Currency"
|
33
|
+
is_independent true
|
34
|
+
languages "Chakka, Manga, Thenga"
|
35
|
+
|
36
|
+
priority 1000
|
37
|
+
show_in_api false
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
end
|