Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block_lot_num field of Address #8

Merged
merged 1 commit into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions kenall.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ type (
TownMulti bool `json:"town_multi"`
TownRaw string `json:"town_raw"`
Corporation struct {
Name string `json:"name"`
NameKana string `json:"name_kana"`
BlockLot string `json:"block_lot"`
PostOffice string `json:"post_office"`
CodeType int `json:"code_type"`
Name string `json:"name"`
NameKana string `json:"name_kana"`
BlockLot string `json:"block_lot"`
BlockLotNum string `json:"block_lot_num"`
PostOffice string `json:"post_office"`
CodeType int `json:"code_type"`
} `json:"corporation"`
}
// A City is a city associated with the prefecture code defined by JIS X 0401.
Expand Down
2 changes: 1 addition & 1 deletion kenall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestClient_GetAddress(t *testing.T) {
wantError error
wantJISX0402 string
}{
"Normal case": {endpoint: srv.URL, token: "opencollector", ctx: context.Background(), postalCode: "1008105", checkAsError: false, wantError: nil, wantJISX0402: "13101"},
"Normal case": {endpoint: srv.URL, token: "opencollector", ctx: context.Background(), postalCode: "1008105", checkAsError: false, wantError: nil, wantJISX0402: "13104"},
"Invalid postal code": {endpoint: srv.URL, token: "opencollector", ctx: context.Background(), postalCode: "alphabet", checkAsError: false, wantError: kenall.ErrInvalidArgument, wantJISX0402: ""},
"Not found": {endpoint: srv.URL, token: "opencollector", ctx: context.Background(), postalCode: "0000000", checkAsError: false, wantError: kenall.ErrNotFound, wantJISX0402: ""},
"Unauthorized": {endpoint: srv.URL, token: "bad_token", ctx: context.Background(), postalCode: "0000000", checkAsError: false, wantError: kenall.ErrUnauthorized, wantJISX0402: ""},
Expand Down
23 changes: 12 additions & 11 deletions testdata/addresses.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"version": "2020-11-30",
"version": "2021-06-30",
"data": [
{
"jisx0402": "13101",
"old_code": "100",
"postal_code": "1008105",
"jisx0402": "13104",
"old_code": "16001",
"postal_code": "1638001",
"prefecture_kana": "",
"city_kana": "",
"town_kana": "",
"town_kana_raw": "",
"prefecture": "東京都",
"city": "千代田区",
"town": "大手町",
"city": "新宿区",
"town": "西新宿",
"koaza": "",
"kyoto_street": "",
"building": "",
Expand All @@ -20,12 +20,13 @@
"town_addressed_koaza": false,
"town_chome": false,
"town_multi": false,
"town_raw": "大手町",
"town_raw": "西新宿",
"corporation": {
"name": "チッソ 株式会社",
"name_kana": "チツソ カブシキガイシヤ",
"block_lot": "2丁目2-1(新大手町ビル)",
"post_office": "銀座",
"name": "東京都庁",
"name_kana": "トウキヨウトチヨウ",
"block_lot": "2丁目8-1",
"block_lot_num": "2-8-1",
"post_office": "新宿",
"code_type": 0
}
}
Expand Down