grimen-page_glimpse 0.1.2 → 0.1.3

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.
data/README.textile CHANGED
@@ -26,7 +26,7 @@ h2. Usage/Examples
26
26
 
27
27
  Initialize:
28
28
 
29
- <pre>snapper = PageGlimse.new('ec0ccd....26df') # => nil</pre>
29
+ <pre>snapper = PageGlimpse.new('ec0ccd....26df') # => nil</pre>
30
30
 
31
31
  Tell PageGlimpse to generate a webpage thumbnail:
32
32
 
@@ -1,9 +1,9 @@
1
1
  require 'rubygems'
2
2
 
3
- gem 'httparty', '0.4.3'
3
+ gem 'httparty', '0.4.4'
4
4
  require 'httparty'
5
5
 
6
- class PageGlimse
6
+ class PageGlimpse
7
7
 
8
8
  InvalidAPIKeyError = Class.new(StandardError)
9
9
 
@@ -53,7 +53,7 @@ class PageGlimse
53
53
 
54
54
  # Get single thumbnail image (PNG).
55
55
  def thumbnail(url, options = {})
56
- response = self.class.get(thumbnail_url)
56
+ response = self.class.get(thumbnail_url(url, options))
57
57
  handle_response(response)
58
58
  response.body
59
59
  end
@@ -130,7 +130,6 @@ class PageGlimse
130
130
  params << "nothumb=#{@nothumb}" if ACTION_PARAMS[action].include?(:nothumb) && @nothumb && !@nothumb.empty?
131
131
  params << "devkey=#{@devkey}" if ACTION_PARAMS[action].include?(:devkey)
132
132
  query_url = "/#{action}?#{params.join('&')}"
133
- @thumbnail_url =
134
133
  end
135
134
 
136
135
  end
@@ -1,17 +1,32 @@
1
+ require 'rubygems'
1
2
  require 'test/unit'
2
3
  require 'shoulda'
3
4
 
5
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'page_glimpse'))
6
+
4
7
  class PageGlimpseTest < Test::Unit::TestCase
5
8
 
6
9
  VALID_API_KEY = 'ec0ccd30be1b39393d19cb5f410d26df'
7
- INVALID_API_KEY = 'ec0ccd30be1b39393d19cb5f410d26d'
10
+ INVALID_API_KEY = 'ec0ccd30be1b39393d19'
8
11
 
9
12
  def setup
10
- @glimpser = PageGlimpse.new(TEST_API_KEY)
13
+ @valid_glimpser = PageGlimpse.new(VALID_API_KEY)
14
+ @invalid_glimpser = PageGlimpse.new(INVALID_API_KEY)
15
+ end
16
+
17
+ should "be instanciated correctly" do
18
+ assert_instance_of PageGlimpse, @valid_glimpser
11
19
  end
12
20
 
13
- should "be true" do
14
- assert true
21
+ should "work with valid api key" do
22
+ assert_equal 200, @valid_glimpser.class.get('http://google.com').code.to_i
15
23
  end
16
24
 
25
+ should "make a snapshot of a valid webpage" do
26
+ @valid_glimpser.request!('http://google.com')
27
+ assert_not_nil @valid_glimpser.thumbnail('http://google.com', :size => :small)
28
+ end
29
+
30
+ # TODO: Write thorough tests.
31
+
17
32
  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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Grimfelt
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-13 00:00:00 -07:00
12
+ date: 2009-08-05 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -25,11 +25,12 @@ files:
25
25
  - MIT-LICENSE
26
26
  - README.textile
27
27
  - Rakefile
28
- - lib/page_glimse.rb
28
+ - lib/page_glimpse.rb
29
29
  - rails/init.rb
30
30
  - test/page_glimse_test.rb
31
31
  has_rdoc: false
32
32
  homepage: http://github.com/grimen/page_glimpse/tree/master
33
+ licenses:
33
34
  post_install_message:
34
35
  rdoc_options:
35
36
  - --charset=UTF-8
@@ -50,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
51
  requirements: []
51
52
 
52
53
  rubyforge_project:
53
- rubygems_version: 1.2.0
54
+ rubygems_version: 1.3.5
54
55
  signing_key:
55
56
  specification_version: 3
56
57
  summary: A little Ruby wrapper for the PageGlimpse API (http://pageglimpse.com) for generating webpage snapshots - glimpses - in a snap.