Created
April 9, 2020 07:48
-
-
Save fukayatsu/60850532bc8b4c64222ce3f51f1f21a6 to your computer and use it in GitHub Desktop.
Fetch all posts in the team using esa-ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'esa' | |
client = Esa::Client.new(access_token: "***", current_team: 'foo') | |
since_number = 0 | |
loop do | |
posts = client.posts(q: "sort:number-asc number:>#{since_number}", per_page: 100).body['posts'] | |
break if posts.empty? | |
puts "number: #{posts.first['number']}~#{posts.last['number']}" | |
# Your code goes here | |
since_number = posts.last['number'] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment