Sha256: d8cbe497f7bddb54467b6f7068ac2c6c242e43747b1b2483134a6890cc9d44c5
Contents?: true
Size: 508 Bytes
Versions: 1
Compression:
Stored size: 508 Bytes
Contents
require 'digest' require 'addressable/uri' module Imgix class Client def initialize(options = {}) @host = options[:host] @token = options[:token] @secure = options[:secure] end def sign_path(path) uri = Addressable::URI.parse(path) query = (uri.query || '') signature = Digest::MD5.hexdigest(@token + uri.path + '?' + query) "#{@secure ? 'https' : 'http'}://#{@host}#{uri.path}?#{query}#{query.length > 0 ? '&' : ''}s=#{signature}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
imgix-0.1.0 | lib/imgix/client.rb |