Sha256: dd004a956c8820b8a0ab2975a27a47ab7e631dcf4f9c8cc07b6dd05d8c38e5d0

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
maglove-1.0.3 lib/magloft/typeloft_image.rb
maglove-1.0.2 lib/magloft/typeloft_image.rb