Sha256: b4575d0ed7fa97823d04b47e17a0dda21e64a441cb4c110e369035b11b52052d
Contents?: true
Size: 655 Bytes
Versions: 1
Compression:
Stored size: 655 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}#{query.length > 0 ? '&' : ''}s=#{signature}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
imgix-0.2.0 | lib/imgix/client.rb |