Sha256: a91fb4a19395f3c9a5bf43cf26bd15707f56f465a08909945626fb49a36f97b9

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

module MagLoft
  class TypeloftTemplate < RemoteResource
    endpoint "api/maglove/v1/typeloft_templates"
    remote_attribute :identifier, :title, :contents, :public, :position, :typeloft_theme_id, :user_id, :created_at, :updated_at
    attr_accessor :thumbnail_policy

    def upload_thumbnail(file_path)
      return false if thumbnail_policy.nil?
      conn = Faraday.new(url: thumbnail_policy["url"]) do |f|
        f.ssl.verify = false
        f.headers = thumbnail_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_template.rb
maglove-1.0.2 lib/magloft/typeloft_template.rb