url2png-dc 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +97 -0
  3. data/VERSION +1 -1
  4. data/url2png-dc.gemspec +6 -1
  5. metadata +6 -3
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Yung Hwa Kwon
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,97 @@
1
+ #Url2Png-dc
2
+
3
+ ---
4
+
5
+ Url2Png-dc is a gem rewritten for the new /v6/ api version of the popular screenshot service [URL2PNG](http://url2png.com).
6
+
7
+ Includes URL Helpers for:
8
+
9
+ * Basic (default) image retrieval `beta.url2png.com/.../png/?...`
10
+ * Retrieving the new JSON playload `beta.url2png.com/.../json/?...`
11
+ * And a special method to retrieve the "Cache" URL*
12
+
13
+ \* Outlook was not rendering screenshots using the standard API call for image retrieval.
14
+
15
+
16
+ ##Install
17
+
18
+ gem install url2png-dc
19
+
20
+ Or add to Gemfile
21
+
22
+ gem 'url2png-dc', :require => 'url2png_dc'
23
+
24
+ You may always require later, as you see fit.
25
+
26
+
27
+ ##Configure
28
+
29
+ Maybe in an initalizer file or something.
30
+
31
+ Url2PngDc.configure do |config|
32
+ config.url2png_apikey = ENV['URL2PNG_APIKEY']
33
+ config.url2png_secret = ENV['URL2PNG_SECRET']
34
+ # config.viewport_dimensions = '1280x1024'
35
+ # config.fullpage = true
36
+ # config.force_refresh = true
37
+ end
38
+
39
+ *Currently this gem only supports the /v6/ API. You can take a look at [https://github.com/robinhoudmeyers/url2png-gem](https://github.com/robinhoudmeyers/url2png-gem) if you need support for the older API versions (Also includes HTML tag creation and support for v6).*
40
+
41
+
42
+ ##Usage
43
+
44
+ *__Currently all the helpers are just URL generators. HTML tag building is not included.__*
45
+
46
+ You will have to `require` (maybe, depending on how you set this up) and `include Url2PngDc::UrlHelpers`. That will give you access to 3 methods.
47
+
48
+
49
+ Generate the basic URL2PNG url
50
+
51
+ url_2png "http://twitter.com"
52
+
53
+ Generate the JSON playload url
54
+
55
+ url_2json "http://twitter.com"
56
+
57
+ Generate and `get` the cache url
58
+
59
+ url_2cache "http://twitter.com"
60
+
61
+ `url_2cache` will make a request out to the JSON payload url and parse the `png` key in order to get the cached url. So this could take a moment, if you are doing things in real-time.
62
+
63
+ The cache url (to my knowledge) is removed on a 30 day basis.
64
+
65
+ If anytime the request or the parsing of the payload fails, it defers to the `url_2png` method and returns the basic API url instead.
66
+
67
+
68
+ *\*Standard Rails hooks, so you can just plug and play, will be added shortly. But, if you want to get a jump on things, you can view the `quick_start` branch, that does a basic include into the view helpers. __At this point, I've only tested this on Rails 3.__ But there will be a larger range of support once the Rails hooks are written.*
69
+
70
+
71
+ ##Fork it!
72
+
73
+ After you've done that just run `rake` for the tests or
74
+
75
+ rake test
76
+
77
+ I have an actually "live" test that will make an actual call out to URL2PNG. *You will need to add your credentials in order to get a screenshot.*
78
+
79
+ export URL2PNG_APIKEY = 'PXXXXX'
80
+ export URL2PNG_SECRET = 'SXXXXX'
81
+
82
+ Some where Ruby can find it.
83
+
84
+ Then you can run it with
85
+
86
+ rake test:rl
87
+
88
+
89
+
90
+ ## Copyright
91
+
92
+ Copyright (c) 2012 Yung Hwa Kwon. See [MIT-LICENSE](blob/master/MIT-LICENSE) for details.
93
+
94
+
95
+ ---
96
+
97
+ __PS__ If my spelling and/or grammar is incorrect anywhere, I'm sorry. =)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/url2png-dc.gemspec CHANGED
@@ -5,17 +5,22 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "url2png-dc"
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yung Hwa Kwon"]
12
12
  s.date = "2012-09-01"
13
13
  s.description = "Gem to use Url2Png"
14
14
  s.email = "yung.kwon@damncarousel.com"
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
15
18
  s.files = [
16
19
  ".rvmrc",
17
20
  "Gemfile",
18
21
  "Gemfile.lock",
22
+ "MIT-LICENSE",
23
+ "README.md",
19
24
  "Rakefile",
20
25
  "VERSION",
21
26
  "lib/url2png/cache.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url2png-dc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -79,11 +79,14 @@ description: Gem to use Url2Png
79
79
  email: yung.kwon@damncarousel.com
80
80
  executables: []
81
81
  extensions: []
82
- extra_rdoc_files: []
82
+ extra_rdoc_files:
83
+ - README.md
83
84
  files:
84
85
  - .rvmrc
85
86
  - Gemfile
86
87
  - Gemfile.lock
88
+ - MIT-LICENSE
89
+ - README.md
87
90
  - Rakefile
88
91
  - VERSION
89
92
  - lib/url2png/cache.rb
@@ -112,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
115
  version: '0'
113
116
  segments:
114
117
  - 0
115
- hash: 2977091029262403901
118
+ hash: -2426482288326668947
116
119
  required_rubygems_version: !ruby/object:Gem::Requirement
117
120
  none: false
118
121
  requirements: