lib/impas-client.rb in impas-client-0.0.7 vs lib/impas-client.rb in impas-client-0.0.8

- old
+ new

@@ -60,16 +60,22 @@ desc = JSON.parse(res.body) desc["description"]["groups"] end - def add_url(grp_key, url) + def add_url(grp_key, url, user = nil) entry_point = "/api/registration/#{grp_key}" res = @@conn.post do |req| req.url entry_point req.headers['Content-Type'] = 'application/json' - req.body = "{\"url\":\"#{url}\"}" + + if user.nil? + req.body = "{\"url\":\"#{url}\"}" + else + req.body = "{\"url\":\"#{url}\", \"user\":\"#{user}\"}" + end + end if res.status == 200 desc = JSON.parse(res.body)