addresses 1.0.11 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/addresses/application_controller.rb +2 -0
  3. data/app/controllers/addresses/cities_controller.rb +3 -1
  4. data/app/controllers/addresses/neighborhoods_controller.rb +4 -2
  5. data/app/controllers/addresses/states_controller.rb +5 -5
  6. data/app/controllers/addresses/zipcodes_controller.rb +7 -5
  7. data/app/models/addresses/address.rb +5 -2
  8. data/app/models/addresses/city.rb +5 -1
  9. data/app/models/addresses/country.rb +3 -0
  10. data/app/models/addresses/neighborhood.rb +4 -0
  11. data/app/models/addresses/state.rb +4 -0
  12. data/app/models/addresses/zipcode.rb +11 -39
  13. data/config/routes.rb +2 -0
  14. data/db/migrate/20140327141509_create_addresses_countries.rb +2 -1
  15. data/db/migrate/20140327163801_create_addresses_states.rb +2 -1
  16. data/db/migrate/20140327171527_create_addresses_cities.rb +2 -1
  17. data/db/migrate/20140327190411_create_addresses_neighborhoods.rb +2 -1
  18. data/db/migrate/20140328120418_create_addresses_addresses.rb +3 -1
  19. data/db/migrate/20160920172944_create_addresses_zipcodes.rb +2 -0
  20. data/db/migrate/20160920174406_remove_zipcode_attributes_from_addresses.rb +2 -0
  21. data/db/migrate/20191008052817_add_indexes.rb +21 -0
  22. data/lib/addresses.rb +3 -1
  23. data/lib/addresses/engine.rb +4 -2
  24. data/lib/tasks/addresses_tasks.rake +6 -6
  25. data/lib/tasks/populate/br/cities.rake +5573 -0
  26. data/lib/tasks/populate/br/countries.rake +247 -0
  27. data/lib/tasks/populate/br/neighborhoods.rake +40825 -0
  28. data/lib/tasks/populate/br/states.rake +35 -0
  29. data/lib/tasks/populate/br/zipcodes.rake +40 -0
  30. data/spec/controllers/addresses/cities_controller_spec.rb +1 -1
  31. data/spec/controllers/addresses/neighborhoods_controller_spec.rb +1 -1
  32. data/spec/controllers/addresses/states_controller_spec.rb +1 -1
  33. data/spec/controllers/addresses/zipcodes_controller_spec.rb +1 -1
  34. data/spec/dummy/Gemfile +1 -1
  35. data/spec/dummy/Gemfile.lock +107 -84
  36. data/spec/dummy/config/application.rb +1 -1
  37. data/spec/dummy/db/development.sqlite3 +0 -0
  38. data/spec/dummy/db/migrate/{20190614190958_create_addresses_countries.addresses.rb → 20191008054118_create_addresses_countries.addresses.rb} +1 -0
  39. data/spec/dummy/db/migrate/{20190614190959_create_addresses_states.addresses.rb → 20191008054119_create_addresses_states.addresses.rb} +1 -0
  40. data/spec/dummy/db/migrate/{20190614190960_create_addresses_cities.addresses.rb → 20191008054120_create_addresses_cities.addresses.rb} +1 -0
  41. data/spec/dummy/db/migrate/{20190614190961_create_addresses_neighborhoods.addresses.rb → 20191008054121_create_addresses_neighborhoods.addresses.rb} +1 -0
  42. data/spec/dummy/db/migrate/{20190614190962_create_addresses_addresses.addresses.rb → 20191008054122_create_addresses_addresses.addresses.rb} +2 -0
  43. data/spec/dummy/db/migrate/{20190614190963_create_addresses_zipcodes.addresses.rb → 20191008054123_create_addresses_zipcodes.addresses.rb} +2 -0
  44. data/spec/dummy/db/migrate/{20190614190964_remove_zipcode_attributes_from_addresses.addresses.rb → 20191008054124_remove_zipcode_attributes_from_addresses.addresses.rb} +2 -0
  45. data/spec/dummy/db/migrate/20191008054125_add_indexes.addresses.rb +22 -0
  46. data/spec/dummy/db/schema.rb +36 -26
  47. data/spec/dummy/db/test.sqlite3 +0 -0
  48. data/spec/dummy/log/development.log +463 -0
  49. data/spec/dummy/log/test.log +9374 -0
  50. data/spec/factories/addresses.rb +3 -3
  51. data/spec/factories/cities.rb +2 -2
  52. data/spec/factories/countries.rb +3 -3
  53. data/spec/factories/neighborhoods.rb +2 -2
  54. data/spec/factories/states.rb +3 -3
  55. data/spec/factories/zipcodes.rb +3 -3
  56. data/spec/fixtures/zipcodes/br/ceps.txt +0 -0
  57. data/spec/models/addresses/address_spec.rb +3 -3
  58. data/spec/models/addresses/city_spec.rb +1 -1
  59. data/spec/models/addresses/country_spec.rb +1 -1
  60. data/spec/models/addresses/neighborhood_spec.rb +1 -1
  61. data/spec/models/addresses/state_spec.rb +1 -1
  62. data/spec/models/addresses/zipcode_spec.rb +1 -30
  63. data/spec/{spec_helper.rb → rails_helper.rb} +3 -4
  64. data/spec/requests/cities_spec.rb +1 -1
  65. data/spec/requests/neighborhoods_spec.rb +1 -1
  66. data/spec/requests/zipcodes_spec.rb +11 -5
  67. data/spec/routing/cities_routing_spec.rb +1 -1
  68. data/spec/routing/neighborhoods_routing_spec.rb +1 -1
  69. data/spec/routing/zipcodes_routing_spec.rb +1 -1
  70. metadata +42 -54
  71. data/README.rdoc +0 -55
  72. data/app/assets/javascripts/addresses/application.js +0 -13
  73. data/app/assets/stylesheets/addresses/application.css +0 -13
  74. data/app/helpers/addresses/application_helper.rb +0 -4
  75. data/app/services/zipcode_service.rb +0 -42
  76. data/lib/tasks/natal_city.rake +0 -50
  77. data/lib/tasks/populate_cities.rake +0 -5570
  78. data/lib/tasks/populate_countries.rake +0 -243
  79. data/lib/tasks/populate_neighborhoods.rake +0 -40823
  80. data/lib/tasks/populate_states.rake +0 -32
  81. data/spec/dummy/db/migrate/20190614190716_create_addresses_countries.addresses.rb +0 -13
  82. data/spec/services/zipcode_service_spec.rb +0 -29
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
-
3
- desc "Populate states"
4
- task :populate_states => [:environment] do
5
- Addresses::State.create(id: '28', name: 'Acre', acronym: 'AC', country_id: 33)
6
- Addresses::State.create(id: '29', name: 'Alagoas', acronym: 'AL', country_id: 33)
7
- Addresses::State.create(id: '30', name: 'Amazonas', acronym: 'AM', country_id: 33)
8
- Addresses::State.create(id: '31', name: 'Amapá', acronym: 'AP', country_id: 33)
9
- Addresses::State.create(id: '32', name: 'Bahia', acronym: 'BA', country_id: 33)
10
- Addresses::State.create(id: '33', name: 'Ceará', acronym: 'CE', country_id: 33)
11
- Addresses::State.create(id: '34', name: 'Brasília', acronym: 'DF', country_id: 33)
12
- Addresses::State.create(id: '35', name: 'Espírito Santo', acronym: 'ES', country_id: 33)
13
- Addresses::State.create(id: '36', name: 'Goiás', acronym: 'GO', country_id: 33)
14
- Addresses::State.create(id: '37', name: 'Maranhão', acronym: 'MA', country_id: 33)
15
- Addresses::State.create(id: '38', name: 'Minas Gerais', acronym: 'MG', country_id: 33)
16
- Addresses::State.create(id: '39', name: 'Mato Grosso do Sul', acronym: 'MS', country_id: 33)
17
- Addresses::State.create(id: '40', name: 'Mato Grosso', acronym: 'MT', country_id: 33)
18
- Addresses::State.create(id: '41', name: 'Pará', acronym: 'PA', country_id: 33)
19
- Addresses::State.create(id: '42', name: 'Paraíba', acronym: 'PB', country_id: 33)
20
- Addresses::State.create(id: '43', name: 'Pernambuco', acronym: 'PE', country_id: 33)
21
- Addresses::State.create(id: '44', name: 'Piauí', acronym: 'PI', country_id: 33)
22
- Addresses::State.create(id: '45', name: 'Paraná', acronym: 'PR', country_id: 33)
23
- Addresses::State.create(id: '46', name: 'Rio de Janeiro', acronym: 'RJ', country_id: 33)
24
- Addresses::State.create(id: '47', name: 'Rio Grande do Norte', acronym: 'RN', country_id: 33)
25
- Addresses::State.create(id: '48', name: 'Rondônia', acronym: 'RO', country_id: 33)
26
- Addresses::State.create(id: '49', name: 'Roraima', acronym: 'RR', country_id: 33)
27
- Addresses::State.create(id: '50', name: 'Rio Grande do Sul', acronym: 'RS', country_id: 33)
28
- Addresses::State.create(id: '51', name: 'Santa Catarina', acronym: 'SC', country_id: 33)
29
- Addresses::State.create(id: '52', name: 'Sergipe', acronym: 'SE', country_id: 33)
30
- Addresses::State.create(id: '53', name: 'São Paulo', acronym: 'SP', country_id: 33)
31
- Addresses::State.create(id: '54', name: 'Tocantins', acronym: 'TO', country_id: 33)
32
- end
@@ -1,13 +0,0 @@
1
- # encoding: utf-8
2
- # This migration comes from addresses (originally 20140327141509)
3
-
4
- class CreateAddressesCountries < ActiveRecord::Migration
5
- def change
6
- create_table :addresses_countries do |t|
7
- t.string :name
8
- t.string :acronym
9
-
10
- t.timestamps
11
- end
12
- end
13
- end
@@ -1,29 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe ZipcodeService, type: :service do
4
- describe '.find', :vcr do
5
- context 'when pass a valid zipcode' do
6
- let!(:zipcode) { ZipcodeService.find('05012010') }
7
-
8
- it { expect(zipcode).not_to be_nil}
9
- it { expect(zipcode[:cidade]).to eq('São Paulo')}
10
- it { expect(zipcode[:bairro]).to eq('Vila Pompeia')}
11
- it { expect(zipcode[:logradouro]).to eq('Ministro Gastão Mesquita')}
12
- it { expect(zipcode[:tipo_logradouro]).to eq('Rua')}
13
- it { expect(zipcode[:uf]).to eq('SP')}
14
- it { expect(zipcode[:zipcode]).to eq('05012010')}
15
- end
16
-
17
- context 'when pass a invalid zipcode' do
18
- it { expect { ZipcodeService.find('99999999') }.to raise_error(ZipcodeNotFound) }
19
- end
20
-
21
- context 'when server is not avaialable' do
22
- before do
23
- allow_any_instance_of(Net::HTTPOK).to receive(:kind_of?).and_return(false)
24
- end
25
-
26
- it { expect { ZipcodeService.find('05012010') }.to raise_error(WebServiceNotAvaialable) }
27
- end
28
- end
29
- end