Groovy Documentation

org.eriwen.rtm
[Groovy] Class GroovyRtmUtils

java.lang.Object
  org.eriwen.rtm.GroovyRtmUtils

class GroovyRtmUtils

Utilities that are common to API elements without being tied to a specific RTM API method.

Authors:
Eric Wendelin


Property Summary
int dayInMillis

int weekInMillis

 
Constructor Summary
GroovyRtmUtils()

 
Method Summary
java.lang.String formatFriendlyDate(java.lang.String dateStr, boolean hasDueTime, java.lang.Integer timezoneOffset = 0)

Given a date in the form YYYY-MM-DDTHH:MM:SSZ, return a friendly date like "Tuesday" or "Mar 9" or "11:00AM"

java.lang.String formatFriendlyRepeat(java.lang.String repeatStr)

Given a String representing the RTM repeat, return a friendly repeat String value

java.lang.String getApiSignature(java.util.List params, java.lang.String secret)

Given a List of parameters, returns the RTM API signature

long getCurrentDayMillisAtMidnight(long timezoneOffset)

java.lang.String getErrorMessage(java.lang.String responseText)

Gets the error message from the RTM response

java.lang.String getResponseText(java.lang.String urlstr)

Given a URL, gets the response text or null if a server error occurred

groovy.util.slurpersupport.GPathResult getRtmResponse(java.lang.String urlstr)

Given a URL, gets the response text or throws an error if any problem, including an error code response from RTM occurs

boolean isError(java.lang.String responseText)

Checks if RTM returned error-flagged XML

boolean isOverdue(java.lang.String dateStr, int timezoneOffset)

Given a date string, return if the date is overdue

java.lang.String trimString(java.lang.String string, int length)

Trim the string if length is greater than specified length

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Property Detail

dayInMillis

int dayInMillis


weekInMillis

int weekInMillis


 
Constructor Detail

GroovyRtmUtils

GroovyRtmUtils()


 
Method Detail

formatFriendlyDate

java.lang.String formatFriendlyDate(java.lang.String dateStr, boolean hasDueTime, java.lang.Integer timezoneOffset = 0)
Given a date in the form YYYY-MM-DDTHH:MM:SSZ, return a friendly date like "Tuesday" or "Mar 9" or "11:00AM"
Parameters:
dateStr - the date to parse as a String
Returns:
Friendly date like "Tuesday" or "Mar 9" or "11:00AM"


formatFriendlyRepeat

java.lang.String formatFriendlyRepeat(java.lang.String repeatStr)
Given a String representing the RTM repeat, return a friendly repeat String value
Parameters:
the - repeat string to format
Returns:
formatted repeat string like "every 3 blahs"


getApiSignature

java.lang.String getApiSignature(java.util.List params, java.lang.String secret)
Given a List of parameters, returns the RTM API signature
Parameters:
params - List of URL query parameters
secret - the shared secret provided with an RTM API key
Returns:
String API Signature


getCurrentDayMillisAtMidnight

long getCurrentDayMillisAtMidnight(long timezoneOffset)


getErrorMessage

java.lang.String getErrorMessage(java.lang.String responseText)
Gets the error message from the RTM response
Parameters:
result - RTM REST API response XML
Returns:
String message


getResponseText

java.lang.String getResponseText(java.lang.String urlstr)
Given a URL, gets the response text or null if a server error occurred
throws:
GroovyRtmException when the HTTP request failed
Parameters:
urlstr - String representation of the URL to use for the call to the RTM REST API
Returns:
String XML result from the RTM call


getRtmResponse

groovy.util.slurpersupport.GPathResult getRtmResponse(java.lang.String urlstr)
Given a URL, gets the response text or throws an error if any problem, including an error code response from RTM occurs
throws:
GroovyRtmException when RTM sends an error code
Parameters:
urlstr - String representation of the URL to use for the call to the RTM REST API
Returns:
GPathResult XML result from the RTM call


isError

boolean isError(java.lang.String responseText)
Checks if RTM returned error-flagged XML
Parameters:
result - RTM REST API response XML
Returns:
True if REST response indicates an error


isOverdue

boolean isOverdue(java.lang.String dateStr, int timezoneOffset)
Given a date string, return if the date is overdue
Parameters:
dateStr - the date to check
Returns:
True if the date is overdue (past today ignoring time)


trimString

java.lang.String trimString(java.lang.String string, int length)
Trim the string if length is greater than specified length
Parameters:
string - The string to truncate
length - The preferred length of the returned String


 

Groovy Documentation