Skip to content

Instantly share code, notes, and snippets.

@tansengming
Last active February 21, 2017 16:11
Show Gist options
  • Save tansengming/29cee3fe5fe15ddc49029afc6e17a82f to your computer and use it in GitHub Desktop.
Save tansengming/29cee3fe5fe15ddc49029afc6e17a82f to your computer and use it in GitHub Desktop.
community.users.each do |recipient|
sms_credits = community.sms_credits
if sms_credits > 0
send_sms recipient, 'Everything is fine.'
# take off a credit
community.sms_credits = sms_credits - 1
community.save
end
end
def send_sms(recipient, message)
# does a REST call to Twilio
# which takes a while
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment