def add_to_calendar(args = {})
      body = args.merge(client_id: @client_id, client_secret: @client_secret)

      body[:event][:start] = encode_event_time(body[:event][:start])
      body[:event][:end] = encode_event_time(body[:event][:end])

      response = post("/v1/add_to_calendar", body)
      parse_json(AddToCalendarResponse, nil , response)
    end
def add_to_calendar(args = {})
      body = args.merge(client_id: @client_id, client_secret: @client_secret)

      body[:event][:start] = encode_event_time(body[:event][:start])
      body[:event][:end] = encode_event_time(body[:event][:end])

      response = post("/v1/add_to_calendar", body)
      parse_json(AddToCalendarResponse, nil , response)
    end
Public: Generates an add to calendar link to start the OAuth process with
 an event to be automatically upserted

 oauth            - A Hash describing the OAuth flow required:
                    :scope             - A String representing the scopes to ask for
                                         within the OAuth flow
                    :redirect_uri      - A String containing a url to redirect the
                                         user to after completing the OAuth flow.
                    :scope             - A String representing additional state to
                                         be passed within the OAuth flow.

 event            - A Hash describing the event with symbolized keys:
                    :event_id          - A String uniquely identifying the event for
                                         your application (note: this is NOT an ID
                                         generated by Cronofy).
                    :summary           - A String to use as the summary, sometimes
                                         referred to as the name or title, of the
                                         event.
                    :description       - A String to use as the description, sometimes
                                         referred to as the notes or body, of the
                                         event.
                    :start             - The Time or Date the event starts.
                    :end               - The Time or Date the event ends.
                    :url               - The URL associated with the event.
                    :location          - A Hash describing the location of the event
                                         with symbolized keys (optional):
                                         :description - A String describing the
                                                        location.
                                         :lat - A String of the location's latitude.
                                         :long - A String of the location's longitude.
                    :reminders         - An Array of Hashes describing the desired
                                         reminders for the event. Reminders should be
                                         specified in priority order as, for example,
                                         when the underlying provider only supports a
                                         single reminder then the first reminder will
                                         be used.
                                         :minutes - An Integer specifying the number
                                                    of minutes before the start of the
                                                    event that the reminder should
                                                    occur.
                    :transparency      - The transparency state for the event (optional).
                                         Accepted values are "transparent" and "opaque".
                    :attendees         - A Hash of :invite and :reject, each of which is
                                         an array of invitees to invite to or reject from
                                         the event. Invitees are represented by a hash of
                                         :email and :display_name (optional).

 Example

   client.add_to_calendar(
    oauth: {
      scopes: 'read_events delete_events',
      redirect_uri: 'http://www.example.com',
      state: 'example_state'
    },
    event: {
     event_id: "qTtZdczOccgaPncGJaCiLg",
     summary: "Board meeting",
     description: "Discuss plans for the next quarter.",
     start: Time.utc(2014, 8, 5, 15, 30),
     end:   Time.utc(2014, 8, 5, 17, 30),
     location: {
       description: "Board room",
       lat: "1.2345",
       long: "0.1234"
     })

 See http://www.cronofy.com/developers/api#upsert-event for reference.

 Returns a AddToCalendarResponse.

 Raises Cronofy::CredentialsMissingError if no credentials available.
 Raises Cronofy::AuthenticationFailureError if the access token is no
 longer valid.
 Raises Cronofy::AuthorizationFailureError if the access token does not
 include the required scope.
 Raises Cronofy::NotFoundError if the calendar does not exist.
 Raises Cronofy::InvalidRequestError if the request contains invalid
 parameters.
 Raises Cronofy::TooManyRequestsError if the request exceeds the rate
 limits for the application.