jp_address 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +97 -0
  4. data/Rakefile +26 -0
  5. data/app/assets/javascripts/jp_address/application.js +13 -0
  6. data/app/assets/stylesheets/jp_address/application.css +15 -0
  7. data/app/controllers/jp_address/application_controller.rb +4 -0
  8. data/app/controllers/jp_address/zipcodes_controller.rb +10 -0
  9. data/app/helpers/jp_address/application_helper.rb +4 -0
  10. data/app/models/jp_address/zipcode.rb +82 -0
  11. data/app/views/layouts/jp_address/application.html.erb +14 -0
  12. data/config/routes.rb +3 -0
  13. data/db/migrate/20160312045953_create_jp_address_zipcodes.rb +10 -0
  14. data/lib/jp_address/engine.rb +10 -0
  15. data/lib/jp_address/version.rb +3 -0
  16. data/lib/jp_address.rb +9 -0
  17. data/lib/tasks/jp_address_tasks.rake +4 -0
  18. data/spec/controllers/jp_address/zipcodes_controller_spec.rb +25 -0
  19. data/spec/dummy/README.rdoc +28 -0
  20. data/spec/dummy/Rakefile +6 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  24. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  25. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  26. data/spec/dummy/bin/bundle +3 -0
  27. data/spec/dummy/bin/rails +4 -0
  28. data/spec/dummy/bin/rake +4 -0
  29. data/spec/dummy/bin/setup +29 -0
  30. data/spec/dummy/config/application.rb +32 -0
  31. data/spec/dummy/config/boot.rb +5 -0
  32. data/spec/dummy/config/database.yml +25 -0
  33. data/spec/dummy/config/environment.rb +5 -0
  34. data/spec/dummy/config/environments/development.rb +41 -0
  35. data/spec/dummy/config/environments/production.rb +79 -0
  36. data/spec/dummy/config/environments/test.rb +42 -0
  37. data/spec/dummy/config/initializers/assets.rb +11 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  40. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/spec/dummy/config/initializers/inflections.rb +16 -0
  42. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +23 -0
  46. data/spec/dummy/config/routes.rb +3 -0
  47. data/spec/dummy/config/secrets.yml +22 -0
  48. data/spec/dummy/config.ru +4 -0
  49. data/spec/dummy/db/development.sqlite3 +0 -0
  50. data/spec/dummy/db/schema.rb +25 -0
  51. data/spec/dummy/db/test.sqlite3 +0 -0
  52. data/spec/dummy/log/development.log +94 -0
  53. data/spec/dummy/log/test.log +339 -0
  54. data/spec/dummy/public/404.html +67 -0
  55. data/spec/dummy/public/422.html +67 -0
  56. data/spec/dummy/public/500.html +66 -0
  57. data/spec/dummy/public/favicon.ico +0 -0
  58. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/12IZy0Kg85JEiQcCRYUMY0WrVHEdkMgrA7G08j930YU.cache +1 -0
  59. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/253HD8vijgocS-bRyHVbR3Dzm5uJNeuVCeCauWIWRf8.cache +0 -0
  60. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2uOFAmswR309it0YNLEVmbVZyiX9EJWBbinBWjyNRx0.cache +1 -0
  61. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4aDTBAJaIvo1TFYI0vJTFKYBDmI7XjTPFciorWDcsyk.cache +2 -0
  62. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  63. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/69Ny-heqQUOmGQ_0GcBB4J5b8RQZjPrgAF6LifZxpgk.cache +1 -0
  64. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7ouFV29lbf5bzHhKXQH2NGfdaYMT8OqW3TIKe1ABuNs.cache +0 -0
  65. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/942aiQdjYNWajz5VUTtaUTxyZBkhhxpq6219I0jYMa8.cache +0 -0
  66. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9LI-ZO_LlzUzSODnhfiCGx69vYDKb-yTnd280ujysVo.cache +0 -0
  67. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/9LzLG_vzjAf7pe050pFTyffRRVDzsU4VYFYMBOM0g3U.cache +1 -0
  68. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AhBkyHq-l-bB6dpyHinZOE7JH_YvG0POQNwk_AAfqco.cache +1 -0
  69. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/EA7g6gkLHxw4eCDr1hNwhMzVQV6HTR--3uBJwg0T7Gc.cache +1 -0
  70. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/IsQWv9ae0UmBQVto4XgJHJf3OIsun2azqgENluezzgw.cache +2 -0
  71. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/LrOkfegCiUn2D8SABgzKl7xSfnBUHoMDbBedoC3P-h4.cache +0 -0
  72. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/NOOlwk8slKyaGuSjS_iX4oaCxIN4dTyYcJAjiUVWOVk.cache +1 -0
  73. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  74. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Ql8vgt2ktFX4tfoI0C53kO_GHCmmAJRmmowTDbtAimw.cache +0 -0
  75. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/RPUX0Bt-77CDM4FCUc_Utl3S5ErxgrpkZK7qQucMGvc.cache +1 -0
  76. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/TlrmYyd_w5T2Fs5LcMQ0lYWdrDekCOo-_qrrQC05KPI.cache +1 -0
  77. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/WgrFnegPrsSNTONieBxtA-N3bBvn-e5a8DHo88uyOhU.cache +2 -0
  78. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/YdmjZwigjr6l2Sd-fgvN6s7rfUWR2LtHcWWo7jVIqYY.cache +0 -0
  79. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/aCSG1Z1RSE03OleZszY1eo-b1cXIN2s4uP3HZvAp6sE.cache +2 -0
  80. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/f2rHlaNoB9cFRX-xLMZq0no9HjRedEDg-AOUTKMUV5g.cache +0 -0
  81. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  82. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lHlUabpE2TZv_Y7rZBSXynyvTgrc_bnK1P8eJ_0ifv4.cache +1 -0
  83. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/lZ0oDq_sO844rDVEW1s5yAghM2KICOrOfIyKuQpT-Z0.cache +1 -0
  84. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/oqS0IfJ-I_LFqBdwIa1uZFLOlF62hCyOCgKgemnJoEI.cache +0 -0
  85. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  86. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/qge2ruqg_DxsMO2wq1BzbdTxpT2ktfT5ewP9nGce7gc.cache +0 -0
  87. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/s9K8VdL31LlJzdcRIo82vzu0ednsJm7KLs8WNLV1Ycw.cache +1 -0
  88. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/tN7T-0JFv1hq8Hb9xtUoHK2N5_3q72H7cjZpxTWT3NY.cache +0 -0
  89. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/uqjaGTY9XyZiyOZjN2CJkssIcw11b9rZATi7FgoZwDk.cache +2 -0
  90. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/v3lgWmRHuE8JSZyrRM04K6CSe8VgYugbXxDQXknjnF0.cache +1 -0
  91. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/vpPWGe-wWUYplBLlV5S9qVgufjluupjdyeOB4SXocdo.cache +1 -0
  92. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/w4phgPuV3DXfdM7WipkyPI6TOMuTqzotEtGB-PyzNF4.cache +0 -0
  93. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zG66jVRwJEU-Jqbt9aWxIlQKeSuWJAVWqi2Qj91w2PU.cache +1 -0
  94. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zPJPW4Mko5zmmRDei__9H3HwraRDuA-liVDWauxLEvg.cache +1 -0
  95. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zokKEtsBkyiagcapLIrloOC039ppkdRDQu7-eIp-sGU.cache +2 -0
  96. data/spec/factories/jp_address_zipcodes.rb +10 -0
  97. data/spec/models/jp_address/zipcode_spec.rb +29 -0
  98. data/spec/rails_helper.rb +15 -0
  99. data/spec/spec_helper.rb +92 -0
  100. data/spec/support/files/sample_ken.csv +5 -0
  101. data/spec/vcr/download_master_file_from_japanpost.yml +37476 -0
  102. metadata +327 -0
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI"8file-digest://app/assets/javascripts/application.js;TTI")file-digest://app/assets/javascripts;TT
@@ -0,0 +1 @@
1
+ "%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
@@ -0,0 +1 @@
1
+ I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=2cdede68d8f2efd019d6a4be48daf95339a1a01d4974ae0ee9ad38480be04958:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"Lprocessors:type=application/javascript&file_type=application/javascript;TTI"8file-digest://app/assets/javascripts/application.js;TTI"Zprocessors:type=application/javascript&file_type=application/javascript&pipeline=self;TTI")file-digest://app/assets/javascripts;TT
@@ -0,0 +1 @@
1
+ I"�/mnt/hgfs/source/jp_address/app/assets/stylesheets/jp_address/application.css?type=text/css&id=2e86a60c035f6182d596e25066b5c58099ad4e80f597193a12c4d3787d697643:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"?processors:type=text/css&file_type=text/css&pipeline=debug;TTI"`file-digest:///mnt/hgfs/source/jp_address/app/assets/stylesheets/jp_address/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI"Pfile-digest:///mnt/hgfs/source/jp_address/app/assets/stylesheets/jp_address;TT
@@ -0,0 +1 @@
1
+ "%�W\�yho9S���ƫ˥��)|�~���(���
@@ -0,0 +1 @@
1
+ "%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
@@ -0,0 +1 @@
1
+ "%�W\�yho9S���ƫ˥��)|�~���(���
@@ -0,0 +1 @@
1
+ I"}app/assets/stylesheets/application.css?type=text/css&id=52b02d7ef7fcae4b14fa3a9cd4805deea7b5ad2af7e9d5b1d03858c04629f61b:ET
@@ -0,0 +1,2 @@
1
+ [o:Set:
2
+ @hash{ I"environment-version:ETTI"environment-paths;TTI"rails-env;TTI"0processors:type=text/css&file_type=text/css;TTI"`file-digest:///mnt/hgfs/source/jp_address/app/assets/stylesheets/jp_address/application.css;TTI">processors:type=text/css&file_type=text/css&pipeline=self;TTI"Pfile-digest:///mnt/hgfs/source/jp_address/app/assets/stylesheets/jp_address;TT
@@ -0,0 +1,10 @@
1
+ # Read about factories at https://github.com/thoughtbot/factory_girl
2
+
3
+ FactoryGirl.define do
4
+ factory :jp_address_zipcode, :class => 'JpAddress::Zipcode' do
5
+ zip "5330033"
6
+ prefecture "大阪府"
7
+ city "大阪市東淀川区"
8
+ town "東中島"
9
+ end
10
+ end
@@ -0,0 +1,29 @@
1
+ require 'rails_helper'
2
+
3
+ module JpAddress
4
+ RSpec.describe Zipcode, type: :model do
5
+
6
+ describe ".download_master_file_from_japanpost" do
7
+ it "download zipcode file from japan-postal-site" do
8
+ VCR.use_cassette 'download_master_file_from_japanpost' do
9
+ expect(JpAddress::Zipcode.download_master_file_from_japanpost).to eq :success
10
+ end
11
+ end
12
+ end
13
+
14
+ describe ".load_master_data" do
15
+ it "load master data csv to table" do
16
+ JpAddress::Zipcode.load_master_data 'spec/support/files/sample_ken.csv'
17
+ expect(JpAddress::Zipcode.count).to eq 5
18
+ expect(JpAddress::Zipcode.last.prefecture).to eq '北海道'
19
+ end
20
+ end
21
+
22
+ describe "._remove_needless_words" do
23
+ it "remove needless words" do
24
+ expect(JpAddress::Zipcode.send(:_remove_needless_words, '以下に掲載がない場合')).to eq ''
25
+ expect(JpAddress::Zipcode.send(:_remove_needless_words, '大通西(1~19丁目)')).to eq '大通西'
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,15 @@
1
+ ENV["RAILS_ENV"] ||= 'test'
2
+ require 'spec_helper'
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'factory_girl_rails'
6
+ require 'vcr'
7
+
8
+ RSpec.configure do |config|
9
+ config.include FactoryGirl::Syntax::Methods
10
+ end
11
+ VCR.configure do |c|
12
+ c.cassette_library_dir = 'spec/vcr'
13
+ c.hook_into :webmock
14
+ c.allow_http_connections_when_no_cassette = true
15
+ end
@@ -0,0 +1,92 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Allows RSpec to persist some state between runs in order to support
54
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
55
+ # you configure your source control system to ignore this file.
56
+ config.example_status_persistence_file_path = "spec/examples.txt"
57
+
58
+ # Limits the available syntax to the non-monkey patched syntax that is
59
+ # recommended. For more details, see:
60
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
61
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
62
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
63
+ config.disable_monkey_patching!
64
+
65
+ # Many RSpec users commonly either run the entire suite or an individual
66
+ # file, and it's useful to allow more verbose output when running an
67
+ # individual spec file.
68
+ if config.files_to_run.one?
69
+ # Use the documentation formatter for detailed output,
70
+ # unless a formatter has already been configured
71
+ # (e.g. via a command-line flag).
72
+ config.default_formatter = 'doc'
73
+ end
74
+
75
+ # Print the 10 slowest examples and example groups at the
76
+ # end of the spec run, to help surface which specs are running
77
+ # particularly slow.
78
+ config.profile_examples = 10
79
+
80
+ # Run specs in random order to surface order dependencies. If you find an
81
+ # order dependency and want to debug it, you can fix the order by providing
82
+ # the seed, which is printed after each run.
83
+ # --seed 1234
84
+ config.order = :random
85
+
86
+ # Seed global randomization in this process using the `--seed` CLI option.
87
+ # Setting this allows you to use `--seed` to deterministically reproduce
88
+ # test failures related to randomization by passing the same `--seed` value
89
+ # as the one that triggered the failure.
90
+ Kernel.srand config.seed
91
+ =end
92
+ end
@@ -0,0 +1,5 @@
1
+ 01101,"060 ","0600000","ί���޳","����ۼ������","��ƹ�����Ų�ޱ�","�k�C��","�D�y�s������","�ȉ��Ɍf�ڂ��Ȃ��ꍇ",0,0,0,0,0,0
2
+ 01101,"064 ","0640941","ί���޳","����ۼ������","��˶޵�","�k�C��","�D�y�s������","���P�u",0,0,1,0,0,0
3
+ 01101,"060 ","0600041","ί���޳","����ۼ������","���޵�˶޼","�k�C��","�D�y�s������","��ʓ�",0,0,1,0,0,0
4
+ 01101,"060 ","0600042","ί���޳","����ۼ������","���޵�Ƽ(1-19����)","�k�C��","�D�y�s������","��ʐ��i�P�`�P�X���ځj",1,0,1,0,0,0
5
+ 01101,"064 ","0640820","ί���޳","����ۼ������","���޵�Ƽ(20-28����)","�k�C��","�D�y�s������","��ʐ��i�Q�O�`�Q�W���ځj",1,0,1,0,0,0