rubyhexagon 0.4.2 → 0.4.3

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: 654db7bd24d4639d4c30313dad9ca8f738c28b89
4
- data.tar.gz: 739d496a2aa17fadaa7cdd4cb800c4a59e99a48d
3
+ metadata.gz: a0ba6239bf1b972497e5a67367385ee5078361e5
4
+ data.tar.gz: 2dbb6830d9893988e6b08bea317ad1b44e0d1321
5
5
  SHA512:
6
- metadata.gz: 6994e9584fe703c823f7058e0192e06d58b13fa50a8718ff7661ceef787598aba06211e30e7fda8f807fcf89f7a53c9d6c67da2ad7a6ffc2bb78a331dff9ad4d
7
- data.tar.gz: 74e452ca8c56c46801d152dbe7dba5d1bf88ce6a4642686e1087240b74efdb80ee081a6679a7694e860021983a246ef543f5dba45d22585be372cd429a160b42
6
+ metadata.gz: 60745e307ebad26cff032df12f73b0c9d8315869193f2de75e5accc3f1d7bdd72f5d6cb29ab62c22360bf853c887a9b9d239d0c9a19a42bfd2e1be6a470f1149
7
+ data.tar.gz: 7cbec7dcd77f387ef16d5a44377de26985c5af75a2deaad789ca3b433a1dd2973712389604765c3e782ee4de59eed57da1fe2d97a55f583f813a6853596fdaff
data/lib/api.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -22,11 +22,11 @@ require "digest/md5"
22
22
  module E621
23
23
  class Pool < Container
24
24
  def initialize(post)
25
- @api = API.new
25
+ @api = API.new("pool")
26
26
  if post.is_a?(Hash) then
27
27
  set_variables(post)
28
28
  elsif post.is_a?(Fixnum) then
29
- set_variables(@api.pool_show({"id"=>post}))
29
+ set_variables(@api.get("show",{"id"=>post}))
30
30
  else
31
31
  raise ArgumentError, "Parameter must be Hash or Number."
32
32
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -29,5 +29,5 @@ require "pool"
29
29
 
30
30
  module E621
31
31
  Name = "rubyhexagon"
32
- Version = "0.4.2"
32
+ Version = "0.4.3"
33
33
  end
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -38,8 +38,12 @@ module E621
38
38
  # Return each post via a block and process them individually.
39
39
  # This could cause a race condition in the unlikely manner when the queue is
40
40
  # empty and not being filled again, but the worker is still runnning.
41
- def each_post
42
- fetch_all
41
+ def each_post(before_id=false)
42
+ if before_id then
43
+ fetch_all_before_id(before_id)
44
+ else
45
+ fetch_all
46
+ end
43
47
  until !@worker.status do
44
48
  until @queue.empty? do
45
49
  post = @queue.pop
@@ -77,5 +81,20 @@ module E621
77
81
  end
78
82
  end
79
83
  end
84
+ def fetch_all_before_id(id)
85
+ if @request.has_key?(:page) then
86
+ @request.delete(:page)
87
+ @request.store(:before_id, id+1)
88
+ end
89
+ @worker = Thread.new do
90
+ until (posts = @api.post_list(@request)) == Array.new do
91
+ posts.each do |post|
92
+ post = Post.new(post)
93
+ @queue << post if post
94
+ end
95
+ @request[:before_id] = posts.last['id'].to_i
96
+ end
97
+ end
98
+ end
80
99
  end
81
100
  end
data/lib/set.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
@@ -1,5 +1,5 @@
1
1
  =begin
2
- Copyright 2014, 2015 Maxine Red <maxine@furfind.net>
2
+ Copyright 2014, 2015, 2017 Maxine Michalski <maxine@furfind.net>
3
3
 
4
4
  This file is part of rubyhexagon.
5
5
 
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyhexagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxine Red
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-13 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.1'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.1'
27
- - !ruby/object:Gem::Dependency
28
- name: pg
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.18'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.18'
11
+ date: 2017-06-26 00:00:00.000000000 Z
12
+ dependencies: []
41
13
  description: Rubyhexagon provides Ruby bindings for the e621 [dot] net API.
42
14
  email: maxine@furfind.net
43
15
  executables: []