Class: Basecamp::Services::SchedulesService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/basecamp/generated/services/schedules_service.rb

Overview

Service for Schedules operations

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Basecamp::Services::BaseService

Instance Method Details

#create_entry(schedule_id:, summary:, starts_at:, ends_at:, description: nil, participant_ids: nil, all_day: nil, notify: nil, subscriptions: nil, visible_to_clients: nil) ⇒ Hash

Create a new schedule entry

Parameters:

  • schedule_id (Integer)

    schedule id ID

  • summary (String)

    summary

  • starts_at (String)

    starts at (RFC3339 (e.g., 2024-12-15T09:00:00Z))

  • ends_at (String)

    ends at (RFC3339 (e.g., 2024-12-15T09:00:00Z))

  • description (String, nil) (defaults to: nil)

    description

  • participant_ids (Array, nil) (defaults to: nil)

    participant ids

  • all_day (Boolean, nil) (defaults to: nil)

    all day

  • notify (Boolean, nil) (defaults to: nil)

    notify

  • subscriptions (Array, nil) (defaults to: nil)

    subscriptions

  • visible_to_clients (Boolean, nil) (defaults to: nil)

    visible to clients

Returns:

  • (Hash)

    response data



87
88
89
90
91
# File 'lib/basecamp/generated/services/schedules_service.rb', line 87

def create_entry(schedule_id:, summary:, starts_at:, ends_at:, description: nil, participant_ids: nil, all_day: nil, notify: nil, subscriptions: nil, visible_to_clients: nil)
  with_operation(service: "schedules", operation: "create_entry", is_mutation: true, resource_id: schedule_id) do
    http_post("/schedules/#{schedule_id}/entries.json", body: compact_params(summary: summary, starts_at: starts_at, ends_at: ends_at, description: description, participant_ids: participant_ids, all_day: all_day, notify: notify, subscriptions: subscriptions, visible_to_clients: visible_to_clients)).json
  end
end

#get(schedule_id:) ⇒ Hash

Get a schedule

Parameters:

  • schedule_id (Integer)

    schedule id ID

Returns:

  • (Hash)

    response data



48
49
50
51
52
# File 'lib/basecamp/generated/services/schedules_service.rb', line 48

def get(schedule_id:)
  with_operation(service: "schedules", operation: "get", is_mutation: false, resource_id: schedule_id) do
    http_get("/schedules/#{schedule_id}").json
  end
end

#get_entry(entry_id:) ⇒ Hash

Get a single schedule entry by id.

Parameters:

  • entry_id (Integer)

    entry id ID

Returns:

  • (Hash)

    response data



13
14
15
16
17
# File 'lib/basecamp/generated/services/schedules_service.rb', line 13

def get_entry(entry_id:)
  with_operation(service: "schedules", operation: "get_entry", is_mutation: false, resource_id: entry_id) do
    http_get("/schedule_entries/#{entry_id}").json
  end
end

#get_entry_occurrence(entry_id:, date:) ⇒ Hash

Get a specific occurrence of a recurring schedule entry

Parameters:

  • entry_id (Integer)

    entry id ID

  • date (String)

    date ID

Returns:

  • (Hash)

    response data



39
40
41
42
43
# File 'lib/basecamp/generated/services/schedules_service.rb', line 39

def get_entry_occurrence(entry_id:, date:)
  with_operation(service: "schedules", operation: "get_entry_occurrence", is_mutation: false, resource_id: entry_id) do
    http_get("/schedule_entries/#{entry_id}/occurrences/#{date}").json
  end
end

#list_entries(schedule_id:, status: nil) ⇒ Enumerator<Hash>

List entries on a schedule

Parameters:

  • schedule_id (Integer)

    schedule id ID

  • status (String, nil) (defaults to: nil)

    active|archived|trashed

Returns:

  • (Enumerator<Hash>)

    paginated results



68
69
70
71
72
73
# File 'lib/basecamp/generated/services/schedules_service.rb', line 68

def list_entries(schedule_id:, status: nil)
  wrap_paginated(service: "schedules", operation: "list_entries", is_mutation: false, resource_id: schedule_id) do
    params = compact_query_params(status: status)
    paginate("/schedules/#{schedule_id}/entries.json", params: params)
  end
end

#update_entry(entry_id:, summary: nil, starts_at: nil, ends_at: nil, description: nil, participant_ids: nil, all_day: nil, notify: nil) ⇒ Hash

Update an existing schedule entry

Parameters:

  • entry_id (Integer)

    entry id ID

  • summary (String, nil) (defaults to: nil)

    summary

  • starts_at (String, nil) (defaults to: nil)

    starts at (RFC3339 (e.g., 2024-12-15T09:00:00Z))

  • ends_at (String, nil) (defaults to: nil)

    ends at (RFC3339 (e.g., 2024-12-15T09:00:00Z))

  • description (String, nil) (defaults to: nil)

    description

  • participant_ids (Array, nil) (defaults to: nil)

    participant ids

  • all_day (Boolean, nil) (defaults to: nil)

    all day

  • notify (Boolean, nil) (defaults to: nil)

    notify

Returns:

  • (Hash)

    response data



29
30
31
32
33
# File 'lib/basecamp/generated/services/schedules_service.rb', line 29

def update_entry(entry_id:, summary: nil, starts_at: nil, ends_at: nil, description: nil, participant_ids: nil, all_day: nil, notify: nil)
  with_operation(service: "schedules", operation: "update_entry", is_mutation: true, resource_id: entry_id) do
    http_put("/schedule_entries/#{entry_id}", body: compact_params(summary: summary, starts_at: starts_at, ends_at: ends_at, description: description, participant_ids: participant_ids, all_day: all_day, notify: notify)).json
  end
end

#update_settings(schedule_id:, include_due_assignments:) ⇒ Hash

Update schedule settings

Parameters:

  • schedule_id (Integer)

    schedule id ID

  • include_due_assignments (Boolean)

    include due assignments

Returns:

  • (Hash)

    response data



58
59
60
61
62
# File 'lib/basecamp/generated/services/schedules_service.rb', line 58

def update_settings(schedule_id:, include_due_assignments:)
  with_operation(service: "schedules", operation: "update_settings", is_mutation: true, resource_id: schedule_id) do
    http_put("/schedules/#{schedule_id}", body: compact_params(include_due_assignments: include_due_assignments)).json
  end
end