internal MatchTimelineDTO(matchTimelineEndpoint timeline)
        {
            Guard.Argument(timeline, nameof(timeline)).NotNull();
            Guard.Argument(timeline.sport_event, nameof(timeline.sport_event)).NotNull();

            SportEvent = RestMapperHelper.MapSportEvent(timeline.sport_event);

            if (timeline.coverage_info != null)
            {
                CoverageInfo = new CoverageInfoDTO(timeline.coverage_info);
            }

            if (timeline.sport_event_conditions != null)
            {
                SportEventConditions = new SportEventConditionsDTO(timeline.sport_event_conditions);
            }

            if (timeline.sport_event_status != null)
            {
                SportEventStatus = new SportEventStatusDTO(timeline.sport_event_status, null, RestMapperHelper.FillHomeAwayCompetitors(timeline.sport_event.competitors));
            }

            if (timeline.timeline != null && timeline.timeline.Length > 0)
            {
                BasicEvents = timeline.timeline.Select(s => new BasicEventDTO(s));
            }

            GeneratedAt = timeline.generated_atSpecified ? timeline.generated_at : (DateTime?)null;
        }
Exemplo n.º 2
0
        internal MatchTimelineDTO(matchTimelineEndpoint timeline)
        {
            Contract.Requires(timeline != null);
            Contract.Requires(timeline.sport_event != null);

            SportEvent = RestMapperHelper.MapSportEvent(timeline.sport_event);

            if (timeline.coverage_info != null)
            {
                CoverageInfo = new CoverageInfoDTO(timeline.coverage_info);
            }

            if (timeline.sport_event_conditions != null)
            {
                SportEventConditions = new SportEventConditionsDTO(timeline.sport_event_conditions);
            }

            if (timeline.sport_event_status != null)
            {
                SportEventStatus = new SportEventStatusDTO(timeline.sport_event_status, null,
                                                           RestMapperHelper.FillHomeAwayCompetitors(timeline.sport_event.competitors));
            }

            if (timeline.timeline != null && timeline.timeline.Length > 0)
            {
                BasicEvents = timeline.timeline.Select(s => new BasicEventDTO(s));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MatchTimelineMapper"/> class
        /// </summary>
        /// <param name="data">>A <see cref="matchTimelineEndpoint"/> instance containing match timeline info</param>
        internal MatchTimelineMapper(matchTimelineEndpoint data)
        {
            Guard.Argument(data, nameof(data)).NotNull();

            _data = data;
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="MatchTimelineMapper" /> class
        /// </summary>
        /// <param name="data">>A <see cref="matchTimelineEndpoint" /> instance containing match timeline info</param>
        internal MatchTimelineMapper(matchTimelineEndpoint data)
        {
            Contract.Requires(data != null);

            _data = data;
        }