簡體   English   中英

Ruby:如何將選項傳遞給 twitter gem 的 user_timeline 方法?

[英]Ruby: How to pass options to user_timeline method of twitter gem?

我正在使用sferik gem來獲取推文。

我想將以下額外參數傳遞給方法“user_timeline”:

計數,include_rts 和 exclude_reply

是否可以將這些作為參數傳遞?

如果是,我如何將這些額外的參數傳遞給“user_timeline”方法並根據這些額外的參數獲得適當的響應?

謝謝您的幫助!!

此處查看文檔。 您應該能夠像這樣傳遞受支持的選項:

user_timeline(your_user, {
 :include_rts => true,
 :exclude_replies => true,
 :count => 42 
})

更新正如@mudasobwa 在評論中正確指出的那樣,如果您使用的是ruby 1.9+ ,則可以使用以下更簡單的語法:

user_timeline(your_user, include_rts: true, exclude_replies: true, count: 42)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM