Sha256: db1c47b9ea0fa713a0a7f08d72e0d832d368db5ae63292326104058b4dc63aa0
Contents?: true
Size: 851 Bytes
Versions: 3
Compression:
Stored size: 851 Bytes
Contents
module MagLoft class TypeloftImage < RemoteResource endpoint "api/maglove/v1/typeloft_images" remote_attribute :title, :user_id, :typeloft_folder_id, :typeloft_theme_id, :remote_file, :md5 attr_accessor :policy, :content_type def upload(file_path) return false if policy.nil? conn = Faraday.new(url: policy["url"]) do |f| f.ssl.verify = false f.headers = policy["headers"] f.adapter :net_http end response = conn.put(nil, File.read(file_path)) return (response.status == 200) end def queue_upload(file_path, &block) return false if policy.nil? request = Typhoeus::Request.new(policy["url"], method: :put, headers: policy["headers"], body: File.read(file_path), timeout: 200000) request.on_complete(&block) if block request end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
maglove-1.0.7 | lib/magloft/typeloft_image.rb |
maglove-1.0.5 | lib/magloft/typeloft_image.rb |
maglove-1.0.4 | lib/magloft/typeloft_image.rb |