grimen-page_glimpse 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. data/lib/page_glimse.rb +10 -5
  2. metadata +1 -1
@@ -40,8 +40,8 @@ class PageGlimse
40
40
  @devkey = devkey
41
41
  end
42
42
 
43
- # Get single thumbnail.
44
- def thumbnail(url, options = {})
43
+ # Get thumbnail URL for linking.
44
+ def thumbnail_url(url, options = {})
45
45
  options = defaults.merge(options)
46
46
  @url = url
47
47
  @size = valid_size_value(options[:size])
@@ -49,13 +49,17 @@ class PageGlimse
49
49
  @nothumb = options[:nothumb]
50
50
 
51
51
  query_url = generate_url('thumbnails')
52
- response = self.class.get(query_url)
52
+ end
53
+
54
+ # Get single thumbnail image (PNG).
55
+ def thumbnail(url, options = {})
56
+ response = self.class.get(thumbnail_url)
53
57
  handle_response(response)
54
58
  response.body
55
59
  end
56
60
  alias :thumbnails :thumbnail
57
61
 
58
- # Export single thumbnail into a file.
62
+ # Export single thumbnail into a image file (PNG).
59
63
  def save!(url, path, options = {})
60
64
  begin
61
65
  data = thumbnail(url, options)
@@ -125,7 +129,8 @@ class PageGlimse
125
129
  params << "root=#{@root}" if ACTION_PARAMS[action].include?(:thumbnail)
126
130
  params << "nothumb=#{@nothumb}" if ACTION_PARAMS[action].include?(:nothumb) && @nothumb && !@nothumb.empty?
127
131
  params << "devkey=#{@devkey}" if ACTION_PARAMS[action].include?(:devkey)
128
- "/#{action}?#{params.join('&')}"
132
+ query_url = "/#{action}?#{params.join('&')}"
133
+ @thumbnail_url =
129
134
  end
130
135
 
131
136
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grimen-page_glimpse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Grimfelt