atig 0.3.12 → 0.4.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/atig.gemspec +1 -0
- data/lib/atig/agent.rb +0 -1
- data/lib/atig/agent/following.rb +3 -3
- data/lib/atig/agent/full_list.rb +2 -2
- data/lib/atig/agent/list.rb +10 -10
- data/lib/atig/agent/list_status.rb +3 -2
- data/lib/atig/agent/mention.rb +1 -1
- data/lib/atig/agent/noretweets.rb +1 -1
- data/lib/atig/channel/list.rb +0 -1
- data/lib/atig/command/autofix.rb +1 -0
- data/lib/atig/command/command.rb +2 -2
- data/lib/atig/command/destroy.rb +1 -1
- data/lib/atig/command/dm.rb +1 -1
- data/lib/atig/command/favorite.rb +1 -1
- data/lib/atig/gateway/channel.rb +1 -0
- data/lib/atig/oauth.rb +1 -0
- data/lib/atig/option.rb +1 -1
- data/lib/atig/twitter.rb +5 -7
- data/lib/atig/version.rb +1 -1
- data/spec/command/dm_spec.rb +1 -1
- data/spec/command/favorite_spec.rb +5 -5
- data/spec/option_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -3
- metadata +19 -6
- data/lib/atig/agent/other_list.rb +0 -18
- data/lib/atig/agent/own_list.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 975f7bc77cc611f0825ec3ae132d4c530494297c
|
4
|
+
data.tar.gz: 72f9b9c6390ac1b9b740a5641476cb1901a50fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96f4e9f26a887e3b56e62e523fbe62285b328b4399948134aac7a45628a5d452b2b05dcff52cbbf92626785d4ee3c58afa9a61ff033bad74898ae9f9ad94ede0
|
7
|
+
data.tar.gz: f3532ae36835e30cfb899caf36adb8d0ebcf27e415c07ab66f8ddd0563e97fc8f9e31a1c890c5ad5dc6f7e1c4d29149de378bd24b626eb35613fe2c88e8ee57e
|
data/.travis.yml
ADDED
data/atig.gemspec
CHANGED
data/lib/atig/agent.rb
CHANGED
data/lib/atig/agent/following.rb
CHANGED
@@ -22,15 +22,15 @@ module Atig
|
|
22
22
|
|
23
23
|
def update(api)
|
24
24
|
if @db.followings.empty?
|
25
|
-
friends = api.page("
|
25
|
+
friends = api.page("friends/list", :users, {:user_id => @db.me.id})
|
26
26
|
else
|
27
27
|
@db.me = api.post("account/update_profile")
|
28
28
|
return if @db.me.friends_count == @db.followings.size
|
29
|
-
friends = api.page("
|
29
|
+
friends = api.page("friends/list", :users, {:user_id => @db.me.id})
|
30
30
|
end
|
31
31
|
|
32
32
|
if @opts.only
|
33
|
-
followers = api.page("
|
33
|
+
followers = api.page("friends/ids", :ids, {:user_id => @db.me.id})
|
34
34
|
friends.each do|friend|
|
35
35
|
friend[:only] = !followers.include?(friend.id)
|
36
36
|
end
|
data/lib/atig/agent/full_list.rb
CHANGED
data/lib/atig/agent/list.rb
CHANGED
@@ -12,16 +12,16 @@ module Atig
|
|
12
12
|
@db = db
|
13
13
|
log :info, "initialize"
|
14
14
|
|
15
|
-
@db.lists.on_invalidated
|
15
|
+
@db.lists.on_invalidated do |name|
|
16
16
|
log :info, "invalidated #{name}"
|
17
|
-
api.delay(0)
|
17
|
+
api.delay(0) do |t|
|
18
18
|
if name == :all then
|
19
19
|
full_update t
|
20
20
|
else
|
21
|
-
@db.lists[name].update t.page("
|
21
|
+
@db.lists[name].update t.page("lists/members", :users, {:owner_screen_name => @db.me.screen_name, :slug => name})
|
22
22
|
end
|
23
|
-
|
24
|
-
|
23
|
+
end
|
24
|
+
end
|
25
25
|
api.repeat( interval ) do|t|
|
26
26
|
self.full_update t
|
27
27
|
end
|
@@ -29,11 +29,11 @@ module Atig
|
|
29
29
|
|
30
30
|
def full_update(t)
|
31
31
|
lists = entry_points.map{|entry|
|
32
|
-
t.
|
33
|
-
}.flatten
|
32
|
+
t.get(entry)
|
33
|
+
}.flatten.compact
|
34
34
|
|
35
35
|
users = {}
|
36
|
-
lists.map do|list|
|
36
|
+
lists.map do |list|
|
37
37
|
name = if list.user.screen_name == @db.me.screen_name then
|
38
38
|
"#{list.slug}"
|
39
39
|
else
|
@@ -41,8 +41,8 @@ module Atig
|
|
41
41
|
end
|
42
42
|
begin
|
43
43
|
users[name] =
|
44
|
-
t.page("
|
45
|
-
rescue
|
44
|
+
t.page("lists/members", :users, {:owner_screen_name => list.user.screen_name, :slug => list.slug})
|
45
|
+
rescue => e
|
46
46
|
log :error, e.inspect
|
47
47
|
users[name] =
|
48
48
|
@db.lists.find_by_list_name(list.slug)
|
@@ -20,8 +20,9 @@ class Atig::Agent::ListStatus
|
|
20
20
|
q = {}
|
21
21
|
q.update(:since_id => @prev[name]) if @prev.key?(name)
|
22
22
|
|
23
|
-
screen_name,slug = parse name
|
24
|
-
|
23
|
+
screen_name, slug = parse name
|
24
|
+
q.update(:owner_screen_name => screen_name, :slug => slug)
|
25
|
+
statuses = t.get("lists/statuses", q)
|
25
26
|
statuses.reverse_each do|status|
|
26
27
|
db.statuses.transaction do|d|
|
27
28
|
d.add(:status => status,
|
data/lib/atig/agent/mention.rb
CHANGED
data/lib/atig/channel/list.rb
CHANGED
data/lib/atig/command/autofix.rb
CHANGED
data/lib/atig/command/command.rb
CHANGED
@@ -9,11 +9,11 @@ module Atig
|
|
9
9
|
@gateway = gateway
|
10
10
|
@api = api
|
11
11
|
@db = db
|
12
|
-
|
12
|
+
@gateway.ctcp_action(*command_name) do |target, mesg, command, args|
|
13
13
|
action(target, mesg, command, args){|m|
|
14
14
|
gateway[target].notify m
|
15
15
|
}
|
16
|
-
|
16
|
+
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def find_by_tid(tid)
|
data/lib/atig/command/destroy.rb
CHANGED
data/lib/atig/command/dm.rb
CHANGED
@@ -14,7 +14,7 @@ module Atig
|
|
14
14
|
args.each do|tid|
|
15
15
|
if entry = Info.find_status(db, tid)
|
16
16
|
api.delay(0){|t|
|
17
|
-
res = t.post("favorites/#{method}
|
17
|
+
res = t.post("favorites/#{method}", {:id => entry.status.id})
|
18
18
|
yield "#{command.upcase}: #{entry.user.screen_name}: #{entry.status.text}"
|
19
19
|
}
|
20
20
|
else
|
data/lib/atig/gateway/channel.rb
CHANGED
data/lib/atig/oauth.rb
CHANGED
data/lib/atig/option.rb
CHANGED
@@ -29,7 +29,7 @@ module Atig
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
default_value :api_base, 'https://api.twitter.com/1/'
|
32
|
+
default_value :api_base, 'https://api.twitter.com/1.1/'
|
33
33
|
default_value :stream_api_base, 'https://userstream.twitter.com/2/'
|
34
34
|
default_value :search_api_base, 'http://search.twitter.com/'
|
35
35
|
|
data/lib/atig/twitter.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# -*- coding: utf-8 -*-
|
2
|
+
|
3
3
|
require 'atig/basic_twitter'
|
4
4
|
require 'atig/http'
|
5
5
|
|
@@ -12,16 +12,14 @@ module Atig
|
|
12
12
|
@http = Atig::Http.new @log
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
def page(path, name, authenticate = true, &block)
|
15
|
+
def page(path, name, opts = {}, &block)
|
17
16
|
limit = 0.98 * @remain # 98% of IP based rate limit
|
18
17
|
r = []
|
19
18
|
cursor = -1
|
20
19
|
1.upto(limit) do |num|
|
21
|
-
|
22
|
-
ret = api(path,
|
23
|
-
|
24
|
-
r.concat arr
|
20
|
+
options = {:cursor => cursor}.merge(opts)
|
21
|
+
ret = api(path, options, { :authenticate => true })
|
22
|
+
r.concat ret[name]
|
25
23
|
cursor = ret[:next_cursor]
|
26
24
|
break if cursor.zero?
|
27
25
|
end
|
data/lib/atig/version.rb
CHANGED
data/spec/command/dm_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe Atig::Command::Dm do
|
|
15
15
|
|
16
16
|
it "should post the status by API" do
|
17
17
|
@api.should_receive(:post).with('direct_messages/new',
|
18
|
-
{:
|
18
|
+
{:screen_name => 'mzp', :text => 'blah blah'})
|
19
19
|
@channel.should_receive(:notify).with("Sent message to mzp: blah blah")
|
20
20
|
call '#twitter', "dm", %w(mzp blah blah)
|
21
21
|
end
|
@@ -18,35 +18,35 @@ describe Atig::Command::Favorite do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should post fav by tid" do
|
21
|
-
@api.should_receive(:post).with("favorites/create
|
21
|
+
@api.should_receive(:post).with("favorites/create", {:id => "1"})
|
22
22
|
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
23
23
|
|
24
24
|
call "#twitter","fav",%w(a)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should post fav by sid" do
|
28
|
-
@api.should_receive(:post).with("favorites/create
|
28
|
+
@api.should_receive(:post).with("favorites/create", {:id => "1"})
|
29
29
|
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
30
30
|
|
31
31
|
call "#twitter","fav",%w(mzp:a)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should post fav by screen name" do
|
35
|
-
@api.should_receive(:post).with("favorites/create
|
35
|
+
@api.should_receive(:post).with("favorites/create", {:id => "1"})
|
36
36
|
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
37
37
|
|
38
38
|
call "#twitter","fav",%w(mzp)
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should post fav by screen name with at" do
|
42
|
-
@api.should_receive(:post).with("favorites/create
|
42
|
+
@api.should_receive(:post).with("favorites/create", {:id => "1"})
|
43
43
|
@channel.should_receive(:notify).with("FAV: mzp: blah blah")
|
44
44
|
|
45
45
|
call "#twitter","fav",%w(@mzp)
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should post unfav" do
|
49
|
-
@api.should_receive(:post).with("favorites/destroy
|
49
|
+
@api.should_receive(:post).with("favorites/destroy", {:id => "1"})
|
50
50
|
@channel.should_receive(:notify).with("UNFAV: mzp: blah blah")
|
51
51
|
|
52
52
|
call "#twitter","unfav",%w(a)
|
data/spec/option_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,6 @@ require 'bundler'
|
|
5
5
|
Bundler.setup
|
6
6
|
Bundler.require :default, :test
|
7
7
|
|
8
|
-
|
9
8
|
require 'atig/monkey'
|
10
9
|
require 'command_helper'
|
11
10
|
|
@@ -15,7 +14,7 @@ RSpec::Matchers.define :be_text do |text|
|
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
|
-
def status(text,opt={})
|
17
|
+
def status(text, opt = {})
|
19
18
|
Atig::TwitterStruct.make(opt.merge('text' => text))
|
20
19
|
end
|
21
20
|
|
@@ -26,10 +25,13 @@ def user(id, name)
|
|
26
25
|
user
|
27
26
|
end
|
28
27
|
|
29
|
-
def entry(user,status,name='entry',id=0)
|
28
|
+
def entry(user, status, name = 'entry', id = 0)
|
30
29
|
entry = stub name
|
31
30
|
entry.stub!('id').and_return(id)
|
32
31
|
entry.stub!('user').and_return(user)
|
33
32
|
entry.stub!('status').and_return(status)
|
34
33
|
entry
|
35
34
|
end
|
35
|
+
|
36
|
+
require 'coveralls'
|
37
|
+
Coveralls.wear!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SHIBATA Hiroshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: coveralls
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: Atig.rb is Twitter Irc Gateway.
|
112
126
|
email:
|
113
127
|
- shibata.hiroshi@gmail.com
|
@@ -118,6 +132,7 @@ extra_rdoc_files: []
|
|
118
132
|
files:
|
119
133
|
- .gitignore
|
120
134
|
- .rspec
|
135
|
+
- .travis.yml
|
121
136
|
- Gemfile
|
122
137
|
- Gemfile.lock
|
123
138
|
- README.mkdn
|
@@ -159,8 +174,6 @@ files:
|
|
159
174
|
- lib/atig/agent/list_status.rb
|
160
175
|
- lib/atig/agent/mention.rb
|
161
176
|
- lib/atig/agent/noretweets.rb
|
162
|
-
- lib/atig/agent/other_list.rb
|
163
|
-
- lib/atig/agent/own_list.rb
|
164
177
|
- lib/atig/agent/stream_follow.rb
|
165
178
|
- lib/atig/agent/timeline.rb
|
166
179
|
- lib/atig/agent/user_stream.rb
|
@@ -300,9 +313,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
300
313
|
version: '0'
|
301
314
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
302
315
|
requirements:
|
303
|
-
- - '
|
316
|
+
- - '>'
|
304
317
|
- !ruby/object:Gem::Version
|
305
|
-
version:
|
318
|
+
version: 1.3.1
|
306
319
|
requirements: []
|
307
320
|
rubyforge_project:
|
308
321
|
rubygems_version: 2.0.3
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
-
|
3
|
-
require 'atig/util'
|
4
|
-
require 'atig/agent/list'
|
5
|
-
|
6
|
-
module Atig
|
7
|
-
module Agent
|
8
|
-
class OtherList < List
|
9
|
-
def entry_points
|
10
|
-
[ "#{@db.me.screen_name}/lists/subscriptions" ]
|
11
|
-
end
|
12
|
-
|
13
|
-
def interval
|
14
|
-
3600
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/atig/agent/own_list.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# -*- mode:ruby; coding:utf-8 -*-
|
2
|
-
|
3
|
-
require 'atig/util'
|
4
|
-
require 'atig/agent/list'
|
5
|
-
|
6
|
-
module Atig
|
7
|
-
module Agent
|
8
|
-
class OwnList < List
|
9
|
-
def entry_points
|
10
|
-
[ "#{@db.me.screen_name}/lists" ]
|
11
|
-
end
|
12
|
-
|
13
|
-
def interval
|
14
|
-
3600
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|