Class: CDN::Swiftwill
- Inherits:
-
Object
- Object
- CDN::Swiftwill
- Defined in:
- lib/cdn/providers/swiftwill.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.generate_token(path, options = {}) ⇒ Object
3 4 5 |
# File 'lib/cdn/providers/swiftwill.rb', line 3 def self.generate_token(path, = {}) self.new.generate_token(path, ) end |
.generate_url(options = {}) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/cdn/providers/swiftwill.rb', line 7 def self.generate_url( = {}) (([:protocol] == :https) ? URI::HTTPS : URI::HTTP).build( host: [:domain], path: [:path], query: [:token]) end |
Instance Method Details
#generate_token(path, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/cdn/providers/swiftwill.rb', line 14 def generate_token(path, = {}) return '' if [:token] && [:token][:cdn_type].to_s == 'small' start = [:start] || 0 = self.() hash_string = "#{path}?" + params_string() .delete(:clientip) params_string() + '&hash=0' + hash_string(hash_string, CDN.configuration.http_large_secret) + "&start=#{start}" end |