twitter_ebooks 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ebooks +2 -0
- data/lib/twitter_ebooks/bot.rb +31 -2
- data/lib/twitter_ebooks/version.rb +1 -1
- data/skeleton/.gitignore +1 -1
- data/spec/bot_spec.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: b8e2a04dcaab428f83c3814fb13fcd5688fb2a5c
|
4
|
+
data.tar.gz: 1013e835b68fdfe716e8728be804b2d808393f13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aabe87ca2f3291a7a61bc365f08b8ce61069bbe73fd1a2833df81951561cab34b01d40aea86c2fddd3ccfb76d2b7ca25618680c08af04642be1f42b1bdfcde1c
|
7
|
+
data.tar.gz: cb12aa96a44f773bb5ef65b3b7bf75fc52c275d7c752e83b4b2af2ddaf8860107f2674dc5faa68560ac49a1eb8b9d3ba68632989f054293ca0b15d21168d71d1
|
data/bin/ebooks
CHANGED
data/lib/twitter_ebooks/bot.rb
CHANGED
@@ -105,6 +105,35 @@ module Ebooks
|
|
105
105
|
end
|
106
106
|
@mentionless = mless
|
107
107
|
end
|
108
|
+
|
109
|
+
# Get an array of media uris in tweet.
|
110
|
+
# @param size [String] A twitter image size to return. Supported sizes are thumb, small, medium (default), large
|
111
|
+
# @return [Array<String>] image URIs included in tweet
|
112
|
+
def media_uris(size_input = '')
|
113
|
+
case size_input
|
114
|
+
when 'thumb'
|
115
|
+
size = ':thumb'
|
116
|
+
when 'small'
|
117
|
+
size = ':small'
|
118
|
+
when 'medium'
|
119
|
+
size = ':medium'
|
120
|
+
when 'large'
|
121
|
+
size = ':large'
|
122
|
+
else
|
123
|
+
size = ''
|
124
|
+
end
|
125
|
+
|
126
|
+
# Start collecting uris.
|
127
|
+
uris = []
|
128
|
+
if @tweet.media?
|
129
|
+
@tweet.media.each do |each_media|
|
130
|
+
uris << each_media.media_url.to_s + size
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# and that's pretty much it!
|
135
|
+
uris
|
136
|
+
end
|
108
137
|
end
|
109
138
|
|
110
139
|
class Bot
|
@@ -222,7 +251,7 @@ module Ebooks
|
|
222
251
|
if ev.is_a? Twitter::DirectMessage
|
223
252
|
return if ev.sender.screen_name.downcase == @username.downcase # Don't reply to self
|
224
253
|
log "DM from @#{ev.sender.screen_name}: #{ev.text}"
|
225
|
-
fire(:
|
254
|
+
fire(:message, ev)
|
226
255
|
|
227
256
|
elsif ev.respond_to?(:name) && ev.name == :follow
|
228
257
|
return if ev.source.screen_name.downcase == @username.downcase
|
@@ -350,7 +379,7 @@ module Ebooks
|
|
350
379
|
end
|
351
380
|
|
352
381
|
log "Replying to @#{ev.user.screen_name} with: #{meta.reply_prefix + text}"
|
353
|
-
tweet = twitter.update(meta.reply_prefix + text, in_reply_to_status_id: ev.id)
|
382
|
+
tweet = twitter.update(meta.reply_prefix + text, opts.merge({in_reply_to_status_id: ev.id}))
|
354
383
|
conversation(tweet).add(tweet)
|
355
384
|
tweet
|
356
385
|
else
|
data/skeleton/.gitignore
CHANGED
@@ -1 +1 @@
|
|
1
|
-
corpus
|
1
|
+
corpus/
|
data/spec/bot_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter_ebooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaiden Mispy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|