annotate app/lib/clients.rb @ 220:0e15b4db2da8

Remove unused variable
author nanaya <me@nanaya.pro>
date Thu, 27 May 2021 02:31:31 +0900
parents 17461f7682a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
219
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
1 class Clients
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
2 def self.client_options(id)
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
3 {
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
4 :timeouts => {
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
5 :connect => 5,
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
6 :read => 5,
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
7 :write => 5,
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
8 },
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
9 }.merge $cfg[:twitter][id]
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
10 end
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
11
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
12 def self.instance
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
13 @@instance ||= self.new
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
14 end
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
15
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
16 def initialize
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
17 @clients = {}
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
18 end
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
19
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
20 def get(id)
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
21 @clients[id] ||= Twitter::REST::Client.new(self.class.client_options id)
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
22 end
17461f7682a2 One client for everyone
nanaya <me@nanaya.pro>
parents:
diff changeset
23 end