class Calendly::User

Calendly's user model. Primary account details of a specific user.

Constants

ASSOCIATION
TIME_FIELDS
UUID_RE

Attributes

avatar_url[RW]

@return [String] URL of user's avatar image.

created_at[RW]

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

current_organization[RW]

@return [Organization] user's current organization

email[RW]

@return [String] User's email address.

name[RW]

@return [String] User's human-readable name.

scheduling_url[RW]

@return [String] URL of user's event page.

slug[RW]

@return [String] Unique readable value used in page URL.

timezone[RW]

@return [String] Timezone offest to use when presenting time information to user.

updated_at[RW]

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

uri[RW]

@return [String] Canonical resource reference.

uuid[RW]

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

Public Instance Methods

create_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.6.0

# File lib/calendly/models/user.rb, line 184
def create_webhook(url, events, signing_key: nil)
  org_uri = current_organization&.uri
  client.create_webhook url, events, org_uri, user_uri: uri, signing_key: signing_key
end
event_types(options: nil) click to toggle source

Returns all Event Types 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 direction. Accepts comma-separated list of {field}:{direction} values. @return [Array<Calendly::EventType>] @raise [Calendly::Error] if the uri is empty. @raise [Calendly::ApiError] if the api returns error code. @since 0.1.0

# File lib/calendly/models/user.rb, line 103
def event_types(options: nil)
  return @cached_event_types if defined?(@cached_event_types) && @cached_event_types

  request_proc = proc { |opts| client.event_types_by_user uri, options: opts }
  @cached_event_types = auto_pagination request_proc, options
end
event_types!(options: nil) click to toggle source

@since 0.2.0

# File lib/calendly/models/user.rb, line 111
def event_types!(options: nil)
  @cached_event_types = nil
  event_types options: options
end
fetch() click to toggle source

Get basic information associated with self.

@return [Calendly::User] @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/user.rb, line 66
def fetch
  client.user uuid
end
organization_membership() click to toggle source

Get an organization membership information associated with self.

@return [Calendly::OrganizationMembership] @raise [Calendly::Error] if the uri is empty. @since 0.1.0

# File lib/calendly/models/user.rb, line 76
def organization_membership
  if defined?(@cached_organization_membership) && @cached_organization_membership
    return @cached_organization_membership
  end

  mems, = client.memberships_by_user uri
  @cached_organization_membership = mems.first
end
organization_membership!() click to toggle source

@since 0.2.0

# File lib/calendly/models/user.rb, line 86
def organization_membership!
  @cached_organization_membership = nil
  organization_membership
end
scheduled_events(options: nil) click to toggle source

Returns all Scheduled Events associated with self.

@param [Hash] options the optional request parameters. Optional. @option options [Integer] :count Number of rows to return. @option options [String] :invitee_email Return events scheduled with the specified invitee email @option options [String] :max_start_timeUpper bound (inclusive) for an event's start time to filter by. @option options [String] :min_start_time Lower bound (inclusive) for an event's start time to filter by. @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. @option options [String] :status Whether the scheduled event is active or canceled @return [Array<Calendly::Event>] @raise [Calendly::Error] if the uri is empty. @raise [Calendly::ApiError] if the api returns error code. @since 0.1.0

# File lib/calendly/models/user.rb, line 132
def scheduled_events(options: nil)
  return @cached_scheduled_events if defined?(@cached_scheduled_events) && @cached_scheduled_events

  request_proc = proc { |opts| client.scheduled_events_by_user uri, options: opts }
  @cached_scheduled_events = auto_pagination request_proc, options
end
scheduled_events!(options: nil) click to toggle source

@since 0.2.0

# File lib/calendly/models/user.rb, line 140
def scheduled_events!(options: nil)
  @cached_scheduled_events = nil
  scheduled_events options: options
end
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 uri is empty. @raise [Calendly::ApiError] if the api returns error code. @since 0.6.0

# File lib/calendly/models/user.rb, line 158
def webhooks(options: nil)
  return @cached_webhooks if defined?(@cached_webhooks) && @cached_webhooks

  org_uri = current_organization&.uri
  request_proc = proc { |opts| client.user_scope_webhooks org_uri, uri, options: opts }
  @cached_webhooks = auto_pagination request_proc, options
end
webhooks!(options: nil) click to toggle source

@since 0.6.0

# File lib/calendly/models/user.rb, line 167
def webhooks!(options: nil)
  @cached_webhooks = nil
  webhooks options: options
end