Sha256: 814059261e0359c63861a6782a6924c9299af3bfdf01185092760fd6b6ea49bd
Contents?: true
Size: 750 Bytes
Versions: 2
Compression:
Stored size: 750 Bytes
Contents
class Boilercode::FileClient < Boilercode::Client attr_reader :file_path, :content_type, :file, :token, :config def initialize(file_path = nil, options = {}) @file_path = file_path @file = file_contents @config = Boilercode::Config.new @options = options end def upload HTTParty.post("#{Boilercode::Client.base_uri}/uploads", method: :post, headers: file_headers, body: { upload: { file: file_contents, folder_path: @options[:folder_path] } }) end def file_headers { "Content-Type": "multipart/form-data", Authorization: "Bearer #{config.creds[:token]}" } end def file_contents File.open(file_path, "r") if file_path end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
boilercode-0.1.2 | lib/boilercode/file_client.rb |
boilercode-0.1.0 | lib/boilercode/file_client.rb |