twitter_meme 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
  SHA256:
3
- metadata.gz: 8367722165e5832d33b37961d1f06d4c390c134fffca765f9b32146c13cd4235
4
- data.tar.gz: 46c5f41c99d03d0edc31ca3c44d4f547130b164ff9ff0abd6ca6870ef6152bc7
3
+ metadata.gz: 962b4ded2e1b77715a947dfbcd54bdab3c6599acc036c88dbf8a44ec127ed4a9
4
+ data.tar.gz: 6fd2ed83e3ffe99ac0caa7f68811ff94a01808348a77c08d0f888e4646d4ec22
5
5
  SHA512:
6
- metadata.gz: dfbfed0939767beee8ac80d7611dc213e980cad8b19efd7a610f081c515a3bc345c0ff0390e0554147988ae6d45dc305b683b826df2bb380d4fb583d8c5661ca
7
- data.tar.gz: ea8a082714b1191dd806b272c3bbe4d98ffd568e714cc675309298b259e7a9dac39c5a0b37b4de1c60009293c3f74535fc5cacd14e60c30f6b1106a2eee12d55
6
+ metadata.gz: 05f143103cad641ec1b0cf887e5419532f98aae3f7fca31c9cc854a49d8662d0b1ebd6d2d98075626e59788d8c8dd6be1fb186ac52c9fe3ab58b5ff12558af32
7
+ data.tar.gz: 2a5ece0e9fc4cdcccb30e234e2b2c2027782a7f8f8dd9d57e8d386641b1302042e4f19f8638c060d206b9c8771c97db7d01431c28983aa04bd5675bc5c8ba447
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitter_meme (0.1.4)
4
+ twitter_meme (0.1.5)
5
5
  rest-client (~> 2.0.0)
6
6
  twitter (~> 6.0.0)
7
7
 
@@ -34,7 +34,7 @@ GEM
34
34
  multipart-post (2.0.0)
35
35
  naught (1.1.0)
36
36
  netrc (0.11.0)
37
- public_suffix (3.0.1)
37
+ public_suffix (3.0.2)
38
38
  rake (10.5.0)
39
39
  rest-client (2.0.2)
40
40
  http-cookie (>= 1.0.2, < 2.0)
@@ -67,7 +67,7 @@ GEM
67
67
  simple_oauth (~> 0.3.1)
68
68
  unf (0.1.4)
69
69
  unf_ext
70
- unf_ext (0.0.7.4)
70
+ unf_ext (0.0.7.5)
71
71
 
72
72
  PLATFORMS
73
73
  ruby
data/lib/twitter_meme.rb CHANGED
@@ -51,19 +51,7 @@ module TwitterMeme
51
51
 
52
52
  meme_file = generate_meme(text0, text1, tweet)
53
53
 
54
- print 'Tweeting to main account... '
55
- # my_tweet = client.update_with_media(nil, File.new(meme_file))
56
- my_tweet = client.update_with_media(CGI.unescapeHTML(tweet.text), File.new(meme_file))
57
- print "done (#{my_tweet.url})\n"
58
-
59
- if options[:reply_to_orginal_tweet]
60
- print "Tweeting reply to #{options[:twitter_username]}... "
61
- reply_tweet = client.update(
62
- "#{options[:twitter_username]} #{my_tweet.url}",
63
- in_reply_to_status_id: last_id
64
- )
65
- print "done (#{reply_tweet.url})\n"
66
- end
54
+ sent_tweet(tweet, meme_file)
67
55
 
68
56
  FileUtils.rm(meme_file)
69
57
  end
@@ -75,6 +63,26 @@ module TwitterMeme
75
63
  end
76
64
  end
77
65
 
66
+ def send_tweet(tweet, meme_file)
67
+ print 'Tweeting to main account... '
68
+ # my_tweet = client.update_with_media(nil, File.new(meme_file))
69
+ my_tweet = client.update_with_media(CGI.unescapeHTML(tweet.text), File.new(meme_file))
70
+ print "done (#{my_tweet.url})\n"
71
+
72
+ if options[:reply_to_orginal_tweet]
73
+ print "Tweeting reply to #{options[:twitter_username]}... "
74
+ reply_tweet = client.update(
75
+ "#{options[:twitter_username]} #{my_tweet.url}",
76
+ in_reply_to_status_id: last_id
77
+ )
78
+ print "done (#{reply_tweet.url})\n"
79
+ end
80
+ rescue
81
+ puts 'Hit a snag, retrying...'
82
+ sleep 60
83
+ retry
84
+ end
85
+
78
86
  def client
79
87
  Twitter::REST::Client.new do |config|
80
88
  config.consumer_key = options[:twitter_consumer_key]
@@ -1,3 +1,3 @@
1
1
  module TwitterMeme
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter_meme
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
  - Josh Frye
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-23 00:00:00.000000000 Z
11
+ date: 2018-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 2.7.4
129
+ rubygems_version: 2.7.6
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Mirror twitter accounts to parody meme accounts