/
FoursquareService.groovy
44 lines (35 loc) · 1.09 KB
/
FoursquareService.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package org.grails.plugin.foursquare
import org.codehaus.groovy.grails.commons.ConfigurationHolder
class FoursquareService {
static transactional = false
@Delegate UserService userService
@Delegate VenueService venueService
@Delegate CheckinsService checkinsService
String getResponseFromFourSquare(String urlPath) {
String responseData
try {
URL url = new URL(urlPath)
responseData = url.text
} catch (Exception e) {
e.printStackTrace()
}
return responseData
}
String getResponseOfFoursquareQuery(String urlString) {
println("****** Querying URL: ${urlString}")
String responseString = ''
try {
URL page = new URL(urlString);
responseString = page.text
} catch (Exception e) {
e.printStackTrace()
}
return responseString
}
public getClientSecret() {
return ConfigurationHolder.config.fourSquare.secret
}
public getClientId() {
return ConfigurationHolder.config.fourSquare.clientId
}
}