instascraper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
+ #!/usr/bin/env rake
1
2
  require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new('spec')
6
+
7
+ task :default => :spec
@@ -19,4 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_dependency 'mechanize'
22
+
23
+ s.add_development_dependency 'bundler', '~> 1.0'
24
+ s.add_development_dependency 'rspec', '~> 2.6'
22
25
  end
@@ -32,7 +32,9 @@ class Instascraper
32
32
  page.parser.css('.tableViewCell').each do |bookmark|
33
33
  bookmark.css('.tableViewCellTitleLink').first['href']
34
34
 
35
- bookmarks << Bookmark.new(bookmark.css('.tableViewCellTitleLink').first['href'], bookmark.css('.tableViewCellTitleLink').first.text)
35
+ bookmarks << Bookmark.new(bookmark.css('.tableViewCellTitleLink').first['href'],
36
+ bookmark.css('.tableViewCellTitleLink').first.text,
37
+ 'http://www.instapaper.com'+bookmark.css('.textButton').first['href'])
36
38
  end
37
39
 
38
40
  if page.link_with :text => /Older items/
@@ -2,10 +2,12 @@ class Instascraper
2
2
  class Bookmark
3
3
  attr_reader :link
4
4
  attr_reader :title
5
+ attr_reader :text
5
6
 
6
- def initialize(link, title)
7
+ def initialize(link, title, text)
7
8
  @link = link
8
9
  @title = title
10
+ @text = text
9
11
  end
10
12
  end
11
13
  end
@@ -1,3 +1,3 @@
1
1
  class Instascraper
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Instascraper do
4
+ it 'should download all your bookmarks' do
5
+ i = Instascraper.new('andrewnez+instascraper@gmail.com', 'test')
6
+ bookmarks = i.bookmarks
7
+ bookmarks.class.should eql(Array)
8
+ bookmarks.first.class.should eql(Instascraper::Bookmark)
9
+
10
+ bookmarks.first.title.should match /Teabass.com/
11
+ bookmarks.first.link.should match /http:\/\/teabass.com/
12
+ bookmarks.first.text.should match /http:\/\/www.instapaper.com\/text\?u=http%3A%2F%2Fteabass.com&article=193664503/
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'instascraper'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instascraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
16
- requirement: &70231649735820 !ruby/object:Gem::Requirement
16
+ requirement: &70204961969640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,29 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70231649735820
24
+ version_requirements: *70204961969640
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &70204961968800 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70204961968800
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70204961959740 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.6'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70204961959740
25
47
  description: A scraper for instapaper to provide a basic api without hacing to pay
26
48
  per month
27
49
  email:
@@ -39,6 +61,8 @@ files:
39
61
  - lib/instascraper.rb
40
62
  - lib/instascraper/bookmark.rb
41
63
  - lib/instascraper/version.rb
64
+ - spec/instascraper_spec.rb
65
+ - spec/spec_helper.rb
42
66
  homepage: http://github.com/andrew/instascraper
43
67
  licenses: []
44
68
  post_install_message:
@@ -63,4 +87,6 @@ rubygems_version: 1.8.6
63
87
  signing_key:
64
88
  specification_version: 3
65
89
  summary: Basic, free bookmarks api for instapaper
66
- test_files: []
90
+ test_files:
91
+ - spec/instascraper_spec.rb
92
+ - spec/spec_helper.rb