class Cronofy::Client::BatchBuilder

Public Class Methods

new() click to toggle source
# File lib/cronofy/client.rb, line 336
def initialize
  @entries = []
end

Public Instance Methods

add_entry(args) click to toggle source
# File lib/cronofy/client.rb, line 359
def add_entry(args)
  @entries << BatchEntryRequest.new(args)
  nil
end
build() click to toggle source
# File lib/cronofy/client.rb, line 364
def build
  @entries.dup
end
create_or_update_event(calendar_id, event)
Alias for: upsert_event
delete_event(calendar_id, event_id) click to toggle source
# File lib/cronofy/client.rb, line 351
def delete_event(calendar_id, event_id)
  delete "/v1/calendars/#{calendar_id}/events", event_id: event_id
end
delete_external_event(calendar_id, event_uid) click to toggle source
# File lib/cronofy/client.rb, line 355
def delete_external_event(calendar_id, event_uid)
  delete "/v1/calendars/#{calendar_id}/events", event_uid: event_uid
end
upsert_event(calendar_id, event) click to toggle source
# File lib/cronofy/client.rb, line 340
def upsert_event(calendar_id, event)
  data = event.dup

  data[:start] = encode_event_time(data[:start])
  data[:end] = encode_event_time(data[:end])

  post "/v1/calendars/#{calendar_id}/events", data
end
Also aliased as: create_or_update_event

Private Instance Methods

delete(relative_url, data) click to toggle source
# File lib/cronofy/client.rb, line 370
def delete(relative_url, data)
  add_entry(method: "DELETE", relative_url: relative_url, data: data)
end
post(relative_url, data) click to toggle source
# File lib/cronofy/client.rb, line 374
def post(relative_url, data)
  add_entry(method: "POST", relative_url: relative_url, data: data)
end