Skip to content

Commit

Permalink
re-added boolean conversion for json
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewmeyer committed Jun 23, 2017
1 parent edd792d commit a539ad1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# Returns all launches
get '/launches' do
content_type :json
results = DB.query("SELECT * FROM launch")
results = DB.query("SELECT * FROM launch", :cast_booleans => true)
hash = results.each do |row|
end
JSON.pretty_generate(hash)
Expand All @@ -71,7 +71,7 @@
get '/launches/upcoming' do
content_type :json
year = "upcoming"
statement = DB.prepare("SELECT * FROM launch WHERE launch_year = ?")
statement = DB.prepare("SELECT * FROM launch WHERE launch_year = ?", :cast_booleans => true)
results = statement.execute(year)
hash = results.each do |row|
end
Expand All @@ -87,7 +87,7 @@
get '/launches/year=:year' do
content_type :json
year = params['year']
statement = DB.prepare("SELECT * FROM launch WHERE launch_year = ?")
statement = DB.prepare("SELECT * FROM launch WHERE launch_year = ?", :cast_booleans => true)
results = statement.execute(year)
hash = results.each do |row|
end
Expand All @@ -103,7 +103,7 @@
get '/launches/core=:core' do
content_type :json
core = params['core']
statement = DB.prepare("SELECT * FROM launch WHERE core_serial = ?")
statement = DB.prepare("SELECT * FROM launch WHERE core_serial = ?", :cast_booleans => true)
results = statement.execute(core)
hash = results.each do |row|
end
Expand All @@ -119,7 +119,7 @@
get '/parts/cap=:cap' do
content_type :json
cap = params['cap']
statement = DB.prepare("SELECT * FROM capsule WHERE capsule_serial = ?")
statement = DB.prepare("SELECT * FROM capsule WHERE capsule_serial = ?", :cast_booleans => true)
results = statement.execute(cap)
hash = results.each do |row|
end
Expand All @@ -134,7 +134,7 @@
# Get all Dragon Capsule information
get '/parts/caps' do
content_type :json
results = DB.query("SELECT * FROM capsule")
results = DB.query("SELECT * FROM capsule", :cast_booleans => true)
hash = results.each do |row|
end
if hash.empty?
Expand All @@ -149,7 +149,7 @@
get '/launches/cap=:cap' do
content_type :json
cap = params['cap']
statement = DB.prepare("SELECT * FROM launch WHERE cap_serial = ?")
statement = DB.prepare("SELECT * FROM launch WHERE cap_serial = ?", :cast_booleans => true)
results = statement.execute(cap)
hash = results.each do |row|
end
Expand All @@ -164,7 +164,7 @@
# Get all Dragon core information
get '/parts/cores' do
content_type :json
results = DB.query("SELECT * FROM core")
results = DB.query("SELECT * FROM core", :cast_booleans => true)
hash = results.each do |row|
end
if hash.empty?
Expand All @@ -179,7 +179,7 @@
get '/parts/core=:core' do
content_type :json
core = params['core']
statement = DB.prepare("SELECT * FROM core WHERE core_serial = ?")
statement = DB.prepare("SELECT * FROM core WHERE core_serial = ?", :cast_booleans => true)
results = statement.execute(core)
hash = results.each do |row|
end
Expand All @@ -196,7 +196,7 @@
content_type :json
start = params['start']
final = params['final']
statement = DB.prepare("SELECT * FROM launch WHERE launch_date BETWEEN ? AND ?;")
statement = DB.prepare("SELECT * FROM launch WHERE launch_date BETWEEN ? AND ?;", :cast_booleans => true)
results = statement.execute(start, final)
hash = results.each do |row|
end
Expand Down

0 comments on commit a539ad1

Please sign in to comment.