Class: Timekit::Event::Client

Inherits:
Client
  • Object
show all
Defined in:
lib/timekit/event/client.rb

Overview

Client class for the event resource

Constant Summary collapse

API_PATH =
'/events'

Instance Method Summary collapse

Methods inherited from Client

#initialize

Constructor Details

This class inherits a constructor from Timekit::Client

Instance Method Details

#create(event_start, event_end, what, where, calendar_id, participants = nil, invite = nil, description = nil, sync_provider = nil, my_rsvp = nil, all_day = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/timekit/event/client.rb', line 22

def create(
  event_start,
  event_end,
  what,
  where,
  calendar_id,
  participants = nil,
  invite = nil,
  description = nil,
  sync_provider = nil,
  my_rsvp = nil,
  all_day = nil
)

  params = {
    start: event_start,
    end: event_end,
    what: what,
    where: where,
    calendar_id: calendar_id
  }

  params = set_optional_params(
    binding,
    %i[
      participants
      invite
      description
      my_rsvp
      sync_provider
      all_day
    ],
    params
  )

  post(API_PATH, params)
end

#delete(id) ⇒ Object



87
88
89
# File 'lib/timekit/event/client.rb', line 87

def delete(id)
  super(API_PATH + '/' + id.to_s)
end

#list(start_datetime, end_datetime) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/timekit/event/client.rb', line 9

def list(start_datetime, end_datetime)
  params = {
    start: start_datetime,
    end: end_datetime
  }

  get(API_PATH, params)
end

#show(id) ⇒ Object



18
19
20
# File 'lib/timekit/event/client.rb', line 18

def show(id)
  get(API_PATH + '/' + id.to_s)
end

#update(id, event_start = nil, event_end = nil, what = nil, where = nil, participants = nil, all_day = nil) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/timekit/event/client.rb', line 60

def update(
  id,
  event_start = nil,
  event_end = nil,
  what = nil,
  where = nil,
  participants = nil,
  all_day = nil
)
  params = {}
  params[:start] = event_start if event_start
  params[:end] = event_end if event_end

  params = set_optional_params(
    binding,
    %i[
      what
      where
      participants
      all_day
    ],
    params
  )

  put(API_PATH + '/' + id.to_s, params)
end