Class: Calendly::EventType

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

Overview

Calendly’s event type model. A configuration for a schedulable event.

Constant Summary collapse

UUID_RE =
%r{\A#{Client::API_HOST}/event_types/(#{UUID_FORMAT})\z}.freeze
TIME_FIELDS =
%i[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

#activeBoolean

Is this event type currently active?

Returns:

  • (Boolean)


28
29
30
# File 'lib/calendly/models/event_type.rb', line 28

def active
  @active
end

#colorString

The web page styling color for this event type, expressed as a hexadecimal RGB value (e.g. #fa12e4).

Returns:

  • (String)


33
34
35
# File 'lib/calendly/models/event_type.rb', line 33

def color
  @color
end

#created_atTime

Moment when event type was eventually created.

Returns:

  • (Time)


82
83
84
# File 'lib/calendly/models/event_type.rb', line 82

def created_at
  @created_at
end

#custom_questionsArray<Calendly::EventTypeCustomQuestion>

A collection of custom questions.



94
95
96
# File 'lib/calendly/models/event_type.rb', line 94

def custom_questions
  @custom_questions
end

#description_htmlString

Longer text description with HTML formatting.

Returns:

  • (String)


37
38
39
# File 'lib/calendly/models/event_type.rb', line 37

def description_html
  @description_html
end

#description_plainString

Longer text description in plain text.

Returns:

  • (String)


41
42
43
# File 'lib/calendly/models/event_type.rb', line 41

def description_plain
  @description_plain
end

#durationInteger

Length of event type in minutes.

Returns:

  • (Integer)


45
46
47
# File 'lib/calendly/models/event_type.rb', line 45

def duration
  @duration
end

#internal_noteString

Optional internal note on an event type.

Returns:

  • (String)


49
50
51
# File 'lib/calendly/models/event_type.rb', line 49

def internal_note
  @internal_note
end

#kindString

Whether the event type is “solo” or with a “group”.

Returns:

  • (String)


53
54
55
# File 'lib/calendly/models/event_type.rb', line 53

def kind
  @kind
end

#nameString

Human-readable name. Note: some Event Types don’t have a name.

Returns:

  • (String)


57
58
59
# File 'lib/calendly/models/event_type.rb', line 57

def name
  @name
end

#pooling_typeString

Whether the event type is “round_robin” or “collective”. This value is null if the event type does not pool team members’ availability.

Returns:

  • (String)


62
63
64
# File 'lib/calendly/models/event_type.rb', line 62

def pooling_type
  @pooling_type
end

#profileCalendly::EventTypeProfile

The profile of the User that’s associated with the Event Type.



90
91
92
# File 'lib/calendly/models/event_type.rb', line 90

def profile
  @profile
end

#scheduling_urlString

The full URL of the web page for this event type.

Returns:

  • (String)


66
67
68
# File 'lib/calendly/models/event_type.rb', line 66

def scheduling_url
  @scheduling_url
end

#secretBoolean

Indicates if the event type is hidden on the owner’s main scheduling page.

Returns:

  • (Boolean)


78
79
80
# File 'lib/calendly/models/event_type.rb', line 78

def secret
  @secret
end

#slugString

Unique human-readable slug used in page URL.

Returns:

  • (String)


70
71
72
# File 'lib/calendly/models/event_type.rb', line 70

def slug
  @slug
end

#typeString

Whether the event type is a “StandardEventType” or an “AdhocEventType”.

Returns:

  • (String)


74
75
76
# File 'lib/calendly/models/event_type.rb', line 74

def type
  @type
end

#updated_atTime

Moment when event type was last updated.

Returns:

  • (Time)


86
87
88
# File 'lib/calendly/models/event_type.rb', line 86

def updated_at
  @updated_at
end

#uriString

Canonical resource reference.

Returns:

  • (String)


24
25
26
# File 'lib/calendly/models/event_type.rb', line 24

def uri
  @uri
end

#uuidString

unique id of the EventType object.

Returns:

  • (String)


20
21
22
# File 'lib/calendly/models/event_type.rb', line 20

def uuid
  @uuid
end

Class Method Details

.associationObject



11
12
13
14
15
16
# File 'lib/calendly/models/event_type.rb', line 11

def self.association
  {
    profile: EventTypeProfile,
    custom_questions: EventTypeCustomQuestion
  }
end

Instance Method Details

#available_times(start_time: nil, end_time: nil) ⇒ Array<Calendly::EventTypeAvailableTime>

Returns a list of available times for an event type within a specified date range. Date range can be no greater than 1 week (7 days).

Parameters:

  • start_time (String) (defaults to: nil)

    Start time of the requested availability range.

  • end_time (String) (defaults to: nil)

    End time of the requested availability range.

Returns:

Raises:

Since:

  • 0.13.0



131
132
133
# File 'lib/calendly/models/event_type.rb', line 131

def available_times(start_time: nil, end_time: nil)
  client.event_type_available_times uri, start_time: start_time, end_time: end_time
end

Create an associated scheduling link.

e.g.

booking_url: "https://calendly.com/s/FOO-BAR-SLUG",
owner: "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
owner_type: "EventType"

Parameters:

  • max_event_count (String) (defaults to: 1)

    The max number of events that can be scheduled using this scheduling link.

Returns:

  • (Hash)

Raises:

Since:

  • 0.5.2



150
151
152
# File 'lib/calendly/models/event_type.rb', line 150

def create_schedule_link(max_event_count: 1)
  client.create_schedule_link uri, max_event_count: max_event_count, owner_type: 'EventType'
end

#fetchCalendly::EventType

Get EventType associated with self.

Returns:

Raises:

Since:

  • 0.5.1



117
118
119
# File 'lib/calendly/models/event_type.rb', line 117

def fetch
  client.event_type uuid
end

#owner_teamCalendly::Team

The owner team if the profile belongs to a “team”.

Returns:

Since:

  • 0.6.0



106
107
108
# File 'lib/calendly/models/event_type.rb', line 106

def owner_team
  profile&.owner_team
end

#owner_userCalendly::User

The owner user if the profile belongs to a “user” (individual).

Returns:

Since:

  • 0.6.0



99
100
101
# File 'lib/calendly/models/event_type.rb', line 99

def owner_user
  profile&.owner_user
end