pattana 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/android-icon-144x144.png +0 -0
  3. data/app/assets/images/android-icon-192x192.png +0 -0
  4. data/app/assets/images/android-icon-36x36.png +0 -0
  5. data/app/assets/images/android-icon-48x48.png +0 -0
  6. data/app/assets/images/android-icon-72x72.png +0 -0
  7. data/app/assets/images/android-icon-96x96.png +0 -0
  8. data/app/assets/images/apple-icon-114x114.png +0 -0
  9. data/app/assets/images/apple-icon-120x120.png +0 -0
  10. data/app/assets/images/apple-icon-144x144.png +0 -0
  11. data/app/assets/images/apple-icon-152x152.png +0 -0
  12. data/app/assets/images/apple-icon-180x180.png +0 -0
  13. data/app/assets/images/apple-icon-57x57.png +0 -0
  14. data/app/assets/images/apple-icon-60x60.png +0 -0
  15. data/app/assets/images/apple-icon-72x72.png +0 -0
  16. data/app/assets/images/apple-icon-76x76.png +0 -0
  17. data/app/assets/images/apple-icon-precomposed.png +0 -0
  18. data/app/assets/images/apple-icon.png +0 -0
  19. data/app/assets/images/browserconfig.xml +1 -8
  20. data/app/assets/images/favicon-16x16.png +0 -0
  21. data/app/assets/images/favicon-32x32.png +0 -0
  22. data/app/assets/images/favicon-96x96.png +0 -0
  23. data/app/assets/images/favicon.ico +0 -0
  24. data/app/assets/images/logo-on-white.png +0 -0
  25. data/app/assets/images/logo-small.png +0 -0
  26. data/app/assets/images/logo.png +0 -0
  27. data/app/assets/images/manifest.json +39 -16
  28. data/app/assets/images/ms-icon-144x144.png +0 -0
  29. data/app/assets/images/ms-icon-150x150.png +0 -0
  30. data/app/assets/images/ms-icon-310x310.png +0 -0
  31. data/app/assets/images/ms-icon-70x70.png +0 -0
  32. data/app/assets/sketches/logo.sketch +0 -0
  33. data/import.md +105 -0
  34. data/lib/pattana/engine.rb +19 -0
  35. data/lib/pattana/factories.rb +8 -0
  36. data/lib/pattana/version.rb +1 -1
  37. data/lib/tasks/make_data.rake +52 -50
  38. data/lib/tasks/master_data.rake +36 -34
  39. data/spec/dummy/spec/factories/city.rb +21 -0
  40. data/spec/dummy/spec/factories/country.rb +41 -0
  41. data/spec/dummy/spec/factories/region.rb +19 -0
  42. metadata +32 -60
  43. data/app/assets/images/android-chrome-192x192.png +0 -0
  44. data/app/assets/images/android-chrome-512x512.png +0 -0
  45. data/app/assets/images/apple-touch-icon-114x114.png +0 -0
  46. data/app/assets/images/apple-touch-icon-120x120.png +0 -0
  47. data/app/assets/images/apple-touch-icon-144x144.png +0 -0
  48. data/app/assets/images/apple-touch-icon-152x152.png +0 -0
  49. data/app/assets/images/apple-touch-icon-180x180.png +0 -0
  50. data/app/assets/images/apple-touch-icon-57x57.png +0 -0
  51. data/app/assets/images/apple-touch-icon-60x60.png +0 -0
  52. data/app/assets/images/apple-touch-icon-72x72.png +0 -0
  53. data/app/assets/images/apple-touch-icon-76x76.png +0 -0
  54. data/app/assets/images/apple-touch-icon.png +0 -0
  55. data/app/assets/images/mstile-150x150.png +0 -0
  56. data/app/assets/images/safari-pinned-tab.svg +0 -25
  57. data/db/archives/cities.zip +0 -0
  58. data/db/archives/countries_lat_lon_master.csv +0 -462
  59. data/db/archives/countries_master.xlsx +0 -0
  60. data/db/archives/future_database/cities1000.zip +0 -0
  61. data/db/archives/future_database/cities15000.zip +0 -0
  62. data/db/archives/future_database/cities5000.zip +0 -0
  63. data/db/archives/future_database/cities_millions.zip +0 -0
  64. data/db/archives/regions.csv +0 -4149
  65. data/db/archives/regions.xlsx +0 -0
  66. data/db/make_data/cities/cy-3-win-aa.csv +0 -10001
  67. data/db/make_data/cities/cy-3-win-ab.csv +0 -10189
  68. data/db/make_data/cities/cy-3-win-ac.csv +0 -10001
  69. data/db/make_data/cities/cy-3-win-ad.csv +0 -10012
  70. data/db/make_data/cities/cy-3-win-ae.csv +0 -7868
  71. data/db/make_data/cities/errors.txt +0 -107
  72. data/db/make_data/cities/master-1-win.csv +0 -101909
  73. data/db/make_data/cities/master-2-win.csv +0 -7323
  74. data/db/make_data/cities/master-3-win.csv +0 -48067
  75. data/db/make_data/cities/split_csv.sh +0 -51
  76. data/db/make_data/countries.xlsx +0 -0
  77. data/db/make_data/countries_lat_lon.csv +0 -462
  78. data/db/make_data/regions/master-1-win.csv +0 -3941
  79. data/db/make_data/regions/master-2-win.csv +0 -4149
  80. data/db/make_data/regions/rg-1-win-aa.csv +0 -1001
  81. data/db/make_data/regions/rg-1-win-ab.csv +0 -1001
  82. data/db/make_data/regions/rg-1-win-ac.csv +0 -1001
  83. data/db/make_data/regions/rg-1-win-ad.csv +0 -941
  84. data/db/make_data/regions/rg-2-win-aa.csv +0 -1001
  85. data/db/make_data/regions/rg-2-win-ab.csv +0 -1001
  86. data/db/make_data/regions/rg-2-win-ac.csv +0 -1001
  87. data/db/make_data/regions/rg-2-win-ad.csv +0 -1001
  88. data/db/make_data/regions/rg-2-win-ae.csv +0 -149
  89. data/db/make_data/regions/split_csv.sh +0 -51
  90. data/db/migrate/20170000000003_create_countries.rb +0 -47
  91. data/db/migrate/20170000000004_create_regions.rb +0 -23
  92. data/db/migrate/20170000000005_create_cities.rb +0 -27
  93. data/db/test_data/single_file/master.csv +0 -8294
  94. data/db/test_data/split_files/master.csv +0 -101909
  95. data/db/test_data/split_files/split_csv.sh +0 -51
  96. data/lib/tasks/pattana_tasks.rake +0 -4
  97. data/lib/tasks/template.rake +0 -72
  98. data/lib/tasks/test_import.rake +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '03081d1498945ccd6d37cce12d57f82e3c42b396'
