Class: Calendly::User
- Inherits:
-
Object
- Object
- Calendly::User
- Includes:
- ModelUtils
- Defined in:
- lib/calendly/models/user.rb
Overview
Calendly’s user model. Primary account details of a specific user.
Constant Summary collapse
- UUID_RE =
%r{\A#{Client::API_HOST}/users/(\w+)\z}.freeze
- TIME_FIELDS =
%i[created_at updated_at].freeze
Instance Attribute Summary collapse
-
#avatar_url ⇒ String
URL of user’s avatar image.
-
#created_at ⇒ Time
Moment when user record was first created.
-
#email ⇒ String
User’s email address.
-
#name ⇒ String
User’s human-readable name.
-
#scheduling_url ⇒ String
URL of user’s event page.
-
#slug ⇒ String
Unique readable value used in page URL.
-
#timezone ⇒ String
Timezone offest to use when presenting time information to user.
-
#updated_at ⇒ Time
Moment when user record was last updated.
-
#uri ⇒ String
Canonical resource reference.
-
#uuid ⇒ String
unique id of the User object.
Instance Method Summary collapse
-
#event_types(opts = {}) ⇒ Array<Calendly::EventType>
Returns all Event Types associated with self.
- #event_types!(opts = {}) ⇒ Object
-
#fetch ⇒ Calendly::User
Get basic information associated with self.
-
#organization_membership ⇒ Calendly::OrganizationMembership
Get an organization membership information associated with self.
- #organization_membership! ⇒ Object
-
#scheduled_events(opts = {}) ⇒ Array<Calendly::Event>
Returns all Scheduled Events associated with self.
- #scheduled_events!(opts = {}) ⇒ Object
Methods included from ModelUtils
#client, #id, included, #initialize, #inspect
Instance Attribute Details
#avatar_url ⇒ String
URL of user’s avatar image.
28 29 30 |
# File 'lib/calendly/models/user.rb', line 28 def avatar_url @avatar_url end |
#created_at ⇒ Time
Moment when user record was first created.
37 38 39 |
# File 'lib/calendly/models/user.rb', line 37 def created_at @created_at end |
#email ⇒ String
User’s email address.
25 26 27 |
# File 'lib/calendly/models/user.rb', line 25 def email @email end |
#name ⇒ String
User’s human-readable name.
19 20 21 |
# File 'lib/calendly/models/user.rb', line 19 def name @name end |
#scheduling_url ⇒ String
URL of user’s event page.
31 32 33 |
# File 'lib/calendly/models/user.rb', line 31 def scheduling_url @scheduling_url end |
#slug ⇒ String
Unique readable value used in page URL.
22 23 24 |
# File 'lib/calendly/models/user.rb', line 22 def slug @slug end |
#timezone ⇒ String
Timezone offest to use when presenting time information to user.
34 35 36 |
# File 'lib/calendly/models/user.rb', line 34 def timezone @timezone end |
#updated_at ⇒ Time
Moment when user record was last updated.
40 41 42 |
# File 'lib/calendly/models/user.rb', line 40 def updated_at @updated_at end |
#uri ⇒ String
Canonical resource reference.
16 17 18 |
# File 'lib/calendly/models/user.rb', line 16 def uri @uri end |
#uuid ⇒ String
unique id of the User object.
13 14 15 |
# File 'lib/calendly/models/user.rb', line 13 def uuid @uuid end |
Instance Method Details
#event_types(opts = {}) ⇒ Array<Calendly::EventType>
Returns all Event Types associated with self.
Accepts comma-separated list of field:direction values.
84 85 86 87 88 89 |
# File 'lib/calendly/models/user.rb', line 84 def event_types(opts = {}) return @cached_event_types if @cached_event_types request_proc = proc { || client.event_types uri, } @cached_event_types = auto_pagination request_proc, opts end |
#event_types!(opts = {}) ⇒ Object
92 93 94 95 |
# File 'lib/calendly/models/user.rb', line 92 def event_types!(opts = {}) @cached_event_types = nil event_types opts end |
#fetch ⇒ Calendly::User
Get basic information associated with self.
49 50 51 |
# File 'lib/calendly/models/user.rb', line 49 def fetch client.user uuid end |
#organization_membership ⇒ Calendly::OrganizationMembership
Get an organization membership information associated with self.
59 60 61 62 63 64 |
# File 'lib/calendly/models/user.rb', line 59 def organization_membership return @cached_organization_membership if @cached_organization_membership mems, = client.memberships_by_user uri @cached_organization_membership = mems.first end |
#organization_membership! ⇒ Object
67 68 69 70 |
# File 'lib/calendly/models/user.rb', line 67 def organization_membership! @cached_organization_membership = nil organization_membership end |
#scheduled_events(opts = {}) ⇒ Array<Calendly::Event>
Returns all Scheduled Events associated with self.
Accepts comma-separated list of field:direction values.
113 114 115 116 117 118 |
# File 'lib/calendly/models/user.rb', line 113 def scheduled_events(opts = {}) return @cached_scheduled_events if @cached_scheduled_events request_proc = proc { || client.scheduled_events uri, } @cached_scheduled_events = auto_pagination request_proc, opts end |
#scheduled_events!(opts = {}) ⇒ Object
121 122 123 124 |
# File 'lib/calendly/models/user.rb', line 121 def scheduled_events!(opts = {}) @cached_scheduled_events = nil scheduled_events opts end |