Created
February 5, 2015 08:55
-
-
Save nslindtner/8781adb2979eeb3ae29c to your computer and use it in GitHub Desktop.
Post etoro info from rails app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@etoro = Etoro.new(params[:etoro]) | |
respond_to do |format| | |
if @etoro.save | |
uri = URI.parse("https://secure.steamads.com/track/investimonials") | |
response = Net::HTTP.post_form(uri, {"ip" => "#{request.remote_ip}", "split" => @etoro.split, "value" => @etoro.value, "customer_id" => @etoro.customer_id}) | |
@resp =response | |
format.html { redirect_to @etoro, notice: 'Etoro was successfully created.' } | |
format.json { render json: @etoro, status: :created, location: @etoro } | |
else | |
format.html { render action: "new" } | |
format.json { render json: @etoro.errors, status: :unprocessable_entity } | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SteamPowered::Application.routes.draw do | |
resources :etoros | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create_table "etoros", :force => true do |t| | |
t.integer "split" | |
t.integer "value" | |
t.string "customer_id" | |
t.datetime "created_at", :null => false | |
t.datetime "updated_at", :null => false | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment