create :: Object o => o -> Bluesnap (ObjectID o)
create obj = do
  payload <- fmap render . safeHead . requestToContents $ toRequest obj
  log $ "PAYLOAD: " ++ payload
  (headers, payload) <- Client.post (servicePath obj) payload
  oid <- getIDFromLocation headers
  return $ oidConstructor oid

-- | Updates the object in Bluesnap for the given object id and
-- returns unit if the update was successful otherwise throws a
-- bluesnap error
create :: Object o => o -> Bluesnap (ObjectID o)
create obj = do
  payload <- fmap render . safeHead . requestToContents $ toRequest obj
  log $ "PAYLOAD: " ++ payload
  (headers, payload) <- Client.post (servicePath obj) payload
  oid <- getIDFromLocation headers
  return $ oidConstructor oid

-- | Updates the object in Bluesnap for the given object id and
-- returns unit if the update was successful otherwise throws a
-- bluesnap error
create obj = do
  payload <- fmap render . safeHead . requestToContents $ toRequest obj
  log $ "PAYLOAD: " ++ payload
  (headers, payload) <- Client.post (servicePath obj) payload
  oid <- getIDFromLocation headers
  return $ oidConstructor oid

-- | Updates the object in Bluesnap for the given object id and
-- returns unit if the update was successful otherwise throws a
-- bluesnap error