tumblr_draftking 0.10.0 → 0.10.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +2 -2
- data/lib/draftking/client.rb +16 -1
- data/lib/draftking/constants.rb +1 -1
- data/lib/draftking/posts.rb +6 -2
- data/lib/draftking/posts/post.rb +25 -11
- data/lib/draftking/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baf83276f4bba8b2a25431e0a28f6d177252bc19
|
4
|
+
data.tar.gz: af32e44ef1e49c5e99f1f4247c28db78a57025f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f736833a732b2bd5a72ac312c302ec93a5d984547b0db2144517138f9b337241f83c5c6e431ef8c7120df6238ca274c66018e94eb30e50d36572469b651270fd
|
7
|
+
data.tar.gz: 25353c3a70bc1d534894e9da8a55bd16c22687bf473788e254f378af5929a5b28f191dbd7f5cb40823b035a91fe47d08ddc585d08abfa900cc4ab08e2c123d8e
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Changelog :: tumblr_draftking
|
2
|
+
## Version 0.10.0.1
|
3
|
+
+ Fix for Faraday::ConnectionFailed when trying to reach Tumblr
|
4
|
+
|
2
5
|
## Version 0.10.0
|
3
6
|
+ Enhanced get_posts logic to handle retrieval of published posts. Set `dk.source = DK::PUBLISH` before calling `dk.get_posts`.
|
4
7
|
|
data/README.md
CHANGED
@@ -15,8 +15,8 @@ DraftKing for Tumblr takes the hassle out of managing your draft queue!
|
|
15
15
|
+ **Randomize post order to add variety.**
|
16
16
|
+ **Manage multiple accounts.**
|
17
17
|
|
18
|
-
Version 0.10.0
|
19
|
-
+
|
18
|
+
Version 0.10.0.1
|
19
|
+
+ Fix for Faraday::ConnectionFailed when trying to reach Tumblr
|
20
20
|
|
21
21
|
+ Please report any [issues] you encounter!
|
22
22
|
+ [Change Log](./CHANGELOG.md)
|
data/lib/draftking/client.rb
CHANGED
@@ -65,7 +65,7 @@ module DK
|
|
65
65
|
# @param name [String] Name of blog to target
|
66
66
|
def act_on_blog(name: nil)
|
67
67
|
return unless connected?
|
68
|
-
@user =
|
68
|
+
@user = client_user_info_to_ostruct
|
69
69
|
@blog_name = name ? name.gsub('.tumblr.com', '') : @user.blogs.first.name
|
70
70
|
@blog_url = tumblr_url(@blog_name)
|
71
71
|
@user.blogs.each do |blog|
|
@@ -77,6 +77,21 @@ module DK
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
def client_user_info_to_ostruct
|
81
|
+
info = block_with_retry { |_| @client.info['user'].to_json }
|
82
|
+
JSON.parse(info, object_class: OpenStruct)
|
83
|
+
end
|
84
|
+
|
85
|
+
def block_with_retry(opts = {}, &block)
|
86
|
+
retries = 0
|
87
|
+
begin
|
88
|
+
return block.call(opts)
|
89
|
+
rescue
|
90
|
+
retry unless (retries += 1) > MAX_RETRY
|
91
|
+
return nil
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
80
95
|
def connected?
|
81
96
|
@client && @client.info['status'] != 401
|
82
97
|
end
|
data/lib/draftking/constants.rb
CHANGED
data/lib/draftking/posts.rb
CHANGED
@@ -157,8 +157,12 @@ module DK
|
|
157
157
|
|
158
158
|
# Dashboard integration
|
159
159
|
def call_source(options)
|
160
|
-
|
161
|
-
|
160
|
+
begin
|
161
|
+
return @client.send(@source, options).first[1] if dashboard? || likes?
|
162
|
+
@client.send(check_for_publish(@source), @blog_url, options)
|
163
|
+
rescue
|
164
|
+
retry
|
165
|
+
end
|
162
166
|
end
|
163
167
|
|
164
168
|
def check_for_publish(source)
|
data/lib/draftking/posts/post.rb
CHANGED
@@ -96,10 +96,17 @@ module DK
|
|
96
96
|
# @param simulate [Bool] Simulate Action?
|
97
97
|
def reblog(client:, simulate: nil)
|
98
98
|
return 1 if simulate
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
retries = 0
|
100
|
+
begin
|
101
|
+
client.reblog @blog_url,
|
102
|
+
id: id,
|
103
|
+
reblog_key: @reblog_key,
|
104
|
+
comment: @comment
|
105
|
+
rescue
|
106
|
+
retries += 1
|
107
|
+
retry unless retries > MAX_RETRY
|
108
|
+
raise IOError, 'Connection to Tumblr timed-out!'
|
109
|
+
end
|
103
110
|
end
|
104
111
|
|
105
112
|
# Save a post
|
@@ -108,13 +115,20 @@ module DK
|
|
108
115
|
def save(client:, simulate: nil)
|
109
116
|
return 0 unless @changed
|
110
117
|
return @saved = 1 if simulate
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
+
retries = 0
|
119
|
+
begin
|
120
|
+
res = client.edit @blog_url,
|
121
|
+
id: id,
|
122
|
+
reblog_key: @reblog_key,
|
123
|
+
state: validate_state,
|
124
|
+
attach_reblog_tree: @keep_tree,
|
125
|
+
tags: @tags.join(','),
|
126
|
+
caption: @comment
|
127
|
+
rescue
|
128
|
+
retries += 1
|
129
|
+
retry unless retries > MAX_RETRY
|
130
|
+
raise IOError, 'Connection to Tumblr timed-out!'
|
131
|
+
end
|
118
132
|
return 0 unless res && res['id']
|
119
133
|
@changed = false
|
120
134
|
@saved = 1
|
data/lib/draftking/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tumblr_draftking
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.0
|
4
|
+
version: 0.10.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Meissa Dia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tumblr_client
|