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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 206d0e6e7f5fb3962d24ce7d78d392006a290517
4
- data.tar.gz: e2c0336864192d5cb7fac79cca8f0147cafc4c12
3
+ metadata.gz: b8e2a04dcaab428f83c3814fb13fcd5688fb2a5c
4
+ data.tar.gz: 1013e835b68fdfe716e8728be804b2d808393f13
5
5
  SHA512:
6
- metadata.gz: 8bc2d3f85787b1522612a8016a2b2cb82d61de225127870d01f8ff27e0bf829f9d117534bfe41e887785e6ff358cfe868377f79d12c2dba2621f0d68d2576362
7
- data.tar.gz: 2b93d261698dc973aff5fbfc32da5475de4d25873d9f568a08f53e51e633958d44b697ba1125d911ffae612f73ece27406f832a6312b3c6febb653e44bcbc978
6
+ metadata.gz: aabe87ca2f3291a7a61bc365f08b8ce61069bbe73fd1a2833df81951561cab34b01d40aea86c2fddd3ccfb76d2b7ca25618680c08af04642be1f42b1bdfcde1c
7
+ data.tar.gz: cb12aa96a44f773bb5ef65b3b7bf75fc52c275d7c752e83b4b2af2ddaf8860107f2674dc5faa68560ac49a1eb8b9d3ba68632989f054293ca0b15d21168d71d1
data/bin/ebooks CHANGED
@@ -19,6 +19,8 @@ Usage:
19
19
  ebooks help <command>
20
20
 
21
21
  ebooks new <reponame>
22
+ ebooks s[tart]
23
+ ebooks c[onsole]
22
24
  ebooks auth
23
25
  ebooks consume <corpus_path> [corpus_path2] [...]
24
26
  ebooks consume-all <corpus_path> [corpus_path2] [...]
@@ -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(:direct_message, ev)
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
@@ -1,3 +1,3 @@
1
1
  module Ebooks
2
- VERSION = "3.0.3"
2
+ VERSION = "3.0.4"
3
3
  end
data/skeleton/.gitignore CHANGED
@@ -1 +1 @@
1
- corpus/*
1
+ corpus/
data/spec/bot_spec.rb CHANGED
@@ -9,7 +9,7 @@ class TestBot < Ebooks::Bot
9
9
  def configure
10
10
  end
11
11
 
12
- def on_direct_message(dm)
12
+ def on_message(dm)
13
13
  reply dm, "echo: #{dm.text}"
14
14
  end
15
15
 
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.3
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-06 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec