Example #1
0
        public async Task <Arr <Flat> > GetLatestUpdate()
        {
            var json = await GetLatestUpdateJson();// GetTestData();

            var root  = JToken.Parse(json);
            var flats = root["apartments"].Map(x => new Flat(
                                                   id: x["id"].Value <int>(),
                                                   url: x["url"].Value <string>(),
                                                   photoUrl: x["photo"].Value <string>(),
                                                   type: x["rent_type"].Value <string>(),
                                                   address: x["location"]["user_address"].Value <string>(),
                                                   location: x["location"].Apply(y => new Location(y["latitude"].Value <double>(), y["longitude"].Value <double>())),
                                                   isOwner: x["contact"]["owner"].Value <bool>(),
                                                   price: UsdPrice.Parse(x["price"]["converted"]["USD"]["amount"].Value <string>()),
                                                   createdAt: x["created_at"].Value <DateTime>(),
                                                   updatedAt: x["last_time_up"].Value <DateTime>()
                                                   )).ToArr();

            return(flats);
        }