Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseError #50

Closed
smilansky opened this issue Dec 5, 2014 · 5 comments
Closed

parseError #50

smilansky opened this issue Dec 5, 2014 · 5 comments

Comments

@smilansky
Copy link

I am getting the following error when trying to create an event like this:

    calendar.create_event do |e|
      e.title = "Initial consultation with #{params[:name]}"
      e.location = "Skype handle - #{params[:skype]}"
      e.description = "#{params[:name]} requested an appointment: 
      \nPhone Number: #{params[:phone_number]}
      Email: #{params[:email]}  
      Notes: #{params[:notes]}"
      e.start_time = appointment_time
      e.end_time = appointment_time + (30 * 60)
    end 
{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "parseError",
    "message": "Parse Error"
   }
  ],
  "code": 400,
  "message": "Parse Error"
 }
}

I don't get the error when I omit the description and location fields. Did the API change the way they parse strings?

@szich
Copy link
Member

szich commented Dec 6, 2014

Yep, we switched from Nokogiri to Json. What are the value of params[:slype] and params[:name]?

@smilansky
Copy link
Author

They are '1' and '1', but were failing on other values too. I isolated the error to the description - when I stripped description from the event creation, it always created the event.

@szich
Copy link
Member

szich commented Dec 8, 2014

JSON like newlines as either \n or \r\n for *nix or windows respectively.

This works:

params = {}
params[:name] = '1'
params[:skype] = '1'
params[:phone_number] = '1-800.555.1212'
params[:email] = '[email protected]'
params[:notes] = 'These are some notes.'
appointment_time = Time.now

event = gc.create_event do |e|
  e.title = "Initial consultation with #{params[:name]}"
  e.location = "Skype handle - #{params[:skype]}"
  e.description = "#{params[:name]} requested an appointment: \\nPhone Number: #{params[:phone_number]} \\nEmail: #{params[:email]}  \\nNotes: #{params[:notes]}"
  e.start_time = appointment_time
  e.end_time = appointment_time + (30 * 60)
end 

puts event

I would like to improve our parsing so it does this conversion automatically. However, I don't have time to implement a fix right now. if this is something you need immediately it would be great if you could submit a pull request.

@mrjcleaver
Copy link

Looks like what I just did in #81

@szich
Copy link
Member

szich commented Oct 3, 2015

I'm closing this issue as #81 more correctly describes the issue.

@szich szich closed this as completed Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants