Class: Calendly::Event

Inherits:
Object
  • Object
show all
Includes:
ModelUtils
Defined in:
lib/calendly/models/event.rb

Overview

Calendly’s event model. A meeting that has been scheduled.

Constant Summary collapse

UUID_RE =
%r{\A#{Client::API_HOST}/scheduled_events/(#{UUID_FORMAT})\z}.freeze
TIME_FIELDS =
%i[start_time end_time created_at updated_at].freeze

Constants included from ModelUtils

ModelUtils::UUID_FORMAT

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ModelUtils

#client, #id, included, #initialize, #inspect

Instance Attribute Details

#cancellationCalendly::InviteeCancellation

Provides data pertaining to the cancellation of the Invitee.



59
60
61
# File 'lib/calendly/models/event.rb', line 59

def cancellation
  @cancellation
end

#created_atTime

Moment when user record was first created.

Returns:

  • (Time)


47
48
49
# File 'lib/calendly/models/event.rb', line 47

def created_at
  @created_at
end

#end_timeTime

Moment when event is (or was) scheduled to end.

Returns:

  • (Time)


43
44
45
# File 'lib/calendly/models/event.rb', line 43

def end_time
  @end_time
end

#event_guestsArray<Calendly::Guest>

Additional people added to an event by an invitee.

Returns:



75
76
77
# File 'lib/calendly/models/event.rb', line 75

def event_guests
  @event_guests
end

#event_membershipsArray<Calendly::User>

Event membership list.

Returns:



71
72
73
# File 'lib/calendly/models/event.rb', line 71

def event_memberships
  @event_memberships
end

#event_typeCalendly::EventType

Reference to Event Type associated with this event.

Returns:



55
56
57
# File 'lib/calendly/models/event.rb', line 55

def event_type
  @event_type
end

#invitees_counterCalendly::InviteesCounter

invitees counter.



63
64
65
# File 'lib/calendly/models/event.rb', line 63

def invitees_counter
  @invitees_counter
end

#locationCalendly::Location

location in this event.

Returns:



67
68
69
# File 'lib/calendly/models/event.rb', line 67

def location
  @location
end

#nameString

Name of the event.

Returns:

  • (String)


31
32
33
# File 'lib/calendly/models/event.rb', line 31

def name
  @name
end

#start_timeTime

Moment when event is (or was) scheduled to begin.

Returns:

  • (Time)


39
40
41
# File 'lib/calendly/models/event.rb', line 39

def start_time
  @start_time
end

#statusString

Whether the event is active or canceled.

Returns:

  • (String)


35
36
37
# File 'lib/calendly/models/event.rb', line 35

def status
  @status
end

#updated_atTime

Moment when user record was last updated.

Returns:

  • (Time)


51
52
53
# File 'lib/calendly/models/event.rb', line 51

def updated_at
  @updated_at
end

#uriString

Canonical resource reference.

Returns:

  • (String)


27
28
29
# File 'lib/calendly/models/event.rb', line 27

def uri
  @uri
end

#uuidString

unique id of the Event object.

Returns:

  • (String)


23
24
25
# File 'lib/calendly/models/event.rb', line 23

def uuid
  @uuid
end

Class Method Details

.associationObject



11
12
13
14
15
16
17
18
19
# File 'lib/calendly/models/event.rb', line 11

def self.association
  {
    event_type: EventType,
    event_guests: Guest,
    cancellation: InviteeCancellation,
    invitees_counter: InviteesCounter,
    location: Location
  }
end

Instance Method Details

#cancel(options: nil) ⇒ Calendly::InviteeCancellation

Cancels specified event.

Parameters:

  • options (Hash) (defaults to: nil)

    the optional request parameters. Optional.

Options Hash (options:):

  • :reason (String)

    reason for cancellation.

Returns:

Raises:

Since:

  • 0.11.0



97
98
99
# File 'lib/calendly/models/event.rb', line 97

def cancel(options: nil)
  client.cancel_event uuid, options: options
end

#fetchCalendly::Event

Get Scheduled Event associated with self.

Returns:

Raises:

Since:

  • 0.1.0



84
85
86
# File 'lib/calendly/models/event.rb', line 84

def fetch
  client.scheduled_event uuid
end

#invitees(options: nil) ⇒ Array<Calendly::Invitee>

Returns all Event Invitees associated with self.

Parameters:

  • options (Hash) (defaults to: nil)

    the optional request parameters. Optional.

Options Hash (options:):

  • :count (Integer)

    Number of rows to return.

  • :email (String)

    Filter by email.

  • :page_token (String)

    Pass this to get the next portion of collection.

  • :sort (String)

    Order results by the specified field and directin. Accepts comma-separated list of field:direction values.

  • :status (String)

    Whether the scheduled event is active or canceled.

Returns:

Raises:

Since:

  • 0.1.0



114
115
116
117
118
119
# File 'lib/calendly/models/event.rb', line 114

def invitees(options: nil)
  return @cached_invitees if defined?(@cached_invitees) && @cached_invitees

  request_proc = proc { |opts| client.event_invitees uuid, options: opts }
  @cached_invitees = auto_pagination request_proc, options
end

#invitees!(options: nil) ⇒ Object

Since:

  • 0.2.0



122
123
124
125
# File 'lib/calendly/models/event.rb', line 122

def invitees!(options: nil)
  @cached_invitees = nil
  invitees options: options
end