Skip to content

Instantly share code, notes, and snippets.

@DCarper
Created November 27, 2011 15:46
Show Gist options
  • Select an option

  • Save DCarper/1397718 to your computer and use it in GitHub Desktop.

Select an option

Save DCarper/1397718 to your computer and use it in GitHub Desktop.
class ApiController < ApplicationController
def integer_to_string
render :json => { :value => params[:value] }.to_json
end
def concat
sum = params[:a] + params[:b]
render :soap => { :value => sum }.to_json
end
def add_circle
render(:failure => "radius is too small") if params[:radius] < 3.0
x = params[:circle][:center][:x]
y = params[:circle][:center][:y]
radius = params[:circle][:radius]
Circle.new(x, y, radius)
render nil
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment