Sha256: 4860cebe7a8c3ed784e4fb8d0c96c86754d7784e4901c7d3c5234e6c8e2e1155
Contents?: true
Size: 626 Bytes
Versions: 1
Compression:
Stored size: 626 Bytes
Contents
require 'digest' require 'addressable/uri' module Imgix class Client def initialize(options = {}) @host = options[:host] @token = options[:token] @secure = options[:secure] || false end def path(path) Path.new(prefix, @token, path) end def prefix "#{@secure ? 'https' : 'http'}://#{@host}" 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}&s=#{signature}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
imgix-0.2.1 | lib/imgix/client.rb |