Friends, I can't understand what's going on, I'm new to programming.
#Create Employee
@manter_user = Crud.new (my class)
#Create
$response = @manter_user.create(my method)
puts "Response is: #{$response}"
puts "Create Response HTTP code 200: #{$response.code == 200}"
end
crete ok
Response is: {"status":"success","data":{"name":"Kip","salary":8037.4700000000002546585164964199066162109375,"age":63,"id":7435},"message":"Successfully! Record has been added."}
**Create Response HTTP code 200: true**
#list
@id = $response.parsed_response["data"]["id"]
puts "@id: #{@id} retornado é o mesmo préviamente criado..."
retrieve_response = @manter_user.retrieve(@id)
puts "Retrieve Response HTTP code 200: #{retrieve_response.code == 200}"
end
List
**Retrieve Response HTTP code 200: false**
As I mentioned in my previous Answer and the comments below.
The dummy API you are using does not actually store the records you are creating it just provides a dummy response.
These are fake online REST APIs for testing and prototyping sample applications that use rest calls to display listings and crud features. This rest api tutorials, faking a server, and sharing code examples can all be used.
Methods provided by the API:
{"status":"success","data":{"name":"Alva","salary":12,"age":33,"id":1488},"message":"Successfully! Record has been added."}
{"status"=>"success", "data"=>{"id"=>9, "employee_name"=>"Colleen Hurst", "employee_salary"=>205500, "employee_age"=>39, "profile_image"=>""}, "message"=>"Successfully! Record has been fetched."}
{"status"=>"success", "data"=>{"{\"name\":\"Cassia\",\"salary\":\"100000\",\"age\":\"24\"}"=>nil}, "message"=>"Successfully! Record has been updated."}
{"status"=>"success", "data"=>"78", "message"=>"Successfully! Record has been deleted"}
There is no way using this dummy API that you can actually test the full lifecycle of record due to the way it is constructed.
Additionally it appears this API is in the process of being torn down: