Skip to content

Instantly share code, notes, and snippets.

@r3cha
Created December 30, 2022 02:55
Show Gist options
  • Save r3cha/37f7fb9af1609bad53272c75e6d8d6b6 to your computer and use it in GitHub Desktop.
Save r3cha/37f7fb9af1609bad53272c75e6d8d6b6 to your computer and use it in GitHub Desktop.
some code
def perform(url)
return unless url
response = HTTParty.get(url)
return unless response.success?
data = JSON.parse(response.body)
return unless data['results']
data['results'].each do |test|
create_test(test) unless Test.find_by(pgs_id: test['id'])
end
ParsePgsCatalogWorker.perform_async(data['next']) if data['next']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment