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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c81c9e9a24f3afc21deb2c4d118dddc35c94efe
4
- data.tar.gz: ea9bcc9bc0a92d04af69351012982e049c8c37f6
3
+ metadata.gz: d12f9bd8a5a9fdd97cf8d45ef4a2852d86be0083
4
+ data.tar.gz: df0261530111a7d5231fd4fd41a0ffc2b4758f5d
5
5
  SHA512:
6
- metadata.gz: ae6209b157754ca9bdc18a581eeed83e37ff08196bd98f26dd6f523f6c587840ede8e9feb20ff97e99ae7a623c10bbb35ea16e17567edef3accb966c21419567
7
- data.tar.gz: d7d71406ab67fe1ed818aa2a44e2fb17352f666e4bf863de4b3b62570da97ba0b770ae4efb5f50120612cd5d801ac95865efe12006b63d9d6cc9a0e63254fc9f
6
+ metadata.gz: 68f7b709344f6c3e831de9e49c55890345d25e9cd4f73ad33455191630843c6c7ef8ba926b4b9ac7ea9b19c461e95e25bf2cf8224e58c243b0e086ce4615b13c
7
+ data.tar.gz: bb48a9ae3c62baf7ecbb318f2b0b2b0488d8f38bbb745079da820042c7b45a99ec2bd00cf7df69b603c855334130a658e9ac35c2c1900b722bf3ddd9ac2a9cc7
@@ -18,6 +18,7 @@ module Pinup
18
18
  Launchy.open(url) do |exception|
19
19
  true # if there is an exception remove it from the array so it is not deleted
20
20
  end
21
+ sleep(0.1)
21
22
 
22
23
  false
23
24
  end
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
- response = pinboard_query(LIST_PATH, parameters)
17
- if response.code != '200'
18
- puts "Error getting bookmarks: #{ response.body }"
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.body
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
- url_params = parameters.dup
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
- pinboard_query(DELETE_PATH, url_params)
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
@@ -1,5 +1,5 @@
1
1
  module Pinup
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  SETTINGS = File.expand_path('~/.pinup')
4
4
  PINBOARD_URL = 'pinboard.in'
5
5
  API_URL = 'https://api.pinboard.in/v1'
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
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-05 00:00:00.000000000 Z
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