class Calendly::OrganizationMembership

Calendly's organization membership model.

Constants

ASSOCIATION
TIME_FIELDS
UUID_RE

Attributes

created_at[RW]

@return [Time] Moment when user record was first created.

organization[RW]

@return [Organization] Reference to Organization associated with this membership.

role[RW]

@return [String] User's role within the organization

updated_at[RW]

@return [Time] Moment when user record was last updated.

uri[RW]

@return [String] Canonical resource reference.

user[RW]

@return [Calendly::User] Primary account details of a specific user.

uuid[RW]

@return [String] unique id of the OrganizationMembership object.

Public Instance Methods

create_user_scope_webhook(url, events, signing_key: nil) click to toggle source

Create a user scope webhook associated with self.

@param [String] url Canonical reference (unique identifier) for the resource. @param [Array<String>] events List of user events to subscribe to. options: invitee.created or invitee.canceled @param [String] signing_key secret key shared between your application and Calendly. Optional. @return [Calendly::WebhookSubscription] @raise [Calendly::Error] if the url arg is empty. @raise [Calendly::Error] if the events arg is empty. @raise [Calendly::Error] if the organization.uri is empty. @raise [Calendly::ApiError] if the api returns error code. @since 0.1.3

# 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
delete() click to toggle source

Remove self from associated Organization.

@raise [Calendly::Error] if the uuid is empty. @raise [Calendly::ApiError] if the api returns error code. @since 0.1.0

# File lib/calendly/models/organization_membership.rb, line 61
def delete
  client.delete_membership uuid
end
fetch() click to toggle source

Get Organization Membership associated with self.

@return [Calendly::OrganizationMembership] @raise [Calendly::Error] if the uuid is empty. @raise [Calendly::ApiError] if the api returns error code. @since 0.1.0

# File lib/calendly/models/organization_membership.rb, line 51
def fetch
  client.membership uuid
end
user_scope_webhooks(options: nil) click to toggle source

Get List of user scope Webhooks associated with self.

@param [Hash] options the optional request parameters. Optional. @option options [Integer] :count Number of rows to return. @option options [String] :page_token Pass this to get the next portion of collection. @option options [String] :sort Order results by the specified field and directin. Accepts comma-separated list of {field}:{direction} values. Accepts comma-separated list of {field}:{direction} values. @return [Array<Calendly::WebhookSubscription>] @raise [Calendly::Error] if the organization.uri is empty. @raise [Calendly::Error] if the user.uri is empty. @raise [Calendly::ApiError] if the api returns error code. @since 0.1.3

# 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) click to toggle source

@since 0.2.0

# File lib/calendly/models/organization_membership.rb, line 83
def user_scope_webhooks!(options: nil)
  user.webhooks! options: options
end

Private Instance Methods

after_set_attributes(attrs) click to toggle source
# File lib/calendly/models/organization_membership.rb, line 105
def after_set_attributes(attrs)
  super attrs
  if user.is_a?(User) && user.current_organization.nil? && organization.is_a?(Organization) # rubocop:disable Style/GuardClause
    user.current_organization = organization
  end
end
inspect_attributes() click to toggle source
Calls superclass method Calendly::ModelUtils#inspect_attributes
# File lib/calendly/models/organization_membership.rb, line 112
def inspect_attributes
  super + %i[role]
end