Sha256: 90be6d17580b65f5355dcccb417b48ba275a1ccaceb16436f7a6ecdf6f87cca7

Contents?: true

Size: 558 Bytes

Versions: 6

Compression:

Stored size: 558 Bytes

Contents

module Hexlet
  class TeacherClient < BaseClient
    def submit(slug, locale, file)
      url = @router.api_teacher_lessons_url
      @logger.debug url

      fd = ENV["TEST"] ? "a" : File.new(file, "rb") # FIXME

      attrs = {
        lesson: {
          slug: slug,
          locale: locale,
          "packs_attributes[]" => [
            {tarball: fd}
          ]
        }
      }

      RestClient.post url, attrs, headers do |response, request, result, &block|
        @logger.debug response
        201 == response.code
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hexlet-0.2.2 lib/hexlet/teacher_client.rb
hexlet-0.2.1 lib/hexlet/teacher_client.rb
hexlet-0.2.0 lib/hexlet/teacher_client.rb
hexlet-0.1.1 lib/hexlet/teacher_client.rb
hexlet-0.1.0 lib/hexlet/teacher_client.rb
hexlet-0.0.1 lib/hexlet/teacher_client.rb