Пример #1
0
        public async Task <List <AthleteSummary> > GetBothFollowingAsync(string athleteId)
        {
            string getUrl = string.Format("{0}/{1}/both-following?access_token={2}", "https://www.strava.com/api/v3/athletes", athleteId, Authentication.AccessToken);

            return(Unmarshaller <List <AthleteSummary> > .Unmarshal(await WebRequest.SendGetAsync(new Uri(getUrl))));
        }
Пример #2
0
        private async Task <Stats> GetStatsAsync(string id)
        {
            string getUrl = $"https://www.strava.com/api/v3/athletes/{id}/stats?access_token={Authentication.AccessToken}";

            return(Unmarshaller <Stats> .Unmarshal(await WebRequest.SendGetAsync(new Uri(getUrl))));
        }
Пример #3
0
        public void TestBikeUnmarshalling()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsNotNull(bike);
        }
Пример #4
0
                public static List <double> DeserializeList(String key, Deserializer deserializer)
                {
                    Unmarshaller unmarshaller = new Unmarshaller(deserializer.Get(key));

                    return(new List <double>(unmarshaller.UnmarshallArrayOfDouble()));
                }
        public void TestCommentsCount()
        {
            List <Comment> comments = Unmarshaller <List <Comment> > .Unmarshal(_json);

            Assert.IsTrue(comments.Count == 3);
        }
Пример #6
0
 /**
  * Constructs a new KS3 response handler that will use the specified SAX
  * unmarshaller to turn the response into an object.
  */
 public XmlResponseHandler(Unmarshaller <X, Stream> responseUnmarshaller)
 {
     this.responseUnmarshaller = responseUnmarshaller;
 }
Пример #7
0
        public void TestBikeWeight()
        {
            List <ActivityZone> zone = Unmarshaller <List <ActivityZone> > .Unmarshal(_json);

            Assert.IsTrue(zone.ElementAt(1).BikeWeight > 0);
        }
Пример #8
0
        public void TestBikeUnmarshallingFrameType()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsTrue(bike.FrameType == BikeType.Road);
        }
Пример #9
0
        public void TestBikeUnmarshallingDescription()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsTrue(bike.Description.Equals(String.Empty));
        }
Пример #10
0
        public void TestBikeUnmarshallingId()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsTrue(bike.Id.Equals("b814946"));
        }
Пример #11
0
        public void TestBikeUnmarshallingPrimary()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsTrue(bike.IsPrimary);
        }
Пример #12
0
        public void TestBikeUnmarshallingModel()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsTrue(bike.Model.Equals("Roadlite AL 7.0"));
        }
Пример #13
0
        public void TestBikeUnmarshallingBrand()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsTrue(bike.Brand.Equals("Canyon"));
        }
Пример #14
0
        public void TestBikeUnmarshallingName()
        {
            Gear.Bike bike = Unmarshaller <Gear.Bike> .Unmarshal(_json);

            Assert.IsTrue(bike.Name.Equals("Canyon Roadlite AL 7.0"));
        }
Пример #15
0
        public async Task <Athlete> UpdateAthleteSex(Gender gender)
        {
            string putUrl = string.Format("{0}?sex={1}&access_token={2}", "https://www.strava.com/api/v3/athlete", gender.ToString().Substring(0, 1), Authentication.AccessToken);

            return(Unmarshaller <Athlete> .Unmarshal(await WebRequest.SendPutAsync(new Uri(putUrl))));
        }
Пример #16
0
 public virtual void afterUnmarshal(Unmarshaller unmarshaller, object parent)
 {
     this.target++;
 }
Пример #17
0
        public async Task <Bike> GetGearAsync(string gearId)
        {
            string getUrl = string.Format("{0}/{1}?access_token={2}", "https://www.strava.com/api/v3/gear", gearId, Authentication.AccessToken);

            return(Unmarshaller <Bike> .Unmarshal(await WebRequest.SendGetAsync(new Uri(getUrl))));
        }
Пример #18
0
 public CallbackReceiverAdapter(Unmarshaller unmarshaller, Action action)
 {
     _unmarshaller = unmarshaller;
     _action       = action;
 }
Пример #19
0
        public void TestHeartRateMax()
        {
            List <ActivityZone> zone = Unmarshaller <List <ActivityZone> > .Unmarshal(_json);

            Assert.IsTrue(zone.ElementAt(0).Max.Equals(196));
        }
Пример #20
0
        public void TestAthleteUnmarshalling()
        {
            Athlete athlete = Unmarshaller <Athlete> .Unmarshal(_json);

            Assert.IsNotNull(athlete);
        }
Пример #21
0
        public void TestBucketSizes()
        {
            List <ActivityZone> zone = Unmarshaller <List <ActivityZone> > .Unmarshal(_json);

            Assert.IsTrue(zone.ElementAt(0).Buckets.Count == 5 && zone.ElementAt(1).Buckets.Count == 11);
        }
Пример #22
0
        public async Task <List <SegmentEffort> > GetSegmentEffortsByAthleteAsync(string segmentId, string athleteId, int page, int perPage)
        {
            string getUrl = string.Format("{0}/{1}/all_efforts?athlete_id={2}&page={3}&per_page={4}&access_token={5}", "https://www.strava.com/api/v3/segments", segmentId, athleteId, page, perPage, Authentication.AccessToken);

            return(Unmarshaller <List <SegmentEffort> > .Unmarshal(await WebRequest.SendGetAsync(new Uri(getUrl))));
        }
Пример #23
0
        public void TestCommentsUnmarshalling()
        {
            List <Comment> comments = Unmarshaller <List <Comment> > .Unmarshal(_json);

            Assert.IsNotNull(comments);
        }
Пример #24
0
        public async Task <List <SegmentEffort> > GetSegmentEffortsAsync(string segmentId, string athleteId, DateTime after, DateTime before, int page, int perPage)
        {
            string getUrl = string.Format("{0}/{1}/all_efforts?athlete_id={2}&start_date_local={3}&end_date_local={4}&page={5}per_page={6}&access_token={7}", "https://www.strava.com/api/v3/segments", segmentId, athleteId, after.ToString("O"), before.ToString("O"), page, perPage, Authentication.AccessToken);

            return(Unmarshaller <List <SegmentEffort> > .Unmarshal(await WebRequest.SendGetAsync(new Uri(getUrl))));
        }
Пример #25
0
        public void TestPhotoUnmarshalling()
        {
            Photo photo = Unmarshaller <Photo> .Unmarshal(_json);

            Assert.IsNotNull(photo);
        }
Пример #26
0
        public async Task <List <AthleteSummary> > GetFollowersAsync()
        {
            string getUrl = string.Format("{0}?access_token={1}", "https://www.strava.com/api/v3/athlete/followers", Authentication.AccessToken);

            return(Unmarshaller <List <AthleteSummary> > .Unmarshal(await WebRequest.SendGetAsync(new Uri(getUrl))));
        }
Пример #27
0
        public void TestActivityZoneUnmarshalling()
        {
            List <ActivityZone> zone = Unmarshaller <List <ActivityZone> > .Unmarshal(_json);

            Assert.IsNotNull(zone);
        }
Пример #28
0
        public async Task <UploadStatus> CheckUploadStatusAsync(string uploadId)
        {
            string checkUrl = string.Format("{0}/{1}?access_token={2}", "https://www.strava.com/api/v3/uploads/", uploadId, Authentication.AccessToken);

            return(Unmarshaller <UploadStatus> .Unmarshal(await WebRequest.SendGetAsync(new Uri(checkUrl))));
        }