Class: Calendly::Organization

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

Overview

Calendly’s organization model.

Constant Summary collapse

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

#uriString

Canonical resource reference.

Returns:

  • (String)


18
19
20
# File 'lib/calendly/models/organization.rb', line 18

def uri
  @uri
end

#uuidString

unique id of the Organization object.

Returns:

  • (String)


14
15
16
# File 'lib/calendly/models/organization.rb', line 14

def uuid
  @uuid
end

Instance Method Details

#create_invitation(email) ⇒ Calendly::OrganizationInvitation

Invite a person to an Organization.

Parameters:

  • email (String)

    Email of the person being invited.

Returns:

Raises:

Since:

  • 0.1.0



80
81
82
# File 'lib/calendly/models/organization.rb', line 80

def create_invitation(email)
  client.create_invitation uuid, email
end

#create_webhook(url, events, signing_key: nil) ⇒ Calendly::WebhookSubscription

Create a user scope webhook associated with self.

Parameters:

  • url (String)

    Canonical reference (unique identifier) for the resource.

  • events (Array<String>)

    List of user events to subscribe to. options: invitee.created or invitee.canceled

  • signing_key (String) (defaults to: nil)

    secret key shared between your application and Calendly. Optional.

Returns:

Raises:

Since:

  • 0.1.3



176
177
178
# File 'lib/calendly/models/organization.rb', line 176

def create_webhook(url, events, signing_key: nil)
  client.create_webhook url, events, uri, signing_key: signing_key
end

#event_types(options: nil) ⇒ Array<Calendly::EventType>

Returns all Event Types associated with self.

Accepts comma-separated list of field:direction values.

Parameters:

  • options (Hash) (defaults to: nil)

    the optional request parameters. Optional.

Options Hash (options:):

  • :active (Boolean)

    Return only active event types if true, only inactive if false, or all event types if this parameter is omitted.

  • :count (Integer)

    Number of rows to return.

  • :page_token (String)

    Pass this to get the next portion of collection.

  • :sort (String)

    Order results by the specified field and direction.

Returns:

Raises:

Since:

  • 0.6.0



97
98
99
100
101
102
# File 'lib/calendly/models/organization.rb', line 97

def event_types(options: nil)
  return @cached_event_types if defined?(@cached_event_types) && @cached_event_types

  request_proc = proc { |opts| client.event_types uri, options: opts }
  @cached_event_types = auto_pagination request_proc, options
end

#event_types!(options: nil) ⇒ Object

Since:

  • 0.6.0



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

def event_types!(options: nil)
  @cached_event_types = nil
  event_types options: options
end

#invitations(options: nil) ⇒ Array<Calendly::OrganizationInvitation>

Get Organization Invitations.

Accepts comma-separated list of field:direction values.

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.

  • :status (String)

    Filter by status.

Returns:

Raises:

Since:

  • 0.1.0



58
59
60
61
62
63
# File 'lib/calendly/models/organization.rb', line 58

def invitations(options: nil)
  return @cached_invitations if defined?(@cached_invitations) && @cached_invitations

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

#invitations!(options: nil) ⇒ Object

Since:

  • 0.2.0



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

def invitations!(options: nil)
  @cached_invitations = nil
  invitations options: options
end

#memberships(options: nil) ⇒ Array<Calendly::OrganizationMembership>

Get List memberships of all users belonging to 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.

Returns:

Raises:

Since:

  • 0.1.0



31
32
33
34
35
36
# File 'lib/calendly/models/organization.rb', line 31

def memberships(options: nil)
  return @cached_memberships if defined?(@cached_memberships) && @cached_memberships

  request_proc = proc { |opts| client.memberships uri, options: opts }
  @cached_memberships = auto_pagination request_proc, options
end

#memberships!(options: nil) ⇒ Object

Since:

  • 0.2.0



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

def memberships!(options: nil)
  @cached_memberships = nil
  memberships options: options
end

#scheduled_events(options: nil) ⇒ Array<Calendly::Event>

Returns all Scheduled Events associated with self.

Accepts comma-separated list of field:direction values.

Parameters:

  • options (Hash) (defaults to: nil)

    the optional request parameters. Optional.

Options Hash (options:):

  • :count (Integer)

    Number of rows to return.

  • :invitee_email (String)

    Return events scheduled with the specified invitee email

  • :max_start_timeUpper (String)

    bound (inclusive) for an event’s start time to filter by.

  • :min_start_time (String)

    Lower bound (inclusive) for an event’s start time to filter by.

  • :page_token (String)

    Pass this to get the next portion of collection.

  • :sort (String)

    Order results by the specified field and directin.

  • :status (String)

    Whether the scheduled event is active or canceled

Returns:

Raises:

Since:

  • 0.5.0



126
127
128
129
130
131
# File 'lib/calendly/models/organization.rb', line 126

def scheduled_events(options: nil)
  return @cached_scheduled_events if defined?(@cached_scheduled_events) && @cached_scheduled_events

  request_proc = proc { |opts| client.scheduled_events uri, options: opts }
  @cached_scheduled_events = auto_pagination request_proc, options
end

#scheduled_events!(options: nil) ⇒ Object

Since:

  • 0.5.0



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

def scheduled_events!(options: nil)
  @cached_scheduled_events = nil
  scheduled_events options: options
end

#webhooks(options: nil) ⇒ Array<Calendly::WebhookSubscription>

Get List of organization scope Webhooks associated with self.

Accepts comma-separated list of field:direction values.

Parameters:

  • options (Hash) (defaults to: nil)

    the optional request parameters. Optional.

Options Hash (options:):

  • :count (Integer)

    Number of rows to return.

  • :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.

Returns:

Raises:

Since:

  • 0.1.3



151
152
153
154
155
156
# File 'lib/calendly/models/organization.rb', line 151

def webhooks(options: nil)
  return @cached_webhooks if defined?(@cached_webhooks) && @cached_webhooks

  request_proc = proc { |opts| client.webhooks uri, options: opts }
  @cached_webhooks = auto_pagination request_proc, options
end

#webhooks!(options: nil) ⇒ Object

Since:

  • 0.2.0



159
160
161
162
# File 'lib/calendly/models/organization.rb', line 159

def webhooks!(options: nil)
  @cached_webhooks = nil
  webhooks options: options
end