Created
July 26, 2011 14:30
-
-
Save axeda/1106895 to your computer and use it in GitHub Desktop.
Send a Tweet with Location script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import groovyx.net.http.RESTClient | |
| import static groovyx.net.http.ContentType.* | |
| import com.axeda.drm.sdk.geofence.Geofence | |
| twitter = new RESTClient('http://twitter.com/statuses/') | |
| twitter.auth.basic parameters.twitterUser, parameters.twitterPassword | |
| twitter.client.params.setBooleanParameter 'http.protocol.expect-continue', false | |
| def statusText = "'${parameters.twitterStatus}' for device: ${context.device.serialNumber} on ${new Date()}" | |
| resp = twitter.post(path: 'update.xml', | |
| requestContentType: URLENC, | |
| body: [status: statusText, lat: mobileLocation.lat, long: mobileLocation.lng]) | |
| logger.info resp.status | |
| logger.info "Posted update $statusText" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment