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
ASSOCIATION =
{profile: EventTypeProfile, custom_questions: EventTypeCustomQuestion}.freeze

Constants included from ModelUtils

ModelUtils::UUID_FORMAT

Instance Attribute 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)


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

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)


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

def color
  @color
end

#created_atTime

Moment when event type was eventually created.

Returns:

  • (Time)


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

def created_at
  @created_at
end

#custom_questionsArray<EventTypeCustomQuestion>

A collection of custom questions.

Returns:



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

def custom_questions
  @custom_questions
end

#description_htmlString

Longer text description with HTML formatting.

Returns:

  • (String)


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

def description_html
  @description_html
end

#description_plainString

Longer text description in plain text.

Returns:

  • (String)


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

def description_plain
  @description_plain
end

#durationInteger

Length of event type in minutes.

Returns:

  • (Integer)


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

def duration
  @duration
end

#internal_noteString

Optional internal note on an event type.

Returns:

  • (String)


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

def internal_note
  @internal_note
end

#kindString

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

Returns:

  • (String)


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

def kind
  @kind
end

#nameString

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

Returns:

  • (String)


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

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)


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

def pooling_type
  @pooling_type
end

#profileEventTypeProfile

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

Returns:



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

def profile
  @profile
end

#scheduling_urlString

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

Returns:

  • (String)


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

def scheduling_url
  @scheduling_url
end

#secretBoolean

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

Returns:

  • (Boolean)


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

def secret
  @secret
end

#slugString

Unique human-readable slug used in page URL.

Returns:

  • (String)


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

def slug
  @slug
end

#typeString

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

Returns:

  • (String)


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

def type
  @type
end

#updated_atTime

Moment when event type was last updated.

Returns:

  • (Time)


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

def updated_at
  @updated_at
end

#uriString

Canonical resource reference.

Returns:

  • (String)


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

def uri
  @uri
end

#uuidString

unique id of the EventType object.

Returns:

  • (String)


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

def uuid
  @uuid
end

Instance Method Details

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



135
136
137
# File 'lib/calendly/models/event_type.rb', line 135

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



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

def fetch
  client.event_type uuid
end

#owner_teamTeam

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

Returns:

Since:

  • 0.6.0



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

def owner_team
  profile&.owner_team
end

#owner_userUser

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

Returns:

Since:

  • 0.6.0



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

def owner_user
  profile&.owner_user
end