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/(\w+)\z}.freeze
TIME_FIELDS =
i[created_at updated_at].freeze
ASSOCIATION =
{user: User, organization: Organization}.freeze

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


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

def created_at
  @created_at
end

#organizationOrganization

Reference to Organization associated with this membership.

Returns:



33
34
35
# File 'lib/calendly/models/organization_membership.rb', line 33

def organization
  @organization
end

#roleString

User’s role within the organization

Returns:

  • (String)


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

def role
  @role
end

#updated_atTime

Moment when user record was last updated.

Returns:

  • (Time)


25
26
27
# File 'lib/calendly/models/organization_membership.rb', line 25

def updated_at
  @updated_at
end

#uriString

Canonical resource reference.

Returns:

  • (String)


16
17
18
# File 'lib/calendly/models/organization_membership.rb', line 16

def uri
  @uri
end

#userCalendly::User

Primary account details of a specific user.

Returns:



29
30
31
# File 'lib/calendly/models/organization_membership.rb', line 29

def user
  @user
end

#uuidString

unique id of the OrganizationMembership object.

Returns:

  • (String)


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

def uuid
  @uuid
end

Instance Method Details

#deleteObject

Remove self from associated Organization.

Raises:

Since:

  • 0.1.0



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

def delete
  client.delete_membership uuid
end

#fetchCalendly::OrganizationMembership

Get Organization Membership associated with self.

Returns:

Raises:

Since:

  • 0.1.0



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

def fetch
  client.membership uuid
end