Class: Calendly::OrganizationMembership

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

Overview

Calendly's organization membership model.

Constant Summary collapse

UUID_RE =
%r{\A#{Client::API_HOST}/organization_memberships/(#{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

#created_atTime

Moment when user record was first created.

Returns:

  • (Time)


31
32
33
# File 'lib/calendly/models/organization_membership.rb', line 31

def created_at
  @created_at
end

#organizationCalendly::Organization

Reference to Organization associated with this membership.



43
44
45
# File 'lib/calendly/models/organization_membership.rb', line 43

def organization
  @organization
end

#roleString

User's role within the organization

Returns:

  • (String)


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

def role
  @role
end

#updated_atTime

Moment when user record was last updated.

Returns:

  • (Time)


35
36
37
# File 'lib/calendly/models/organization_membership.rb', line 35

def updated_at
  @updated_at
end

#uriString

Canonical resource reference.

Returns:

  • (String)


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

def uri
  @uri
end

#userCalendly::User

Primary account details of a specific user.

Returns:



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

def user
  @user
end

#uuidString

unique id of the OrganizationMembership object.

Returns:

  • (String)


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

def uuid
  @uuid
end

Class Method Details

.associationObject



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

def self.association
  {
    user: User,
    organization: Organization
  }
end

Instance Method Details

#create_user_scope_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



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

def create_user_scope_webhook(url, events, signing_key: nil)
  user.create_webhook url, events, signing_key: signing_key
end

#deleteObject

Remove self from associated Organization.

Raises:

Since:

  • 0.1.0



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

def delete
  client.delete_membership uuid
end

#fetchCalendly::OrganizationMembership

Get Organization Membership associated with self.

Returns:

Raises:

Since:

  • 0.1.0



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

def fetch
  client.membership uuid
end

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

Get List of user scope Webhooks associated with self.

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



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

def user_scope_webhooks(options: nil)
  user.webhooks options: options
end

#user_scope_webhooks!(options: nil) ⇒ Object

Since:

  • 0.2.0



83
84
85
# File 'lib/calendly/models/organization_membership.rb', line 83

def user_scope_webhooks!(options: nil)
  user.webhooks! options: options
end