Exemple #1
0
 internal Expense(ParsedJson json)
 {
     Id           = json.GetInt("id");
     PrimaryGroup = new Group(json.GetObject("group"));
     Name         = json.GetString("name");
     Notes        = json.GetString("notes");
     Price        = json.GetDecimal("price");
     Quantity     = json.GetInt("quantity");
     Archived     = json.GetBool("archived");
     CreatedAt    = json.GetDateTime("created_at", false).Value;
     UpdatedAt    = json.GetDateTime("updated_at", false).Value;
     Creator      = new User(json.GetObject("creator"));
     Participants = json.GetArray("participants").ConvertAll(e => new User(e));
 }
Exemple #2
0
        internal User(ParsedJson info)
        {
            Id = info.GetInt("id");

            // FIXED: when registering, the response contains a group_id instead of a group
            if (info.Members.ContainsKey("group_id"))
            {
                PrimaryGroup = Group.Query(info.GetInt("group_id"));
            }
            else
            {
                PrimaryGroup = new Group(info.GetObject("group"));
            }

            Email     = info.GetString("email");
            FirstName = info.GetString("first_name");
            LastName  = info.GetString("last_name");
            CreatedAt = info.GetDateTime("created_at", false).Value;
            UpdatedAt = info.GetDateTime("updated_at", true);
            Admin     = info.GetBool("admin");
        }
Exemple #3
0
        internal Event(ParsedJson json)
        {
            Id           = json.GetInt("id");
            PrimaryGroup = new Group(json.GetObject("group"));
            Description  = json.GetString("description");
            Title        = json.GetString("title");
            StartsAt     = json.GetDateTime("starts_at", true);
            FinishesAt   = json.GetDateTime("finishes_at", true);
            CreatedAt    = json.GetDateTime("created_at", false).Value;
            UpdatedAt    = json.GetDateTime("updated_at", false).Value;
            Creator      = new User(json.GetObject("creator"));
            Kind         = json.GetEnum <EventKind>("kind");
            Status       = json.GetEnum <EventStatus>("status");
            Locked       = json.GetBool("locked");
            Participants = json.GetArray("participants").ConvertAll(e => new User(e));
            Votes        = new Dictionary <int, EventVote>();

            foreach (var vote in json.GetArray("votes"))
            {
                Votes[vote.GetInt("id")] = new EventVote(vote);
            }
        }
Exemple #4
0
 internal EventVote(ParsedJson json)
 {
     Finished  = json.GetBool("finished");
     CreatedAt = json.GetDateTime("created_at", false).Value;
     UpdatedAt = json.GetDateTime("updated_at", false).Value;
 }