tumblr_draftking 0.9.1.0 → 0.10.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7e8c7b5b045f41f100e52afe1faec27dcca83db
4
- data.tar.gz: 206cecc7a334f8083965c7e0adb0761f20b400cb
3
+ metadata.gz: b6e41e4944fa26486bda43f3878307b7b400b67a
4
+ data.tar.gz: d5e11a2fcd4e12760460d75a9144b81c4a091796
5
5
  SHA512:
6
- metadata.gz: c9f9d25fe5a8c88a1b2f014bf096c5133a6f0bed1fc913621f80fa7fede68d335f0e2a506a4c6e7a92e7aeaacb790ae86e65503aed5c76b407f00e3987b2e410
7
- data.tar.gz: ea3553b4e384dbb3146affca11b05324b32bbb2c26feb3518a28564f1f8c5504db98f03d1f2f2e917c3229c42f0ef223c96745783085d1d1903f4d7348edc5e1
6
+ metadata.gz: 9457b1402c0e86adcd0078e1d158924e233885a7174e7875c7fc755736b9e69afde064e06464397611c2acf5fbce5f14097ce2dcf724eaabfe3bda76be6202e5
7
+ data.tar.gz: efae44606eba41deb21fd78ee9a5d05de205c2873fb67865cdae19861da5c36b23d7d650433b4ccda8eec0b8f8631eefb1974fdb956d14926648b24adab85377
@@ -1,4 +1,7 @@
1
1
  # Changelog :: tumblr_draftking
2
+ ## Version 0.10.0
3
+ + Enhanced get_posts logic to handle retrieval of published posts. Set `dk.source = DK::PUBLISH` before calling `dk.get_posts`.
4
+
2
5
  ## Version 0.9.1.0
3
6
  + Added CLI option (--no-show-pi) to hide progress indicators. (--mute) can still be used to silence progress messages and the final report.
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.9.1.0
19
- + Added CLI option (--no-show-pi) to hide progress indicators. (--mute) can still be used to silence progress messages and the final report.
18
+ Version 0.10.0
19
+ + Enhanced get_posts logic to handle retrieval of published posts. Set `dk.source = DK::PUBLISH` before calling `dk.get_posts`.
20
20
 
21
21
  + Please report any [issues] you encounter!
22
22
  + [Change Log](./CHANGELOG.md)
data/bin/dk CHANGED
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
- require_relative '../lib/tumblr_draftking'
3
+ if ENV['DEV_ENV']
4
+ # DEV ONLY - Run development source using system installed cli
5
+ rdir = ENV['DIR_RUBY']
6
+ require File.join(Dir.home, "#{rdir}/tumblr_draftking/lib/tumblr_draftking")
7
+ else
8
+ require_relative '../lib/tumblr_draftking'
9
+ end
4
10
 
5
11
  # Display 'update available'
6
12
  require 'open-uri'
@@ -14,7 +14,7 @@ module DK
14
14
  attr_accessor :shuffle, :keep_tree, :test_data, :mute
15
15
  attr_accessor :simulate, :keep_tags, :before_id, :credit
16
16
  attr_accessor :message, :source, :auto_tag, :state
17
- attr_accessor :type, :tags
17
+ attr_accessor :type, :tags, :greedy, :show_pi
18
18
 
19
19
  # Initialize instance of DraftKing for the specified blog
20
20
  # @param options[:blog_name] [String] Target blog name
@@ -87,6 +87,8 @@ module DK
87
87
  return src if src.is_a? Symbol
88
88
  return :dashboard if src.include?('dash')
89
89
  return :queue if src.include?('queue')
90
+ return :posts if src.include?('publish')
91
+ return :draft if src.include?('draft')
90
92
  end
91
93
  end
92
94
  end
@@ -148,7 +148,7 @@ module DK
148
148
 
149
149
  begin
150
150
  retries ||= 0
151
- result = call_source(options)
151
+ result = call_source(options)['posts']
152
152
  result.is_a?(Integer) ? (raise TypeError) : result
153
153
  rescue TypeError
154
154
  (retries += 1) > MAX_RETRY ? [] : retry
@@ -158,7 +158,12 @@ module DK
158
158
  # Dashboard integration
159
159
  def call_source(options)
160
160
  return @client.send(@source, options).first[1] if dashboard? || likes?
161
- @client.send(@source, @blog_url, options).first[1]
161
+ @client.send(check_for_publish(@source), @blog_url, options)
162
+ end
163
+
164
+ def check_for_publish(source)
165
+ return source unless source.eql?(PUBLISH)
166
+ :posts
162
167
  end
163
168
 
164
169
  # Get @limit # of Posts
@@ -21,7 +21,11 @@ module DK
21
21
  @changed = false
22
22
  @saved = 0
23
23
  @comment = @data.reblog.comment
24
- @from = @data.trail.first.blog.name rescue '<no ID>'
24
+ @from = begin
25
+ @data.trail.first.blog.name
26
+ rescue
27
+ '<no ID>'
28
+ end
25
29
 
26
30
  # Direct map
27
31
  @id = @data.id
@@ -166,6 +170,7 @@ module DK
166
170
  def process_state(state)
167
171
  return DK::DRAFT unless state || state.empty
168
172
  return DK::QUEUE if state == 'queued'
173
+ return DK::PUBLISH if state.include?('pub')
169
174
  state
170
175
  end
171
176
 
@@ -4,6 +4,7 @@ module DK
4
4
  def pputs(str)
5
5
  puts str unless @mute || !@show_pi
6
6
  end
7
+
7
8
  def pprint(str)
8
9
  puts str unless @mute || !@show_pi
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module DK
2
- VERSION = '0.9.1.0'.freeze
2
+ VERSION = '0.10.0'.freeze
3
3
  end
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.9.1.0
4
+ version: 0.10.0
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-03-31 00:00:00.000000000 Z
11
+ date: 2018-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tumblr_client