tmc-client 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'highline/import'
3
- require 'pry'
4
3
  require 'json'
5
4
  require 'faraday'
6
5
  require 'yaml'
@@ -333,7 +332,14 @@ class Client
333
332
  payload[:request_review] = true if args.include? "--request-review" or args.include? "-r" or args.include? "--review"
334
333
  payload[:paste] = true if args.include? "--paste" or args.include? "-p" or args.include? "--public"
335
334
  payload[:submission][:file] = Faraday::UploadIO.new('tmp_submit.zip', 'application/zip')
336
- response = @conn.post "/exercises/#{exercise['id']}/submissions.json?api_version=5&client=netbeans_plugin&client_version=1", payload
335
+ tmp_conn = Faraday.new(:url => exercise['return_url']) do |faraday|
336
+ faraday.request :multipart
337
+ faraday.request :url_encoded # form-encode POST params
338
+ faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
339
+ end
340
+ tmp_conn.headers[Faraday::Request::Authorization::KEY] = @config.auth
341
+
342
+ response = tmp_conn.post "?api_version=5&client=netbeans_plugin&client_version=1", payload
337
343
  submission_url = JSON.parse(response.body)['submission_url']
338
344
  puts "Submission url: #{submission_url}"
339
345
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'tmc-client'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = 'TestMyCode Commandline client'
6
6
  s.authors = ['Jarmo Isotalo', 'Tony Kovanen']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmc-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: