szimek-twitter 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History +4 -0
- data/VERSION.yml +1 -1
- data/examples/ids.rb +13 -0
- data/lib/twitter/base.rb +2 -2
- data/lib/twitter/request.rb +3 -2
- data/test/fixtures/follower_ids.json +1 -0
- data/test/fixtures/friend_ids.json +1 -0
- data/test/twitter/base_test.rb +16 -2
- data/test/twitter/request_test.rb +16 -2
- metadata +6 -2
data/History
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
0.6.5 - April 15, 2009
|
2
|
+
* 1 bug fix
|
3
|
+
* fixed that friend_ids and follower_ids were bombing from trying to mash them. Added :mash option to Twitter::Request so I can specifically not mash certain responses from twitter
|
4
|
+
|
1
5
|
0.6.4 - April 14, 2009
|
2
6
|
* 1 minor tweak
|
3
7
|
* More explicit about dependency versions in gemspec and when requiring.
|
data/VERSION.yml
CHANGED
data/examples/ids.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
|
2
|
+
require File.join(File.dirname(__FILE__), 'helpers', 'config_store')
|
3
|
+
require 'pp'
|
4
|
+
|
5
|
+
config = ConfigStore.new("#{ENV['HOME']}/.twitter")
|
6
|
+
|
7
|
+
oauth = Twitter::OAuth.new(config['token'], config['secret'])
|
8
|
+
oauth.authorize_from_access(config['atoken'], config['asecret'])
|
9
|
+
|
10
|
+
client = Twitter::Base.new(oauth)
|
11
|
+
|
12
|
+
puts client.friend_ids
|
13
|
+
puts client.follower_ids
|
data/lib/twitter/base.rb
CHANGED
@@ -86,12 +86,12 @@ module Twitter
|
|
86
86
|
|
87
87
|
# Options: id, user_id, screen_name
|
88
88
|
def friend_ids(query={})
|
89
|
-
perform_get("/friends/ids.json", :query => query)
|
89
|
+
perform_get("/friends/ids.json", :query => query, :mash => false)
|
90
90
|
end
|
91
91
|
|
92
92
|
# Options: id, user_id, screen_name
|
93
93
|
def follower_ids(query={})
|
94
|
-
perform_get("/followers/ids.json", :query => query)
|
94
|
+
perform_get("/followers/ids.json", :query => query, :mash => false)
|
95
95
|
end
|
96
96
|
|
97
97
|
def verify_credentials
|
data/lib/twitter/request.rb
CHANGED
@@ -15,7 +15,7 @@ module Twitter
|
|
15
15
|
def_delegators :client, :get, :post
|
16
16
|
|
17
17
|
def initialize(client, method, path, options={})
|
18
|
-
@client, @method, @path, @options = client, method, path, options
|
18
|
+
@client, @method, @path, @options = client, method, path, {:mash => true}.merge(options)
|
19
19
|
end
|
20
20
|
|
21
21
|
def uri
|
@@ -45,7 +45,8 @@ module Twitter
|
|
45
45
|
|
46
46
|
def make_friendly(response)
|
47
47
|
raise_errors(response)
|
48
|
-
|
48
|
+
data = parse(response)
|
49
|
+
options[:mash] ? mash(data) : data
|
49
50
|
end
|
50
51
|
|
51
52
|
def raise_errors(response)
|
@@ -0,0 +1 @@
|
|
1
|
+
[613,12796,12938,5765,13518,15323,8906,453593,598503,629603,628623,713263,697893,646123,720583,754990,755264,702653,611823,792399,12606,1226011,969631,3038211,2396591,5594932,5891052,5493662,768288,6247142,6609302,6833532,5104571,3672651,19413,7174582,6991162,6806472,6426602,10718,7430672,8396042,1182631,8597622,6845342,8883422,6816462,702613,1156261,9241962,9264222,6738932,9292132,8882412,5784962,79283,9767172,6996312,654653,9864902,8140482,9907312,6469542,874,9885102,1993721,6466022,8616122,7671872,10477902,723873,7821622,9874262,10845072,763224,5803002,12543,10452452,11094492,10560,12661,12741,75413,1714531,779169,13229,3560241,11485452,9733422,9573202,9870612,7152562,3576061,7574002,7808572,12081432,13346,10904502,9861982,482253,12235182,12223582,12515312,12251592,8407962,9255062,12728492,6141442,12750862,12488072,9291992,9390942,12084572,13156282,5790592,12412462,13510782,627303,1254261,616673,6368162,13706912,13782402,99723,12219102,56813,14070811,13826102,8766242,14090477,14094961,14096589,7019942,14099976,8293102,14119520,1328941,14051749,7508082,8095722,10193732,1307011,12707,12156682,6123982,14178038,10824762,11040972,13908992,14199456,10486382,13726052,11562312,6556972,14166387,14227633,3148,4513781,9548262,5840792,14257836,14055920,14262452,659933,10767782,14287223,14288480,652313,637763,66983,7462822,4448101,14332039,12579382,14332997,14287820,8033832,127583,14122477,816954,2477051,14302268,14206126,14378107,7879442,14328574,3628081,14398763,14162251,14377330,14010712,9468052,14221051,14409089,13955252,12681842,937561,14427863,14466143,14062005,14470429,14450143,13499872,14076758,14527633,14234012,960021,14380090,14073831,780561,14563161,14563260,9462972,14590521,1140261,12906952,6836402,1019951,5977,14361042,14588083,10967052,14169810,5462572,14687070,2898661,11946,14676814,14220413,11380312,14655491,7163912,38353,15403,14776551,14789853,14900453,5531452,14250972,5167141,14712637,14886813,14423603,14771453,12982472,14946593,14777840,8494682,1175831,14936183,14415989,2058881,6474562,14984654,13722,14169869,12478292,5467712,586803,10085192,14345945,6651022,8748292,14999286,9929452,1104891,785975,14706300,15033995,9100012,6221832,14140936,14942738,15094584,12350092,15114739,14351457,14798512,15126780,3283321,14073810,9764082,14259623,10733192,1152571,14899320,14367500,14128132,14911154,9371582,8922,15273534,14156043,1768041,15242061,14009722,13108342,75603,15264105,14740219,7758072,15028397,819302,15348010,752673,14543058,1274141,3185531,6306542,13108322,12686592,15375222,15430874,14424415,15352422,14317036,2019081,15491618,15024280,15464324,14168885,808074,15465686,12892292,10037622,15104784,15638865,12093512,14412322,14292165,10572372,12591,14803076,1243511,13971202,5504782,14649039,645353,5743852,13357,15095182,14469207,1585,7606742,790038,2006261,755028,10089142,12885682,15809772,15796373,15845499,15527007,15468368,14802005,15432802,5483162,8409072,1705591,15142405,4670021,14689610,9572062,12601,1000841,14713941,16002464,7219322,14292285,13353212,16143088,16152707,9866922,14205289,16199846,16233822,13602072,15657520,754747,7475362,15040976,50213,12500052,7152,16200523,9741672,16455427,9980812,14590839,14946654,15151626,16381951,16590772,1566201,16568594,16605678,7372912,638323,5715642,16103569,4632211,6446182,15820948,6778152,16661360,14366390,11889272,8070462,65273,14994463,16692958,627033,3732061,10633482,14380132,14943451,12468852,16828265,14402895,5099921,16885851,14675469,16697903,2900941,14451461,1496591,6164712,15778099,14191988,14431413,14182540,15783687,13856062,3791401,15424241,5206801,8905562,10073922,785340,756264,17009966,9723312,17058191,15768409,1676,15770176,14246143,16664183,823615,16987638,15754496,17100288,16011929,5576742,16876792,5815992,7605802,17134532,16033573,15518671,17200223,16918853,6082492,845611,16220947,16734204,6967822,5748162,5812572,16941853,10527202,1004071,10293122,3123671,17188350,17127839,813198,15690398,15377515,14402837,15353105,9492192,15839304,11589532,14816455,17331141,10879162,14116750,11088,15615165,15827231,16493323,6144652,17489546,14541533,17502272,728893,14365840,17503660,15239784,6525062,6148812,9887162,40863,16950740,14642335,14575376,14100886,17477873,14404318,16981333,14957975,10261302,17655861,17365218,3175171,15747123,6915102,7356622,16604035,17428418,14651825,15896029,16577001,1372651,15005954,14265787,14879573,15386336,17816690,16425887,17834170,16684812,149083,17862753,792632,14193132,6051562,17904110,9380652,14381877,2983251,5643432,16205983,14189032,389153,16211186,8126672,15085140,15585336,14223716,14071467,17870682,14409240,17987541,18001148,17985989,15442984,9695352,7939892,18050862,17481197,7617722,14198590,7935042,17037553,6817252,17378007,17938529,14339150,18149901,1684601,6279162,15846853,35953,14384158,9523302,18173702,10319902,14582075,16531891,12357582,18210267,18043449,4584551,774234,16893238,18222267,18222794,15848007,7858242,15948895,18227971,18128544,16472254,17823286,8233892,12581032,799194,33493,785875,12087292,16064905,15012307,14212434,17146581,670653,13999762,17034483,7948072,9700282,766652,16271041,9237312,15454740,6309042,9532132,15701745,14810774,10456332,808549,6154882,12241342,14486918,14606633,11603,9439332,17052841,14512472,14848368,16826149,16831553,13332232,9407382,49873,11115922,14099654,7776092,15868801,12669172,14046670,15196200,15395778,16739253,1663751,2355631,1277191,3659691,18333815,16112732,18353799,16039614,18250230,18073179,18332874,18214919,4628831,16547430,17586908,18413162,7278032,10832,17725290,1388321,1761301,14768495,17136292,14914403,15595306,6466912,2531521,14422605,828881,10255262,735053,57753,17232987,16798806,11923112,17988073,18044614,12436422,13439,17905573,18483916,17537056,15797213,18470553,18529984,643463,18571972,18575796,18594356,18607270,5218641,13560862,14974634,14464047,17999470,625943,14474670,18526656,14273725,14579367,14803587,18173533,17643364,10415882,809693,15558320,18674931,7018532,9360872,16481323,10286,6258202,10075872,893111,14093286,5533332,2550611,17009251,14281860,14641005,6730622,16452903,2738011,7839552,18597832,18700008,15905871,5933482,16840273,16736196,12321122,12270222,18833825,18834036,18332117,2883681,15697354,18852714,722103,16859405,18669941,668523,2049071,18879392,18631418,814580,16751180,18927092,17236341,18936955,18936577,10423432,17005083,18483113,15776217,15683541,14952014,18913504,6087472,1505961,18016189,18598615,14335551,17658632,18658388,14234004,2778231,8910282,15609931,14247987,649823,18883909,14281405,10324882,9675652,15320102,17498367,18390929,15315836,12474212,9988852,19158240,16419355,183813,15257407,14297166,19113783,16440108,12743592,18664783,9453872,16204699,15020118,14345587,780429,5969702,7219042,14948485,17620522,14671169,16680410,19353133,17994112,17429908,14908912,19600123,18170649,14748148,14571331,17229194,5457352,48773,19679367,9397012,15382766,16343513,14911144,17395851,15533248,17076389,9358602,16406528,18099640,17767547,19670419,18096662,17822704,14293292,6893792,53533,19795241,18110885,19810631,19827904,17558167,5117751,15638508,14926752,14149756,19634908,4468761,14567574,19948841,19954092,11835742,19938151,18423380,15904774,17560204,15074377,19231436,14165452,14469692,19036617,18807589,19788955,4080231,12920142,15399430,19578455,19482274,16996285,16259172,17667997,15203555,18214599,18781842,16621912,15479835,2202971,14410783,19736005,15135447,20163695,900601,6823692,292343,20131136,16808303,19978953,19547434,1089691,15871043,18809171,20609277,3560581,17432169,19691213,18098007,15417592,17833536,15177003,14381339,14194819,15407324,16731023,17149004,18491112,13972462,12370632,20067154,19073088,14127807,20553221,15107495,19851613,19870989,20420301,20681696,2148071,20100721,14633348,5573992,20705043,635793,10785892,20402565,14565733,20098787,20021607,15874552,20729126,21181647,18180272,14978802,18323749,7140702,18178441,21310249,15751895,5447882,19711370,18478757,2819,21278339,15442621,16301737,15070016,21320738,8348382,18600952,13770172,1649221,18360116,18276818,19900631,21379159,19935253,18737620,15195247,14658472,364,6813682,13074,1623,15000151,16912019,15235415,14101380,16599558,19037300,12687402,16889733,857501,19821374,1092621,21683201,20758237,12981172,19781549,20222971,15389148,12226202,14875570,17892372,5502392,843551,21804545,15723434,18391040,19292759,3286561,774060,14796100,12099752,18787589,13959242,10275892,629743,18234697,2230561,22072861,18670512,18820221,22300190,22340666,18216320,22400526,22431378,20899175,6330782,16883585,15935078,1364461,6179812,20589092,22508751,16933064,13183022,9808812,21062351,18381622,17183132,19018761,15899431,16188278,5661552,173813,15533585,22744648,22068050,22780485,20782318,60173,65583,22251010,21407715,5847082,18577007,15213923,22648234,18891726,15348242,2221741,19762959,17073317,22391658,19507837,17938747,5490442,22602883,20118508,13015632,19587710,15408479,23344603,17151343,14675249,15503518,22568737,18430448,18427032,23545306,23573979,7876602,11844,23221906,19193268,21311227,21634137,15458901,14714195,17788144,16927093,17450808,23713422,16467378,18642131,717233,10936152,23482614,19608005,23783966,19041419,13649,21328766,21203364,24187338,21884359,17192822,22128553,24257748,22132860,8868052,17879103,22593469,24204485,14660636,20857214,23501805,24347906,24567825,22294133,20089217,14262730,20987428,18588717,9922002,21980551,11905432,15492087,17067434,24851973,24677391,16822505,15917082,22224252,23923379,19288013,18402842,8274972,25121859,24833951,24888158,25241640,22232760,18893301,15644361,2633481,22660688,24562858,18755300,23567427,25566300,25569710,14464510,25745097,23751200,25817409,25259149,24622977,16401257,14882304,25771412,19388022,21922054,25542506,25599456,25782929,24801749,25538391,16651984,17834535,26040534,753973,26297795,15605658,16823020,19956062,16794261,13422802,26779699,21743486,14319649,25535757,26931958,26579479,7124752,25059528,3054021,25692022,8328752,17911850,15441990,6660852,17012066,27389560,25564238,22783131,27494001,27458253,7362512,21980433,14397705,18152191,14737211,44883,27809050,12125972,15558717,27838986,27117081,16651813,21723920,27862035,14452237,27406847,18630290,15344521,24496939,22762300,14879654,25107835,7888382,1011261,15518890,17487435,14131856,28279311,12384042,21721761,12480492,28532385,21380989,28468396,28504645,15919836,28793082,28816818,5857812,19498371,28912805,28956077,26423794,22239593,18425965,25147645,26723451,1087421,14212679,29380265,29398462,770952,22916479,20017276,19534762,10316422,936161,25097218,5538522,16344576,2819741,30440861,30514010,29775532,2071301,27839741,28711633,28210955,29374100,31023933,14798962,24529511,28983323,31438725,22543443,3636011,15376537]
|
@@ -0,0 +1 @@
|
|
1
|
+
[15323,12796,18713,697893,598503,13518,12938,10718,616163,8906,713263,792399,246,780561,658343,3038211,790205,46413,7124752,3672651,1182631,8883422,9264222,6738932,9907312,9885102,717233,5784962,12661,75413,779169,12543,9241962,12741,6186692,12707,38353,5502392,1714531,3560241,11485452,761613,10193732,482253,12235182,6141442,8028152,627303,13782402,13826102,14094961,14096589,14119520,20,14257836,14262452,8616122,14288480,1768041,14763,12196,14122477,1140261,6707392,654653,937561,33493,9929452,5877822,14246143,14561327,3191321,6927562,12591,615403,9941002,12047992,15403,676573,8494682,9887162,2058881,5444392,127583,14973933,15033995,14351457,14740219,613,819302,752673,25993,808074,14482752,11132462,13108342,2006261,16143088,9572062,14398763,10486382,56813,12081432,13108322,13722,6474562,2049071,4037,9980812,14080083,14372143,8033832,16623244,16623407,13560862,12081692,65273,624683,16828397,16893238,14380132,784171,54793,6082492,6556972,17058191,11294,15005954,6967822,845611,13856062,14994463,15432802,1104891,7846,5812572,17311462,6446182,792632,14365840,18222794,18227971,14345587,15948437,657863,17889970,17667997,18660239,17461978,3286561,5391882,19058681,11718,22391658,14522546,17919972,25745097,19483147,13334762,16373523,20017276]
|
data/test/twitter/base_test.rb
CHANGED
@@ -62,7 +62,7 @@ class BaseTest < Test::Unit::TestCase
|
|
62
62
|
user.name.should == 'John Nunemaker'
|
63
63
|
user.id.should == 4243
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
should "be able to get friends timeline" do
|
67
67
|
stub_get('/statuses/friends_timeline.json', 'friends_timeline.json')
|
68
68
|
timeline = @twitter.friends_timeline
|
@@ -107,11 +107,25 @@ class BaseTest < Test::Unit::TestCase
|
|
107
107
|
first.text.should == '@jnunemaker cold out today. cold yesterday. even colder today.'
|
108
108
|
end
|
109
109
|
|
110
|
+
should "be able to get follower ids" do
|
111
|
+
stub_get('/followers/ids.json', 'follower_ids.json')
|
112
|
+
follower_ids = @twitter.follower_ids
|
113
|
+
follower_ids.size.should == 1252
|
114
|
+
follower_ids.first.should == 613
|
115
|
+
end
|
116
|
+
|
117
|
+
should "be able to get friend ids" do
|
118
|
+
stub_get('/friends/ids.json', 'friend_ids.json')
|
119
|
+
friend_ids = @twitter.friend_ids
|
120
|
+
friend_ids.size.should == 161
|
121
|
+
friend_ids.first.should == 15323
|
122
|
+
end
|
123
|
+
|
110
124
|
should "correctly hash statuses" do
|
111
125
|
stub_get('/statuses/friends_timeline.json', 'friends_timeline.json')
|
112
126
|
hashes = @twitter.friends_timeline.map{ |s| s.hash }
|
113
127
|
hashes.should == @twitter.friends_timeline.map{ |s| s.hash }
|
114
|
-
end
|
128
|
+
end
|
115
129
|
end
|
116
130
|
end
|
117
131
|
end
|
@@ -20,7 +20,7 @@ class RequestTest < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
should "have options" do
|
23
|
-
@request.options.should == {:
|
23
|
+
@request.options[:query].should == {:since_id => 1234}
|
24
24
|
end
|
25
25
|
|
26
26
|
should "have uri" do
|
@@ -60,7 +60,7 @@ class RequestTest < Test::Unit::TestCase
|
|
60
60
|
@object.class.should be(Mash)
|
61
61
|
@object.text.should == 'Rob Dyrdek is the funniest man alive. That is all.'
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
64
64
|
|
65
65
|
context "with no query string" do
|
66
66
|
should "not have any query string" do
|
@@ -200,4 +200,18 @@ class RequestTest < Test::Unit::TestCase
|
|
200
200
|
}.should raise_error(Twitter::Unavailable)
|
201
201
|
end
|
202
202
|
end
|
203
|
+
|
204
|
+
context "Making request with mash option set to false" do
|
205
|
+
setup do
|
206
|
+
oauth = Twitter::OAuth.new('token', 'secret')
|
207
|
+
oauth.authorize_from_access('atoken', 'asecret')
|
208
|
+
@client = Twitter::Base.new(oauth)
|
209
|
+
end
|
210
|
+
|
211
|
+
should "not attempt to create mash of return object" do
|
212
|
+
stub_get('http://twitter.com:80/foo', 'friend_ids.json')
|
213
|
+
object = Twitter::Request.get(@client, '/foo', :mash => false)
|
214
|
+
object.class.should_not be(Mash)
|
215
|
+
end
|
216
|
+
end
|
203
217
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: szimek-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-16 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- examples/friendship_existance.rb
|
112
112
|
- examples/helpers/config_store.rb
|
113
113
|
- examples/httpauth.rb
|
114
|
+
- examples/ids.rb
|
114
115
|
- examples/search.rb
|
115
116
|
- examples/timeline.rb
|
116
117
|
- examples/update.rb
|
@@ -126,6 +127,8 @@ files:
|
|
126
127
|
- lib/twitter/request.rb
|
127
128
|
- lib/twitter/search.rb
|
128
129
|
- test/fixtures/firehose.json
|
130
|
+
- test/fixtures/follower_ids.json
|
131
|
+
- test/fixtures/friend_ids.json
|
129
132
|
- test/fixtures/friends_timeline.json
|
130
133
|
- test/fixtures/rate_limit_exceeded.json
|
131
134
|
- test/fixtures/replies.json
|
@@ -185,3 +188,4 @@ test_files:
|
|
185
188
|
- examples/httpauth.rb
|
186
189
|
- examples/timeline.rb
|
187
190
|
- examples/helpers/config_store.rb
|
191
|
+
- examples/ids.rb
|