Example #1
0
// fetchCurrentReportingPeriod collects the current reporting period
func (tock *Tock) fetchReportingPeriod() string {
	var data ReportingPeriodAuditList
	URL := fmt.Sprintf(tock.TockURL)
	body := helpers.FetchData(URL)
	err := json.Unmarshal(body, &data)
	if err != nil {
		log.Print(err)
	}
	return fetchCurrentReportingPeriod(&data)
}
Example #2
0
// FetchTockUsers is a function for collecting all the users who have not
// filled out thier time sheet for the current period
func (tock *Tock) FetchTockUsers() *ReportingPeriodAuditDetails {
	var data ReportingPeriodAuditDetails
	timePeriod := tock.fetchReportingPeriod()
	URL := fmt.Sprintf("%s%s/", tock.TockURL, timePeriod)
	body := helpers.FetchData(URL)
	err := json.Unmarshal(body, &data)
	if err != nil {
		log.Print(err)
	}
	return &data
}
Example #3
0
// FetchData adds a token to the url before fetching data
func (slack *Slack) FetchData(URL string) []byte {
	return helpers.FetchData(slack.AddToken(URL))
}