thumbalizr-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README +40 -0
- data/lib/thumbalizr-rails.rb +1 -0
- data/lib/thumbalizr-rails/config.rb +40 -0
- data/lib/thumbalizr-rails/public.rb +30 -0
- data/lib/thumbalizr-rails/railtie.rb +4 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8f822bdd41639f9c1e61b26cfe31f34fd28ab729b8f3b3ce6902dfc3e29a3296
|
4
|
+
data.tar.gz: 6a5b3b0304844bd4fbb5bddf9c0d6ccade0006b8dbf9ec8162b0e4369526c34b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e0271b51d64891433e6838a88ab1ac12f6bc010dca6bea7fea38e673986616468b43b0feb919980287d68f85cdf295a3eaa2a12059e0e8ff201d5523b2acd085
|
7
|
+
data.tar.gz: 7552890868f83714d3a9008bd90f099b52a4d231366d192e0a1666cad1e1879ac6b465e856ce459d00c681f5e3247b10949ecb4c7b4a6f1f506561aa29ac6cc3
|
data/Gemfile
ADDED
data/README
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
Thumbalizr-Rails version 1.0
|
2
|
+
================================
|
3
|
+
|
4
|
+
Thumbalizr (https://thumbalizr.com/) is a web service to easily embed live screenshots of any URL in your website. Thumbalizr has full support for Flash, JavaScript, CSS, & HTML5.
|
5
|
+
|
6
|
+
You can install the library from rubygem: https://rubygems.org/gems/thumbalizr-rails
|
7
|
+
|
8
|
+
The source code can be found on github at https://github.com/juliensobrier/thumbalizr-rails
|
9
|
+
|
10
|
+
This gem is based on the Tumbalir library for Ruby: https://github.com/juliensobrier/thumbalizr-ruby
|
11
|
+
|
12
|
+
|
13
|
+
== Build and install thumbalizr-rails
|
14
|
+
|
15
|
+
git clone https://github.com/juliensobrier/thumbalizr-rails
|
16
|
+
gem build thumbalizr-rails.gemspec
|
17
|
+
gem install --dev thumbalizr-rails-<version>.gem
|
18
|
+
rake test
|
19
|
+
rake rdoc
|
20
|
+
|
21
|
+
Or
|
22
|
+
|
23
|
+
gem install thumbalizr-rails
|
24
|
+
|
25
|
+
== Use with Rails
|
26
|
+
|
27
|
+
This gems makes the custom tag thumbalizr_url available in your templates.
|
28
|
+
|
29
|
+
First configure your Rails project:
|
30
|
+
|
31
|
+
# Gemfile
|
32
|
+
gem 'thumbalizr-rails'
|
33
|
+
|
34
|
+
|
35
|
+
# Create config/initializers/thumbalizr.rb
|
36
|
+
ThumbalizrClient.config("MY_KEY", "MY_SECRET")
|
37
|
+
|
38
|
+
|
39
|
+
# In your templates, use <%= thumbalizr_url %> to generate the URL of a thumbnail:
|
40
|
+
<img src="<%= thumbalizr_url('https://www.google.com/', {:country => 'us', :width => 400}) %>">
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'thumbalizr-rails/railtie'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ThumbalizrClient
|
2
|
+
extend self
|
3
|
+
|
4
|
+
# @!attribute [r]
|
5
|
+
# Embed API key
|
6
|
+
attr_reader :key
|
7
|
+
# @!attribute [r]
|
8
|
+
# Thumbalizr secret
|
9
|
+
attr_reader :secret
|
10
|
+
# @!attribute [r]
|
11
|
+
# Base URL for all API requests. You should use the default base provided by the library. Be careful if you decide to use HTTP instead of HTTPS as your API key could be sniffed and your account could be used without your consent.
|
12
|
+
|
13
|
+
# Configure the Thumbanlizr client
|
14
|
+
#
|
15
|
+
# @param key [String] Embed API key
|
16
|
+
# @param secret [String] Thumbalizr secret
|
17
|
+
def config(api_key, secret)
|
18
|
+
# mandatory
|
19
|
+
self.api_key = api_key
|
20
|
+
self.secret = secret
|
21
|
+
end
|
22
|
+
|
23
|
+
def api_key=api_key
|
24
|
+
@api_key = api_key
|
25
|
+
end
|
26
|
+
|
27
|
+
def api_key
|
28
|
+
raise 'ThumbalizrClient: API key missing. Don\'t forget to call ThumbalizrClient.config' if @api_key.nil?
|
29
|
+
@api_key
|
30
|
+
end
|
31
|
+
|
32
|
+
def secret=secret
|
33
|
+
@secret = secret
|
34
|
+
end
|
35
|
+
|
36
|
+
def secret
|
37
|
+
raise 'ThumbalizrClient: Asecret missing. Don\'t forget to call ThumbalizrClient.config' if @secret.nil?
|
38
|
+
@secret
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Thumbalizr library for Rails websites.
|
2
|
+
# The library requires an API key and secret from Thumbalizr.
|
3
|
+
# Sign up for a free account a http://thumbalizr.com/
|
4
|
+
#
|
5
|
+
# See README for more information abouth Thumbalizr
|
6
|
+
# and this library.
|
7
|
+
#
|
8
|
+
# @author Julien Sobrier (mailto:jsobrier@browshot.com)
|
9
|
+
# Copyright: Copyright (c) 2019 Browshot
|
10
|
+
# License: Distributes under the same terms as Ruby
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require 'thumbalizr'
|
14
|
+
|
15
|
+
module ThumbalizrClient
|
16
|
+
module Public
|
17
|
+
extend self
|
18
|
+
|
19
|
+
# Return the Thumbalizr URL for the screenshot requested
|
20
|
+
#
|
21
|
+
# @param url [String] URL of the web page
|
22
|
+
# @param parameters [Array<Symbol, Symbol>] Additional options
|
23
|
+
# See http://tumbalizr.com/api/documentation for the full list of possible options
|
24
|
+
# @return url [String] Thumbalizr URL fo the thumbnail
|
25
|
+
def thumbalizr_url(url, options={})
|
26
|
+
thumbalizr = Thumbalizr.new(ThumbalizrClient.api_key, ThumbalizrClient.secret)
|
27
|
+
return thumbalizr.url(url, options)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thumbalizr-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julien Sobrier
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thumbalizr
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Generate screenshot of any page.
|
28
|
+
email: jsobrier@thumbalizr.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- Gemfile
|
34
|
+
- README
|
35
|
+
- lib/thumbalizr-rails.rb
|
36
|
+
- lib/thumbalizr-rails/config.rb
|
37
|
+
- lib/thumbalizr-rails/public.rb
|
38
|
+
- lib/thumbalizr-rails/railtie.rb
|
39
|
+
homepage: https://thumbalizr.com/
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubygems_version: 3.0.6
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: Client for https://thumbalizr.com/
|
62
|
+
test_files: []
|