conversation.bigbinary.com
Return 404 when record is not found · Conversation With API Builders — BigBinary eBook
http://conversation.bigbinary.com/chapter/return-404-when-user-is-not-found.html
BigBinary Conversation With API Builders. Return 404 when record is not found. When a record is not found then error message should be clear about what record is not found. And use status code 404 to indicate that record was not found. I am used to writing code like. Current user.cars.find params[:car id]. It raises an exception when record is not found. This is what I have right now. In the above code the issue is that if there is no car matching. Then above code would raise.
conversation.bigbinary.com
Return 422 when the input data is not valid · Conversation With API Builders — BigBinary eBook
http://conversation.bigbinary.com/return-422-when-input-data-is-not-valid.html
BigBinary Conversation With API Builders. Return 422 when the input data is not valid. 422 should be used when the data is syntactically correct but semantically incorrect. You sure love fancy words. Last time you talked about data being syntactically correct. And now you are talking about semantically incorrect. Why can’t you speak simple english. Ldquo;Semantically” simpley means business wise. So in other words the payload is “syntacticaly correct” but “semantically incorrect”.
conversation.bigbinary.com
Return 200 when it is all good · Conversation With API Builders — BigBinary eBook
http://conversation.bigbinary.com/return-200-when-it-is-all-good.html
BigBinary Conversation With API Builders. Return 200 when it is all good. Hey, I have a problem. I sent a request to the API to create a user. But I do not see the newly created user. The email address that you sent is already taken. Hmmmbut I got 200 as the response status code. Forget about the response code. You need to check the payload. I sent the error message as “error” key. If the system could not create the user then why did it return 200 as response status.
conversation.bigbinary.com
Do not use redirect in API · Conversation With API Builders — BigBinary eBook
http://conversation.bigbinary.com/do-not-use-redirect-in-api.html
BigBinary Conversation With API Builders. Do not use redirect in API. Do not do this def destroy . @user.destroy redirect to :back end. In the above case. Does not mean anything when you are dealing with API. The correct version would be. Def destroy . @car alert.destroy render head: :no content, status: :ok end.
conversation.bigbinary.com
Return 500 when an error is encountered · Conversation With API Builders — BigBinary eBook
http://conversation.bigbinary.com/return-500-when-erro-is-encountered.html
BigBinary Conversation With API Builders. Return 500 when an error is encountered. Hi there. Long time no see. Yes I was busy. The API code is in production now. I noticed. I got error message that something went wrong. Yes I’m working on it. If something goes wrong then you should send response code 500. It means that something unexpected happened. Like an exception was raised or database could not be connected.
conversation.bigbinary.com
Response should be valid JSON even when things go wrong · Conversation With API Builders — BigBinary eBook
http://conversation.bigbinary.com/return-valid-json-with-nice-error-message-even-when-things-go-wrong.html
BigBinary Conversation With API Builders. Response should be valid JSON even when things go wrong. AU : I sent invalid JSON payload and in return I did not get valid JSON response. My mobile application crashed because I was expecting response to be valid JSON. AB : Do you know how Rails parses JSON data. AB : The thing is that if the payload is invalid JSON then the request does not even hit the controller. AU : I see. AB : I have no idea how to do that. AU : Ok. Here is my attempt to build it. Config/a...
how-we-work.bigbinary.com
Radical candor | How we work at BigBinary
http://how-we-work.bigbinary.com/howwegetworkdone/radical-candor.html
We believe in Radical candor. That talk covers pretty much everything we need to say on this topic.
how-we-work.bigbinary.com
Be in Thought Zone | How we work at BigBinary
http://how-we-work.bigbinary.com/howwegetworkdone/thought-zone-intro.html
Be in Thought Zone. This book was written for BigBinary team members who are focused on getting work done. But the goal begs the question - what’s. The best place to do this? The obvious answer is ‘office’ - after all, isn’t it the. Place to get work done? Don’t people go there every single day, specifically for that purpose? Jason Fried decided to uncover the truth. He asked a bunch of people a bunch of questions - and found out something interesting and unexpected. Here’s the reality:. So how does one ...
how-we-work.bigbinary.com
Use prefix of underscore for memoization | How we work at BigBinary
http://how-we-work.bigbinary.com/coding/memoization.html
Use prefix of underscore for memoization. Let’s look at code. Class UsageReportCarrier attr reader :health agency def initialize health agency @health agency = health agency end def managers @managers = health agency.health agency users end end. In the above code method. However memoization like this makes code less confident since. Has a special meaning in ruby. When we see. We start thinkin where else it is being used. Is there an. Def managers @ managers = health agency.health agency users end.