4
- data.tar.gz: 863a9feb0f8510a863c8f02e246e268d55206e71
3
+ metadata.gz: 9d2b566f1a20f35368c5e99d93fdde8a3b3a9e18
4
+ data.tar.gz: 688dbf20ca7c12c1af959a0dbf1965ef77ce1a6c
5
5
  SHA512:
6
- metadata.gz: d634216a6d583dfe616df783e69af5e68b95a1d9aabcb51f69005377c4c20271a9f58defa8a2058d794ae1f56d521807018a736b183559efdb973be0c4f493cd
7
- data.tar.gz: 493f66bb1e0ab51c66d95069fe01d174c6a3422f67b5bce1139e1e025bbbdf24e567d7f24daf6a7f2aa7477c40dfffef3a693438dc805452c2376d4b7729f929
6
+ metadata.gz: b9abfefaaff0c9ffc6809b62abc7fb9220394dbc6af6a574c6969df3086cfac245d58feef19e540358621407740483a4365ba38be88b3d49fb8850eef71d3566
7
+ data.tar.gz: 109ee72c4ee3f9d0693b923a224ad82e21f484296a2d4771edcadbcdcae7554ec319293a58740a7121ac7c8918a23f3d34d3a5ffb33c94a97bb53295a442f0ba
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
Binary file
@@ -1,18 +1,41 @@
1
1
  {
2
- "name": "Kuppayam",
3
- "icons": [
4
- {
5
- "src": "/assets/android-chrome-192x192.png",
6
- "sizes": "192x192",
7
- "type": "image/png"
8
- },
9
- {
10
- "src": "/assets/android-chrome-512x512.png",
11
- "sizes": "512x512",
12
- "type": "image/png"
13
- }
14
- ],
15
- "theme_color": "#ffffff",
16
- "background_color": "#ffffff",
17
- "display": "standalone"
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
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
+
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Pattana
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -2,66 +2,68 @@ require 'csv'
2
2
  require 'open-uri'
3
3
  require 'time'
4
4
 
5
- namespace 'import' do
6
- namespace 'make_data' do
5
+ namespace 'pattana' do
6
+ namespace 'import' do
7
+ namespace 'make_data' do
7
8
 
8
- # Import from xlsx
9
- ["Country"].each do |cls_name|
10
- name = cls_name.underscore.pluralize
11
- desc "Import #{cls_name.pluralize}"
12
- task name => :environment do
13
- verbose = true
14
- verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
15
- path = Pattana::Engine.root.join('db', 'make_data', "#{cls_name.constantize.table_name}.xlsx")
16
- cls_name.constantize.import_data_file(path, true, verbose)
17
- puts "Importing Completed".green if verbose
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
- # # Import from a single CSV file
22
- # ["Region"].each do |cls_name|
23
- # name = cls_name.underscore.pluralize
24
- # desc "Import #{cls_name.pluralize}"
25
- # task name => :environment do
26
- # verbose = true
27
- # verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
28
- # path = Pattana::Engine.root.join('db', 'make_data', "#{cls_name.constantize.table_name}.csv")
29
- # cls_name.constantize.import_data_file(path, true, verbose)
30
- # puts "Importing Completed".green if verbose
31
- # end
32
- # end
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
- # Import from multiple split CSV files
35
- ["Region", "City"].each do |cls_name|
36
- name = cls_name.underscore.pluralize
37
- desc "Import #{cls_name.pluralize}"
38
- task name => :environment do
39
- verbose = true
40
- verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
41
- path = Pattana::Engine.root.join('db', 'make_data', "#{cls_name.constantize.table_name}")
42
- cls_name.constantize.import_data_recursively(path, true, verbose)
43
- puts "Importing Completed".green if verbose
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
- # Import Lattitude & Longitude for Countries
49
- desc "Import Lat Lon for countries"
50
- task "countries_lat_lon" => :environment do
51
- path = Pattana::Engine.root.join('db', 'make_data', "countries_lat_lon.csv")
52
- CSV.foreach(path, headers: true, header_converters: :symbol) do |row|
53
- country = Country.where("iso_alpha_2 = ?", row[:iso]).first
54
- if country
55
- country.latitude = row[:geo_lat] if row[:geo_lat]
56
- country.longitude = row[:geo_lng] if row[:geo_lng]
57
- country.save
58
- print ".".green
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
 
@@ -3,47 +3,49 @@ require 'open-uri'
3
3
  require 'time'
4
4
  require 'colorize'
5
5
 
6
- namespace 'import' do
7
- namespace 'master_data' do
6
+ namespace 'pattana' do
7
+ namespace 'import' do
8
+ namespace 'master_data' do
8
9
 
9
- desc "Import all data in sequence"
10
- task 'all' => :environment do
10
+ desc "Import all data in sequence"
11
+ task 'all' => :environment do
11
12
 
12
- import_list = ["countries", "regions", "cities"]
13
-
14
- import_list.each do |item|
15
- print "Importing #{item.titleize} \t".yellow
16
- begin
17
- Rake::Task["import:master_data:#{item}"].invoke
18
- rescue ArgumentError => e
19
- puts "Loading #{item} - Failed - #{e.message}".red
20
- rescue Exception => e
21
- puts "Importing #{item.titleize} - Failed - #{e.message}".red
22
- puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
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
- puts " "
26
- end
27
-
28
- # Import from SQL file
29
- ["Country", "Region", "City"].each do |cls_name|
30
- name = cls_name.underscore.pluralize
31
- desc "Import #{cls_name.pluralize}"
32
- task name => :environment do
33
- path = Pattana::Engine.root.join('db', 'master_data', "#{cls_name.constantize.table_name}.sql")
34
- begin
35
- system "bundle exec rails db < #{path.to_s}"
36
- puts "Imported #{cls_name.pluralize} SQL file successfully".green
37
- puts "Saved #{cls_name.constantize.count} rows".green
38
- rescue ArgumentError => e
39
- puts "Loading #{cls_name} - Failed - #{e.message}".red
40
- rescue Exception => e
41
- puts "Importing #{cls_name.titleize} - Failed - #{e.message}".red
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
@@ -0,0 +1,19 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :region do
4
+
5
+ name "Region Name"
6
+ iso_code "RG-ISO-CODE"
7
+
8
+ country
9
+
10
+ # Lattitude and Longitude
11
+ latitude 12.00001
12
+ longitude 45.00001
13
+
14
+ priority 1000
15
+ show_in_api false
16
+ end
17
+
18
+
19
+ end