spider_monkey 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/spider_monkey.rb +9 -0
- data/lib/spider_monkey/config.rb +13 -0
- data/lib/spider_monkey/helper.rb +25 -0
- data/spider_monkey.gemspec +18 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6758680dfb7f72aa2a3f93962f0963e6ed0017d2
|
4
|
+
data.tar.gz: 9b461a1fafa9d73fb744e5d3534fc67ae1c199f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8307358d1a087fd456cfad7eb6d2c37f4d11276dfdea33259c0362e9769aad233c6b0360b5174529a72212241218e3458ab438889a376b7e79faf120803c004a
|
7
|
+
data.tar.gz: 1017dc846d161ad10030ea526c3e03a7b1acf09694f5313133840488ec4cd58a52f5e9164781754d2b9c19a8c974336790e042dbe6d87d6f3a021cdccf98578a
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module SpiderMonkey
|
2
|
+
module Helper
|
3
|
+
def resized_image_url(options)
|
4
|
+
options = options.reverse_merge(
|
5
|
+
key: SpiderMonkey.configuration[:user_key]
|
6
|
+
)
|
7
|
+
options_string = spider_monkey_string_from_options_hash(options)
|
8
|
+
signature = spider_monkey_signature_from_options_string(options_string)
|
9
|
+
|
10
|
+
compressed_string = Base64.urlsafe_encode64(Zlib::Deflate.deflate(options_string))
|
11
|
+
|
12
|
+
"#{SpiderMonkey.configuration[:protocol]}://#{SpiderMonkey.configuration[:cloudfront_host]}/u/#{options[:key]}/c?o=#{compressed_string}&s=#{signature}"
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def spider_monkey_string_from_options_hash(options)
|
17
|
+
json_string = options.to_json
|
18
|
+
end
|
19
|
+
|
20
|
+
def spider_monkey_signature_from_options_string(options_string)
|
21
|
+
secret = SpiderMonkey.configuration[:user_secret]
|
22
|
+
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), secret, options_string)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "spider_monkey"
|
3
|
+
s.version = "0.0.2"
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
|
6
|
+
s.authors = ["Ben McFadden"]
|
7
|
+
s.date = "2015-11-19"
|
8
|
+
s.description = "A gem to simplify generating image URLs for usespidermonkey.com"
|
9
|
+
s.email = "ben@forgeapps.com"
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
|
12
|
+
#s.homepage = "http://github.com/ForgeApps/anaconda"
|
13
|
+
s.licenses = ["MIT"]
|
14
|
+
s.require_paths = ["lib"]
|
15
|
+
s.rubygems_version = "2.0.3"
|
16
|
+
s.summary = "usespidermonkey.com integration"
|
17
|
+
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spider_monkey
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben McFadden
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A gem to simplify generating image URLs for usespidermonkey.com
|
14
|
+
email: ben@forgeapps.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/spider_monkey.rb
|
20
|
+
- lib/spider_monkey/config.rb
|
21
|
+
- lib/spider_monkey/helper.rb
|
22
|
+
- spider_monkey.gemspec
|
23
|
+
homepage:
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.4.5
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: usespidermonkey.com integration
|
47
|
+
test_files: []
|