Skip to content

Commit 6012ae0

Browse files
committed
Re-add commented out #push_external action
- was commented out for the lightning talks (Closes #17)
1 parent 0007ef5 commit 6012ae0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/controllers/exercises_controller.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ def exercises_all
8383
end
8484

8585
def push_external
86-
#account_link = AccountLink.find(params[:account_link][:id]);
87-
#oauth2Client = OAuth2::Client.new('client_id', 'client_secret', :site => account_link.push_url)
88-
#oauth2_token = account_link[:oauth2_token]
89-
#token = OAuth2::AccessToken.from_hash(oauth2Client, :access_token => oauth2_token)
90-
#token.post(account_link.push_url)
91-
#redirect_to @exercise, notice: ('Exercise pushed to ' + account_link.readable)
92-
redirect_to @exercise, notice: 'Exercise was successfully exported.'
86+
account_link = AccountLink.find(params[:account_link][:id]);
87+
oauth2Client = OAuth2::Client.new('client_id', 'client_secret', :site => account_link.push_url)
88+
oauth2_token = account_link[:oauth2_token]
89+
token = OAuth2::AccessToken.from_hash(oauth2Client, :access_token => oauth2_token)
90+
logger.fatal('@exercise.to_proforma_xml')
91+
logger.fatal(@exercise.to_proforma_xml)
92+
logger.fatal('@exercise.to_proforma_xml')
93+
token.post(account_link.push_url, {body: @exercise.to_proforma_xml})
94+
redirect_to @exercise, notice: ('Exercise pushed to ' + account_link.readable)
9395
end
9496

9597
private

0 commit comments

Comments
 (0)