Skip to content

Instantly share code, notes, and snippets.

@johnholdun
Created May 31, 2013 16:15
Show Gist options
  • Save johnholdun/5686082 to your computer and use it in GitHub Desktop.
Save johnholdun/5686082 to your computer and use it in GitHub Desktop.
ids = [329740082619772928, 329918487558504451, 330280700072833026, 330651260321669121, 331023740257325057, 331355726356291585, 331747132803518465, 332093606355664896, 332458504747110401, 332817496753184768, 333183149867667458, 333542218503696384, 333921623436574721, 334270156035469314, 334632030774099969, 335013040451891200, 335369313466871808, 335719753299685376, 336094052749565952, 336461902785966081, 336790999277916162, 337173236968210432, 337529860106878976, 337875782665912320, 338255438862766080, 338630809231708160, 338988045032370177, 339350345010536448, 339714371792035841, 340065176281837569, 340451705298771968]
ids.each do |id|
method = :post
uri = URI "https://api.twitter.com/1.1/favorites/create.json"
params = { id: id, include_entities: false }
request = Net::HTTP::Post.new uri.request_uri
request.set_form_data params
request['Authorization'] = SimpleOAuth::Header.new(method, uri, params, {
consumer_key: CONSUMER_KEY,
consumer_secret: CONSUMER_SECRET,
token: TOKEN,
token_secret: TOKEN_SECRET,
}).to_s
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
response = http.start {|http| http.request(request) }
puts response.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment