Skip to content

Instantly share code, notes, and snippets.

@hramos
Created December 12, 2011 03:30
Show Gist options
  • Save hramos/1464620 to your computer and use it in GitHub Desktop.
Save hramos/1464620 to your computer and use it in GitHub Desktop.
Create new Parse object with Date property
APPLICATION_ID = ENV['PARSE_APPLICATION_ID']
MASTER_KEY = ENV['PARSE_MASTER_KEY']
someDateTime = Time.new
ddYear = someDateTime.year
ddMonth = "%02d" % someDateTime.month
ddDay = "%02d" % someDateTime.day
curl_command = "curl --user #{APPLICATION_ID}:#{MASTER_KEY} -X POST -H \"Content-Type: application/json\" -d \'{\"someDate\":{\"__type\": \"Date\", \"iso\": \"#{ddYear}-#{ddMonth}-#{ddDay}T12:00:00.000Z\"},\"someIdentifier\":\"51\"}\' https://api.parse.com/1/classes/MyParseClassObject"
new_object = `#{curl_command}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment