Skip to content

Commit

Permalink
Actual model for 17.10
Browse files Browse the repository at this point in the history
  • Loading branch information
nalgeon committed Oct 30, 2017
1 parent bf0c1ad commit 7ea2b7f
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 84 deletions.
18 changes: 12 additions & 6 deletions src/SuggestClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ public void SetUp() {

[Test]
public void SuggestAddressTest() {
var query = "москва турчанинов 6";
var query = "москва турчанинов 6с2";
var response = api.QueryAddress(query);
Assert.AreEqual("119034", response.suggestions[0].data.postal_code);
var address_data = response.suggestions[0].data;
Assert.AreEqual("119034", address_data.postal_code);
Assert.AreEqual("7704", address_data.tax_office);
Assert.AreEqual("Кропоткинская", address_data.metro[0].name);
Console.WriteLine(string.Join("\n", response.suggestions));
}

Expand Down Expand Up @@ -111,11 +114,14 @@ public void SuggestFioPartsTest() {

[Test]
public void SuggestPartyTest() {
var query = "сбербанк";
var query = "7707083893";
var response = api.QueryParty(query);
Assert.AreEqual("7707083893", response.suggestions[0].data.inn);
Assert.AreEqual("г Москва, ул Вавилова, д 19", response.suggestions[0].data.address.value);
Assert.AreEqual("117312", response.suggestions[0].data.address.data.postal_code);
var party = response.suggestions[0];
var address = response.suggestions[0].data.address;
Assert.AreEqual("7707083893", party.data.inn);
Assert.AreEqual("г Москва, ул Вавилова, д 19", address.value);
Assert.AreEqual("117997 ГОРОД МОСКВА, УЛИЦА ВАВИЛОВА, дом 19", address.data.source);
Assert.AreEqual("117312", address.data.postal_code);
Console.WriteLine(string.Join("\n", response.suggestions));
}

Expand Down
200 changes: 122 additions & 78 deletions src/SuggestModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,67 +66,98 @@ public PartySuggestQuery(string query) : base(query) { }
}

public class AddressData {
public string postal_code { get; set; }
public string country { get; set; }
public string region_fias_id { get; set; }
public string region_kladr_id { get; set; }
public string region_with_type { get; set; }
public string region_type { get; set; }
public string region_type_full { get; set; }
public string region { get; set; }
public string area_fias_id { get; set; }
public string area_kladr_id { get; set; }
public string area_with_type { get; set; }
public string area_type { get; set; }
public string area_type_full { get; set; }
public string area { get; set; }
public string city_fias_id { get; set; }
public string city_kladr_id { get; set; }
public string city_with_type { get; set; }
public string city_type { get; set; }
public string city_type_full { get; set; }
public string city { get; set; }
public string city_area { get; set; }
public string source { get; set; }
public string postal_code { get; set; }
public string country { get; set; }

public string region_fias_id { get; set; }
public string region_kladr_id { get; set; }
public string region_with_type { get; set; }
public string region_type { get; set; }
public string region_type_full { get; set; }
public string region { get; set; }

public string area_fias_id { get; set; }
public string area_kladr_id { get; set; }
public string area_with_type { get; set; }
public string area_type { get; set; }
public string area_type_full { get; set; }
public string area { get; set; }

public string city_fias_id { get; set; }
public string city_kladr_id { get; set; }
public string city_with_type { get; set; }
public string city_type { get; set; }
public string city_type_full { get; set; }
public string city { get; set; }

public string city_area { get; set; }

public string city_district_fias_id { get; set; }
public string city_district_kladr_id { get; set; }
public string city_district_with_type { get; set; }
public string city_district_type { get; set; }
public string city_district_type_full { get; set; }
public string city_district { get; set; }
public string settlement_fias_id { get; set; }
public string settlement_kladr_id { get; set; }
public string settlement_with_type { get; set; }
public string settlement_type { get; set; }
public string settlement_type_full { get; set; }
public string settlement { get; set; }
public string street_fias_id { get; set; }
public string street_kladr_id { get; set; }
public string street_with_type { get; set; }
public string street_type { get; set; }
public string street_type_full { get; set; }
public string street { get; set; }
public string house_fias_id { get; set; }
public string house_kladr_id { get; set; }
public string house_type { get; set; }
public string house_type_full { get; set; }
public string house { get; set; }
public string block_type { get; set; }
public string block_type_full { get; set; }
public string block { get; set; }
public string flat_type { get; set; }
public string flat_type_full { get; set; }
public string flat { get; set; }
public string postal_box { get; set; }
public string fias_id { get; set; }
public string fias_level { get; set; }
public string kladr_id { get; set; }
public string capital_marker { get; set; }
public string okato { get; set; }
public string oktmo { get; set; }
public string tax_office { get; set; }
public string geo_lat { get; set; }
public string geo_lon { get; set; }
public string qc_geo { get; set; }

public string settlement_fias_id { get; set; }
public string settlement_kladr_id { get; set; }
public string settlement_with_type { get; set; }
public string settlement_type { get; set; }
public string settlement_type_full { get; set; }
public string settlement { get; set; }

public string street_fias_id { get; set; }
public string street_kladr_id { get; set; }
public string street_with_type { get; set; }
public string street_type { get; set; }
public string street_type_full { get; set; }
public string street { get; set; }

public string house_fias_id { get; set; }
public string house_kladr_id { get; set; }
public string house_type { get; set; }
public string house_type_full { get; set; }
public string house { get; set; }

public string block_type { get; set; }
public string block_type_full { get; set; }
public string block { get; set; }

public string flat_type { get; set; }
public string flat_type_full { get; set; }
public string flat { get; set; }
public string flat_area { get; set; }
public string square_meter_price { get; set; }
public string flat_price { get; set; }

public string postal_box { get; set; }
public string fias_id { get; set; }
public string fias_level { get; set; }
public string kladr_id { get; set; }
public string capital_marker { get; set; }

public string okato { get; set; }
public string oktmo { get; set; }
public string tax_office { get; set; }
public string tax_office_legal { get; set; }

public string timezone { get; set; }

public string geo_lat { get; set; }
public string geo_lon { get; set; }
public string qc_geo { get; set; }

public string beltway_hit { get; set; }
public string beltway_distance { get; set; }

public List<MetroData> metro { get; set; }
}

public class MetroData {
public string name { get; set; }
public string line { get; set; }
public decimal distance { get; set; }
}

public class AddressBound {
Expand All @@ -137,17 +168,20 @@ public AddressBound(string name) {
}

public class BankData {
public AddressData address { get; set; }
public string bic { get; set; }
public string correspondent_account { get; set; }
public BankNameData name { get; set; }
public string okpo { get; set; }
public BankOpfData opf { get; set; }
public string phone { get; set; }
public string registration_number { get; set; }
public string rkc { get; set; }
public PartyStateData state { get; set; }
public string swift { get; set; }
public AddressData address { get; set; }

public string bic { get; set; }
public string swift { get; set; }
public string registration_number { get; set; }
public string correspondent_account { get; set; }

public BankNameData name { get; set; }
public string okpo { get; set; }
public BankOpfData opf { get; set; }
public string phone { get; set; }
public string rkc { get; set; }
public PartyStateData state { get; set; }

}

public class BankNameData {
Expand Down Expand Up @@ -192,18 +226,26 @@ public enum FioPart {

public class PartyData {
public SuggestAddressResponse.Suggestions address { get; set; }
public string branch_count { get; set; }
public PartyBranchType branch_type { get; set; }
public string inn { get; set; }
public string kpp { get; set; }
public PartyManagementData management { get; set; }
public PartyNameData name { get; set; }
public string ogrn { get; set; }
public string okpo { get; set; }
public string okved { get; set; }
public PartyOpfData opf { get; set; }
public PartyStateData state { get; set; }
public PartyType type { get; set; }

public string branch_count { get; set; }
public PartyBranchType branch_type { get; set; }

public string inn { get; set; }
public string kpp { get; set; }
public string ogrn { get; set; }
public string ogrn_date { get; set; }
public string hid { get; set; }

public PartyManagementData management { get; set; }
public PartyNameData name { get; set; }

public string okpo { get; set; }
public string okved { get; set; }
public string okved_type { get; set; }

public PartyOpfData opf { get; set; }
public PartyStateData state { get; set; }
public PartyType type { get; set; }
}

public enum PartyBranchType {
Expand Down Expand Up @@ -250,6 +292,8 @@ public enum PartyType {

public abstract class Suggestion {
public string value { get; set; }
public string unrestricted_value { get; set; }

public override string ToString() {
return value;
}
Expand Down

0 comments on commit 7ea2b7f

Please sign in to comment.