Class: Atig::Twitter
- Inherits:
-
BasicTwitter
- Object
- BasicTwitter
- Atig::Twitter
- Defined in:
- lib/atig/twitter.rb
Overview
from tig.rb
Instance Attribute Summary
Attributes inherited from BasicTwitter
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context, oauth) ⇒ Twitter
constructor
A new instance of Twitter.
-
#page(path, name, authenticate = true, &block) ⇒ Object
authenticate = trueでないとSSL verified errorがでることがある.
Methods inherited from BasicTwitter
Constructor Details
Class Method Details
.http_methods(*methods) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/atig/twitter.rb', line 31 def self.http_methods(*methods) methods.each do |m| self.module_eval <<END def #{m}(path, query = {}, opts = {}) opts.update( :method => :#{m}) api path, query, opts end END end end |
Instance Method Details
#page(path, name, authenticate = true, &block) ⇒ Object
authenticate = trueでないとSSL verified errorがでることがある
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/atig/twitter.rb', line 16 def page(path, name, authenticate = true, &block) limit = 0.98 * @remain # 98% of IP based rate limit r = [] cursor = -1 1.upto(limit) do |num| # next_cursor にアクセスするとNot found が返ってくることがあるので,その時はbreak ret = api(path, { :cursor => cursor }, { :authenticate => authenticate }) rescue break arr = ret[name.to_s] r.concat arr cursor = ret[:next_cursor] break if cursor.zero? end r end |