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, opts = {}, &block) ⇒ Object
Methods inherited from BasicTwitter
Constructor Details
Class Method Details
.http_methods(*methods) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/atig/twitter.rb', line 29 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, opts = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/atig/twitter.rb', line 15 def page(path, name, opts = {}, &block) limit = 0.98 * @remain # 98% of IP based rate limit r = [] cursor = -1 1.upto(limit) do |num| = {:cursor => cursor}.merge(opts) ret = api(path, , { :authenticate => true }) r.concat ret[name] cursor = ret[:next_cursor] break if cursor.zero? end r end |