def from_json(cls, json): id = JsonParser.try_get_parameter(json, "id") event_id = JsonParser.try_get_parameter(json, "event_id") person_id = JsonParser.try_get_parameter(json, "person_id") checkin = JsonParser.try_get_parameter(json, "checkin") return cls(id=id, event_id=event_id, person_id=person_id, checkin=checkin)
def from_json(cls, json): id = JsonParser.try_get_parameter(json, "id") nick = JsonParser.try_get_parameter(json, "nick") photo = JsonParser.try_get_parameter(json, "photo") email = JsonParser.try_get_parameter(json, "email") name = JsonParser.try_get_parameter(json, "name") return cls(id=id, nick=nick, photo=photo, email=email, name=name, events=list())
def test_try_get_parameter_when_doesnt_exists_should_return_none(): # arrage json = {"key": "value"} # act result = JsonParser.try_get_parameter(json, "key2") # assert assert result is None
def from_json(cls, json): id = JsonParser.try_get_parameter(json, "id") group_name = JsonParser.try_get_parameter_with_sub_name( json, "group", "name") name = JsonParser.try_get_parameter(json, "name") status = JsonParser.try_get_parameter(json, "status") local_date = JsonParser.try_get_parameter(json, "local_date") local_time = JsonParser.try_get_parameter(json, "local_time") link = JsonParser.try_get_parameter(json, "link") return cls(id=id, group_name=group_name, name=name, status=status, local_date=local_date, local_time=local_time, link=link, persons=list())
def from_json(cls, json): id = JsonParser.try_get_parameter_with_sub_name(json, "member", "id") nick = JsonParser.try_get_parameter_with_sub_name(json, "member", "name") photo = JsonParser.try_get_parameter_with_two_sub_name(json, "member", "photo", "highres_link") return cls(id=id, nick=nick, photo=photo, name=None)
def from_json(cls, json): event_id = JsonParser.try_get_parameter(json, "event_id") participant_id = JsonParser.try_get_parameter_with_sub_name(json, "participant_id") checkin = JsonParser.try_get_parameter(json, "checkin") return cls(event_id=event_id, participant_id=participant_id, checkin=checkin)