pinup 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pinup/commands/open.rb +1 -0
- data/lib/pinup/queries.rb +20 -20
- data/lib/pinup/version.rb +1 -1
- data/pinup.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d12f9bd8a5a9fdd97cf8d45ef4a2852d86be0083
|
4
|
+
data.tar.gz: df0261530111a7d5231fd4fd41a0ffc2b4758f5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68f7b709344f6c3e831de9e49c55890345d25e9cd4f73ad33455191630843c6c7ef8ba926b4b9ac7ea9b19c461e95e25bf2cf8224e58c243b0e086ce4615b13c
|
7
|
+
data.tar.gz: bb48a9ae3c62baf7ecbb318f2b0b2b0488d8f38bbb745079da820042c7b45a99ec2bd00cf7df69b603c855334130a658e9ac35c2c1900b722bf3ddd9ac2a9cc7
|
data/lib/pinup/commands/open.rb
CHANGED
data/lib/pinup/queries.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'net/https'
|
2
2
|
require 'uri'
|
3
3
|
require 'json'
|
4
|
+
require 'typhoeus'
|
4
5
|
|
5
6
|
module Pinup
|
6
7
|
class Queries
|
@@ -13,12 +14,17 @@ module Pinup
|
|
13
14
|
parameters = JSON_PARAMS.dup
|
14
15
|
parameters[:auth_token] = token
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
request = Typhoeus::Request.new(
|
18
|
+
"#{ API_URL }/#{ LIST_PATH }",
|
19
|
+
:params => parameters
|
20
|
+
)
|
21
|
+
response = request.run
|
22
|
+
|
23
|
+
if response.response_code != 200
|
24
|
+
puts "Error getting bookmarks: #{ response.response_body }"
|
19
25
|
return nil
|
20
26
|
else
|
21
|
-
return response.
|
27
|
+
return response.response_body
|
22
28
|
end
|
23
29
|
end
|
24
30
|
|
@@ -55,12 +61,20 @@ module Pinup
|
|
55
61
|
|
56
62
|
parameters = JSON_PARAMS.dup
|
57
63
|
parameters[:auth_token] = token
|
58
|
-
|
64
|
+
hydra = Typhoeus::Hydra.new
|
59
65
|
|
60
66
|
urls.each do |url|
|
67
|
+
url_params = parameters.dup
|
61
68
|
url_params[:url] = url
|
62
|
-
|
69
|
+
request = Typhoeus::Request.new(
|
70
|
+
"#{ API_URL }/#{ DELETE_PATH }",
|
71
|
+
:params => url_params
|
72
|
+
)
|
73
|
+
|
74
|
+
hydra.queue(request)
|
63
75
|
end
|
76
|
+
|
77
|
+
hydra.run
|
64
78
|
end
|
65
79
|
|
66
80
|
def self.should_show(bookmark, unread, untagged)
|
@@ -93,19 +107,5 @@ module Pinup
|
|
93
107
|
|
94
108
|
return item_output
|
95
109
|
end
|
96
|
-
|
97
|
-
private
|
98
|
-
|
99
|
-
def self.pinboard_query(path, parameters)
|
100
|
-
uri = URI.parse("#{ API_URL }/#{ path }")
|
101
|
-
uri.query = URI.encode_www_form(parameters)
|
102
|
-
|
103
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
104
|
-
http.use_ssl = true
|
105
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
106
|
-
|
107
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
108
|
-
http.request(request)
|
109
|
-
end
|
110
110
|
end
|
111
111
|
end
|
data/lib/pinup/version.rb
CHANGED
data/pinup.gemspec
CHANGED
@@ -18,6 +18,7 @@ spec = Gem::Specification.new do |s|
|
|
18
18
|
s.add_dependency('colored', '~> 1.2')
|
19
19
|
s.add_dependency('netrc', '~> 0.7.7')
|
20
20
|
s.add_dependency('launchy', '~> 2.3.0')
|
21
|
+
s.add_dependency('typhoeus', '~> 0.6.3')
|
21
22
|
s.add_development_dependency('rake')
|
22
23
|
s.add_development_dependency('coveralls')
|
23
24
|
s.add_development_dependency('rspec', '~> 2.13.0')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pinup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Smiley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.3.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: typhoeus
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.6.3
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|