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/(\w+)\z}.freeze

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)


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

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



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

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

#create_webhook(url, events) ⇒ 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

Returns:

Raises:

Since:

  • 0.1.3



148
149
150
# File 'lib/calendly/models/organization.rb', line 148

def create_webhook(url, events)
  client.create_webhook url, events, uri
end

#invitations(opts = {}) ⇒ Array<Calendly::OrganizationInvitation>

Get Organization Invitations.

Accepts comma-separated list of field:direction values.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional request parameters.

Options Hash (opts):

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



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

def invitations(opts = {})
  return @cached_invitations if @cached_invitations

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

#invitations!(opts = {}) ⇒ Object

Since:

  • 0.2.0



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

def invitations!(opts = {})
  @cached_invitations = nil
  invitations opts
end

#memberships(opts = {}) ⇒ Array<Calendly::OrganizationMembership>

Get List memberships of all users belonging to self.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional request parameters.

Options Hash (opts):

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



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

def memberships(opts = {})
  return @cached_memberships if @cached_memberships

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

#memberships!(opts = {}) ⇒ Object

Since:

  • 0.2.0



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

def memberships!(opts = {})
  @cached_memberships = nil
  memberships opts
end

#scheduled_events(opts = {}) ⇒ Array<Calendly::Event>

Returns all Scheduled Events associated with self.

Accepts comma-separated list of field:direction values.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional request parameters.

Options Hash (opts):

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



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

def scheduled_events(opts = {})
  return @cached_scheduled_events if @cached_scheduled_events

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

#scheduled_events!(opts = {}) ⇒ Object

Since:

  • 0.5.0



107
108
109
110
# File 'lib/calendly/models/organization.rb', line 107

def scheduled_events!(opts = {})
  @cached_scheduled_events = nil
  scheduled_events opts
end

#webhooks(opts = {}) ⇒ Array<Calendly::WebhookSubscription>

Get List of organization scope Webhooks associated with self.

Accepts comma-separated list of field:direction values.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional request parameters.

Options Hash (opts):

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



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

def webhooks(opts = {})
  return @cached_webhooks if @cached_webhooks

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

#webhooks!(opts = {}) ⇒ Object

Since:

  • 0.2.0



132
133
134
135
# File 'lib/calendly/models/organization.rb', line 132

def webhooks!(opts = {})
  @cached_webhooks = nil
  webhooks opts
end