Best way to pass parameters?

2014-05-19 Thread Ivan Schuetz
Hi, I'm building a webservice, have 2 layers: webservice and database. Webservice layer receives e.g. a product, to add to the database: {:id 1 :name phone :price 100} Database layer has a method to insert the product, insert-product. I could do 1): (defn insert-product [params]) or 2):

Re: Best method for REST api authentication?

2014-05-15 Thread Ivan Schuetz
-with-clojure-part-5/ woks well so far! Am Dienstag, 13. Mai 2014 14:18:32 UTC+2 schrieb Ivan Schuetz: Hi, I'm new to Clojure and have little experience with api development. I'm looking for a way to implement REST api authentication. As far I understand, the best way to do

Best method for REST api authentication?

2014-05-13 Thread Ivan Schuetz
Hi, I'm new to Clojure and have little experience with api development. I'm looking for a way to implement REST api authentication. As far I understand, the best way to do this is using an authentication token. The goal is use this for mobile apps. I would prefer to avoid sending the login

Re: JSON authentication with cemerick/friend?

2014-05-13 Thread Ivan Schuetz
Erik Bakstad: You can also pass inn options to wrap-json-body so you don't have to use keywordize-keys: (def app (wrap-json-body handler {:keywords? true :bigdecimals? true})) kl. 12:04:10 UTC+2 tirsdag 6. mai 2014 skrev Ivan Schuetz følgende: Thanks. I just found out that my

Re: How do I mock request with content-type in Ring?

2014-05-12 Thread Ivan Schuetz
11, 2014 3:18:56 AM UTC-5, Ivan Schuetz wrote: I tried (let [response (app (content-type (request :post /login {:username jane :password test}) application/json))] ) Take a look at the source. Params passed to ring-mock.request

How do I mock request with content-type in Ring?

2014-05-11 Thread Ivan Schuetz
Hi, I'm using e.g.this: (let [response (app (request :post /user-register {:par1 val :par2 val}))] ) This works, but now I have a service that is provided by external library and requires the type of the request to be explicitly set to application/json.

Re: JSON authentication with cemerick/friend?

2014-05-06 Thread Ivan Schuetz
have clarified this, sorry. Also, we're not using interactive-form so I haven't tested if the two workflows work together. It shouldn't be a problem to make them work together though. kl. 02:31:30 UTC+2 tirsdag 6. mai 2014 skrev Ivan Schuetz følgende: Sorry. I mean accepts the request map

Re: JSON authentication with cemerick/friend?

2014-05-05 Thread Ivan Schuetz
-login) ]}) ) ) But well, it works for now. Am Freitag, 25. April 2014 18:53:42 UTC+2 schrieb Ivan Schuetz: Also I couldn't find which library you're using for get-headers function... or is it a self made one? I found a get-headers in ring

Re: JSON authentication with cemerick/friend?

2014-05-05 Thread Ivan Schuetz
not having effect. Am Dienstag, 6. Mai 2014 01:18:54 UTC+2 schrieb Sam Ritchie: (middleware/wrap-json-params) slurps the body up completely - this is a mutation, so you won't be able to access the body again. Ivan Schuetz javascript: May 5, 2014 3:49 PM Concerning the workflow

Re: JSON authentication with cemerick/friend?

2014-05-05 Thread Ivan Schuetz
Sorry. I mean accepts the request map as an argument. This map doesn't contain the parameters. Am Dienstag, 6. Mai 2014 02:17:52 UTC+2 schrieb Ivan Schuetz: The snippet provided by Eric doesn't use the body... it returns a function that accepts params as argument, but they were not being

Re: Clojure Course on Coursera

2014-05-02 Thread Ivan Schuetz
Looks good, thanks! Am Freitag, 2. Mai 2014 01:49:11 UTC+2 schrieb Colin Fleming: There's this one here: http://mooc.cs.helsinki.fi/clojure, which is run by the University of Helsinki. I haven't done the course but I heard good things about it. On 2 May 2014 11:21, Ivan Schuetz ivans

Re: Clojure Course on Coursera

2014-05-01 Thread Ivan Schuetz
What happened with this? I would really love to make a Clojure course in Coursera... Still none :( Am Donnerstag, 20. September 2012 14:43:52 UTC+2 schrieb Belun: It would be really interesting to see a course about Clojure on coursera.org, where a Scala and functional programming course

Re: JSON authentication with cemerick/friend?

2014-04-25 Thread Ivan Schuetz
Donnerstag, 24. April 2014 08:51:29 UTC+2 schrieb Erik Bakstad: Here is an example from our ajax-login form. After reading Sam's excellent writeup it should be understandable. https://gist.github.com/ebaxt/11244031 kl. 00:28:45 UTC+2 torsdag 24. april 2014 skrev Ivan Schuetz følgende: Hi, I'm

Re: JSON authentication with cemerick/friend?

2014-04-25 Thread Ivan Schuetz
from our ajax-login form. After reading Sam's excellent writeup it should be understandable. https://gist.github.com/ebaxt/11244031 kl. 00:28:45 UTC+2 torsdag 24. april 2014 skrev Ivan Schuetz følgende: Hi, I'm trying to get a simple use case running - send a login request to /login

JSON authentication with cemerick/friend?

2014-04-23 Thread Ivan Schuetz
Hi, I'm trying to get a simple use case running - send a login request to /login and get success or fail response, preferably in JSON format. I followed the example in https://github.com/cemerick/friend#workflows (def users {root {:username root :password

JSON authentication with cemerick/friend?

2014-04-23 Thread Ivan Schuetz
Hi, I'm trying to get a simple use case running - send a login request to /login and get success or fail response, preferably in JSON format. I followed the example in https://github.com/cemerick/friend#workflows (def users {root {:username root :password

Re: How do I update a record in a vector, matching certain criteria?

2014-04-09 Thread Ivan Schuetz
', and then if you do want to change the data structure later, you only have to change the general function. --Leif On Tuesday, April 8, 2014 7:10:13 PM UTC-4, Ivan Schuetz wrote: As I said I already looked in the docs, and know these basic examples, but I don't know how to do: *How can I say

How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Ivan Schuetz
I'm trying to update records in a vector, which match certain criteria. Record: (defrecord Item [id name description]) How can I say e.g. set name of element to foo where id is equal 1? The vector is mutable (ref). I would do (dosync (commute myVectorRef )) Can't figure the I

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Ivan Schuetz
Hi, sorry I don't get it. I just started learning Clojure. I did this to remove element with id 1 (commute items #(remove (fn [x](= (:id x) id)) %)) From your statement I understand update-in would work for the update, but I don't know the syntax. Something like (commute

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Ivan Schuetz
Ahh dataprovider/products should be items. Forgot to simplify. Am Mittwoch, 9. April 2014 00:12:48 UTC+2 schrieb Ivan Schuetz: Hi, sorry I don't get it. I just started learning Clojure. I did this to remove element with id 1 (commute items #(remove (fn [x](= (:id x) id)) %)) From

Re: How do I update a record in a vector, matching certain criteria?

2014-04-08 Thread Ivan Schuetz
I would use merge to update the record with the map... but I don't know how to get it from filter operation. Maybe I should not solve this with 1-liner. Am Mittwoch, 9. April 2014 00:14:09 UTC+2 schrieb Ivan Schuetz: Ahh dataprovider/products should be items. Forgot to simplify. Am Mittwoch