0
votes

I am new to groovy. I have a code like this.

String flavor

HashMap config = new HashMap([ ttl: 0, url: url, appName: appName, enable: true ])
client.put("${data}.json", config)

From this client Map I need to iterate the values of appName and enable. For that I used get method... I am not sure about this.

def values = client.get("${data}.json");

while using this get method am getting following error. Since I am new to groovy i don't know what is happening here

groovy.lang.MissingMethodException: No signature of method: com.comcast.csv.haxor.SecureFirebaseRestClient.get() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [testJson.json]
Possible solutions: get(com.comcast.tvx.megahttp.utils.URL, java.lang.Class), get(java.lang.String, java.lang.Class), grep(), grep(java.lang.Object), getAt(java.lang.String), wait()

2
what is client and how you have initialized it ? - Rohit Raina

2 Answers

0
votes

not sure what you are trying to do, but (without knowing other details) I'd put your code that way:

Map config = [ ttl: 0, url: url, appName: appName, enable: true ]
client[ "${data}.json" ] = config
def values = client[ "${data}.json" ]

assuming, that you wanted to use getAt() (short-cut with [] ) method instead of get()

0
votes

Try this:

def config = [ ttl: 0, url: url, appName: appName, enable: true ]
def endpoint = "${data}.json" as String

client.put(endpoint, config)
def values = client.get(endpoint, HashMap)

def appName = values.appName
def enable = values.enable

I couldn't find any info on SecureFirebaseRestClient, so I'm guessing about how it works.