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

      if availability = args[:availability]
        availability[:participants] = map_availability_participants(availability[:participants])
        availability[:required_duration] = map_availability_required_duration(availability[:required_duration])

        if value = availability[:start_interval]
          availability[:start_interval] = map_availability_required_duration(value)
        end

        if buffer = availability[:buffer]
          availability[:buffer] = map_availability_buffer(buffer)
        end
      end

      translate_available_periods(availability[:available_periods])
      body[:availability] = availability

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

      if availability = args[:availability]
        availability[:participants] = map_availability_participants(availability[:participants])
        availability[:required_duration] = map_availability_required_duration(availability[:required_duration])

        if value = availability[:start_interval]
          availability[:start_interval] = map_availability_required_duration(value)
        end

        if buffer = availability[:buffer]
          availability[:buffer] = map_availability_buffer(buffer)
        end
      end

      translate_available_periods(availability[:available_periods])
      body[:availability] = availability

      response = raw_post("/v1/real_time_scheduling", body)
      parse_json(AddToCalendarResponse, nil , response)
    end
Public: Generates an real time scheduling 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.
                    :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).
 availability     - A Hash describing the availability details for the event:
                    :participants      - A hash stating who is required for the availability
                                         call
                    :required_duration - A hash stating the length of time the event will
                                         last for
                    :available_periods - A hash stating the available periods for the event
                    :start_interval    - An Integer representing the start interval
                                         of minutes for the availability query.
                    :buffer            - An Hash containing the buffer to apply to
                                         the availability query.
 target_calendars - An array of hashes stating into which calendars to insert the created
                    event

 Examples

 - Availability example
   client.add_to_calendar(
    oauth: {
     redirect_uri: 'http://www.example.com'
    },
    event: {
     event_id: "qTtZdczOccgaPncGJaCiLg",
     summary: "Board meeting",
     description: "Discuss plans for the next quarter.",
     location: {
       description: "Board room",
       lat: "1.2345",
       long: "0.1234"
     }
    },
    availability: {
      participants: [
       {
         members: [{
           sub: "acc_567236000909002",
           calendar_ids: ["cal_n23kjnwrw2_jsdfjksn234"]
         }],
         required: 'all'
       }
     ],
     required_duration: { minutes: 60 },
     available_periods: [{
       start: Time.utc(2017, 1, 1, 9, 00),
       end:   Time.utc(2017, 1, 1, 17, 00),
     }]
    },
    target_calendars: [{
     sub: "acc_567236000909002",
     calendar_id: "cal_n23kjnwrw2_jsdfjksn234"
    }]
   )

 See http://www.cronofy.com/developers/api#real-time-scheduling 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.