ricepaper 0.0.2 → 0.0.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/VERSION +1 -1
- data/bin/ricepaper +9 -2
- data/lib/ricepaper.rb +17 -7
- data/ricepaper.gemspec +8 -4
- metadata +17 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/ricepaper
CHANGED
@@ -14,6 +14,7 @@ options = OptionParser.new do |opts|
|
|
14
14
|
opts.on("-p", "--password [PASS]", "Password") { |opt| opthash['password'] = opt }
|
15
15
|
opts.on("-a", "--authenticate", "Only attempt to authenticate to Instapaper") { |opt| opthash['authenticate'] = opt }
|
16
16
|
opts.on("-t", "--title [TITLE]", "Optional title for instantpaper entry") { |opt| opthash['title'] = opt }
|
17
|
+
opts.on("-d", "--description [DESC]", "Optional description for the article") { |opt| opthash['desc'] = opt }
|
17
18
|
end
|
18
19
|
|
19
20
|
options.parse!(ARGV)
|
@@ -33,8 +34,14 @@ if ARGV.size < 1
|
|
33
34
|
end
|
34
35
|
|
35
36
|
ARGV.each do |url|
|
36
|
-
|
37
|
-
|
37
|
+
if (!opthash['desc'].nil?)
|
38
|
+
print "Submitting '#{url}' #{opthash['title'].nil? ? "" : "with title '#{opthash['title']}'"}"
|
39
|
+
print ", description '#{opthash['desc']}' ... "
|
40
|
+
else
|
41
|
+
print "Submitting '#{url}' #{opthash['title'].nil? ? "" : "with title '#{opthash['title']}'"} ... "
|
42
|
+
end
|
43
|
+
|
44
|
+
result = rp.add(url,opthash['title'], opthash['desc'])
|
38
45
|
|
39
46
|
puts result ? "Successful." : "Failed."
|
40
47
|
puts "Error: #{rp.error}" unless result
|
data/lib/ricepaper.rb
CHANGED
@@ -46,13 +46,23 @@ class RicePaper
|
|
46
46
|
|
47
47
|
# Add a url to instapaper, given a url and an optional
|
48
48
|
# title; if no title is given, auto-title by instapaper
|
49
|
-
def add(url, title=nil)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
def add(url, title=nil, description=nil)
|
50
|
+
if (description.nil?)
|
51
|
+
result = RestClient.post @apiurl + "add",
|
52
|
+
:username => @username,
|
53
|
+
:password => @password,
|
54
|
+
:url => url,
|
55
|
+
:title => title,
|
56
|
+
:"auto-title" => title.nil? ? "1" : "0"
|
57
|
+
else
|
58
|
+
result = RestClient.post @apiurl + "add",
|
59
|
+
:username => @username,
|
60
|
+
:password => @password,
|
61
|
+
:url => url,
|
62
|
+
:title => title,
|
63
|
+
:"auto-title" => title.nil? ? "1" : "0",
|
64
|
+
:selection => description
|
65
|
+
end
|
56
66
|
rescue RestClient::RequestFailed
|
57
67
|
handle_error($!)
|
58
68
|
return false
|
data/ricepaper.gemspec
CHANGED
@@ -1,12 +1,15 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{ricepaper}
|
5
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
11
|
s.authors = ["Lee Hinman"]
|
9
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-07-06}
|
10
13
|
s.default_executable = %q{ricepaper}
|
11
14
|
s.description = %q{Ricepaper is a library that allows you to add URLs to Instapaper, either by using it as a CLI or as a Ruby library.}
|
12
15
|
s.email = %q{lee@writequit.org}
|
@@ -28,7 +31,7 @@ Gem::Specification.new do |s|
|
|
28
31
|
s.rdoc_options = ["--charset=UTF-8"]
|
29
32
|
s.require_paths = ["lib"]
|
30
33
|
s.rubyforge_project = %q{writequit}
|
31
|
-
s.rubygems_version = %q{1.3.
|
34
|
+
s.rubygems_version = %q{1.3.7}
|
32
35
|
s.summary = %q{A small library for adding URLs to Instapaper}
|
33
36
|
s.test_files = [
|
34
37
|
"examples/add_sites.rb",
|
@@ -39,9 +42,10 @@ Gem::Specification.new do |s|
|
|
39
42
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
40
43
|
s.specification_version = 3
|
41
44
|
|
42
|
-
if Gem::Version.new(Gem::
|
45
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
43
46
|
else
|
44
47
|
end
|
45
48
|
else
|
46
49
|
end
|
47
50
|
end
|
51
|
+
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ricepaper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 25
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Lee Hinman
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-07-06 00:00:00 -06:00
|
13
19
|
default_executable: ricepaper
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -40,21 +46,27 @@ rdoc_options:
|
|
40
46
|
require_paths:
|
41
47
|
- lib
|
42
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
43
50
|
requirements:
|
44
51
|
- - ">="
|
45
52
|
- !ruby/object:Gem::Version
|
53
|
+
hash: 3
|
54
|
+
segments:
|
55
|
+
- 0
|
46
56
|
version: "0"
|
47
|
-
version:
|
48
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
49
59
|
requirements:
|
50
60
|
- - ">="
|
51
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
52
65
|
version: "0"
|
53
|
-
version:
|
54
66
|
requirements: []
|
55
67
|
|
56
68
|
rubyforge_project: writequit
|
57
|
-
rubygems_version: 1.3.
|
69
|
+
rubygems_version: 1.3.7
|
58
70
|
signing_key:
|
59
71
|
specification_version: 3
|
60
72
|
summary: A small library for adding URLs to Instapaper
|