Class: Calendly::EventType
- Inherits:
-
Object
- Object
- Calendly::EventType
- 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
Instance Attribute Summary collapse
-
#active ⇒ Boolean
Is this event type currently active?.
-
#color ⇒ String
The web page styling color for this event type, expressed as a hexadecimal RGB value (e.g. #fa12e4).
-
#created_at ⇒ Time
Moment when event type was eventually created.
-
#custom_questions ⇒ Array<Calendly::EventTypeCustomQuestion>
A collection of custom questions.
-
#description_html ⇒ String
Longer text description with HTML formatting.
-
#description_plain ⇒ String
Longer text description in plain text.
-
#duration ⇒ Integer
Length of event type in minutes.
-
#internal_note ⇒ String
Optional internal note on an event type.
-
#kind ⇒ String
Whether the event type is “solo” or with a “group”.
-
#name ⇒ String
Human-readable name.
-
#pooling_type ⇒ String
Whether the event type is “round_robin” or “collective”.
-
#profile ⇒ Calendly::EventTypeProfile
The profile of the User that’s associated with the Event Type.
-
#scheduling_url ⇒ String
The full URL of the web page for this event type.
-
#secret ⇒ Boolean
Indicates if the event type is hidden on the owner’s main scheduling page.
-
#slug ⇒ String
Unique human-readable slug used in page URL.
-
#type ⇒ String
Whether the event type is a “StandardEventType” or an “AdhocEventType”.
-
#updated_at ⇒ Time
Moment when event type was last updated.
-
#uri ⇒ String
Canonical resource reference.
-
#uuid ⇒ String
unique id of the EventType object.
Class Method Summary collapse
Instance Method Summary collapse
-
#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.
-
#create_schedule_link(max_event_count: 1) ⇒ Hash
Create an associated scheduling link.
-
#fetch ⇒ Calendly::EventType
Get EventType associated with self.
-
#owner_team ⇒ Calendly::Team
The owner team if the profile belongs to a “team”.
-
#owner_user ⇒ Calendly::User
The owner user if the profile belongs to a “user” (individual).
Methods included from ModelUtils
#client, #id, included, #initialize, #inspect
Instance Attribute Details
#active ⇒ Boolean
Is this event type currently active?
28 29 30 |
# File 'lib/calendly/models/event_type.rb', line 28 def active @active end |
#color ⇒ String
The web page styling color for this event type, expressed as a hexadecimal RGB value (e.g. #fa12e4).
33 34 35 |
# File 'lib/calendly/models/event_type.rb', line 33 def color @color end |
#created_at ⇒ Time
Moment when event type was eventually created.
82 83 84 |
# File 'lib/calendly/models/event_type.rb', line 82 def created_at @created_at end |
#custom_questions ⇒ Array<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_html ⇒ String
Longer text description with HTML formatting.
37 38 39 |
# File 'lib/calendly/models/event_type.rb', line 37 def description_html @description_html end |
#description_plain ⇒ String
Longer text description in plain text.
41 42 43 |
# File 'lib/calendly/models/event_type.rb', line 41 def description_plain @description_plain end |
#duration ⇒ Integer
Length of event type in minutes.
45 46 47 |
# File 'lib/calendly/models/event_type.rb', line 45 def duration @duration end |
#internal_note ⇒ String
Optional internal note on an event type.
49 50 51 |
# File 'lib/calendly/models/event_type.rb', line 49 def internal_note @internal_note end |
#kind ⇒ String
Whether the event type is “solo” or with a “group”.
53 54 55 |
# File 'lib/calendly/models/event_type.rb', line 53 def kind @kind end |
#name ⇒ String
Human-readable name. Note: some Event Types don’t have a name.
57 58 59 |
# File 'lib/calendly/models/event_type.rb', line 57 def name @name end |
#pooling_type ⇒ String
Whether the event type is “round_robin” or “collective”. This value is null if the event type does not pool team members’ availability.
62 63 64 |
# File 'lib/calendly/models/event_type.rb', line 62 def pooling_type @pooling_type end |
#profile ⇒ Calendly::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_url ⇒ String
The full URL of the web page for this event type.
66 67 68 |
# File 'lib/calendly/models/event_type.rb', line 66 def scheduling_url @scheduling_url end |
#secret ⇒ Boolean
Indicates if the event type is hidden on the owner’s main scheduling page.
78 79 80 |
# File 'lib/calendly/models/event_type.rb', line 78 def secret @secret end |
#slug ⇒ String
Unique human-readable slug used in page URL.
70 71 72 |
# File 'lib/calendly/models/event_type.rb', line 70 def slug @slug end |
#type ⇒ String
Whether the event type is a “StandardEventType” or an “AdhocEventType”.
74 75 76 |
# File 'lib/calendly/models/event_type.rb', line 74 def type @type end |
#updated_at ⇒ Time
Moment when event type was last updated.
86 87 88 |
# File 'lib/calendly/models/event_type.rb', line 86 def updated_at @updated_at end |
#uri ⇒ String
Canonical resource reference.
24 25 26 |
# File 'lib/calendly/models/event_type.rb', line 24 def uri @uri end |
#uuid ⇒ String
unique id of the EventType object.
20 21 22 |
# File 'lib/calendly/models/event_type.rb', line 20 def uuid @uuid end |
Class Method Details
.association ⇒ Object
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).
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_schedule_link(max_event_count: 1) ⇒ Hash
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"
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 |
#fetch ⇒ Calendly::EventType
Get EventType associated with self.
117 118 119 |
# File 'lib/calendly/models/event_type.rb', line 117 def fetch client.event_type uuid end |
#owner_team ⇒ Calendly::Team
The owner team if the profile belongs to a “team”.
106 107 108 |
# File 'lib/calendly/models/event_type.rb', line 106 def owner_team profile&.owner_team end |
#owner_user ⇒ Calendly::User
The owner user if the profile belongs to a “user” (individual).
99 100 101 |
# File 'lib/calendly/models/event_type.rb', line 99 def owner_user profile&.owner_user end |