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.
31 32 33 |
# File 'lib/calendly/models/user.rb', line 31 def avatar_url @avatar_url end |
#created_at ⇒ Time
Moment when user record was first created.
40 41 42 |
# File 'lib/calendly/models/user.rb', line 40 def created_at @created_at end |
#email ⇒ String
User’s email address.
28 29 30 |
# File 'lib/calendly/models/user.rb', line 28 def email @email end |
#name ⇒ String
User’s human-readable name.
22 23 24 |
# File 'lib/calendly/models/user.rb', line 22 def name @name end |
#scheduling_url ⇒ String
URL of user’s event page.
34 35 36 |
# File 'lib/calendly/models/user.rb', line 34 def scheduling_url @scheduling_url end |
#slug ⇒ String
Unique readable value used in page URL.
25 26 27 |
# File 'lib/calendly/models/user.rb', line 25 def slug @slug end |
#timezone ⇒ String
Timezone offest to use when presenting time information to user.
37 38 39 |
# File 'lib/calendly/models/user.rb', line 37 def timezone @timezone end |
#updated_at ⇒ Time
Moment when user record was last updated.
43 44 45 |
# File 'lib/calendly/models/user.rb', line 43 def updated_at @updated_at end |
#uri ⇒ String
Canonical resource reference.
19 20 21 |
# File 'lib/calendly/models/user.rb', line 19 def uri @uri end |
#uuid ⇒ String
unique id of the User object.
16 17 18 |
# File 'lib/calendly/models/user.rb', line 16 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.
87 88 89 90 91 92 |
# File 'lib/calendly/models/user.rb', line 87 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
95 96 97 98 |
# File 'lib/calendly/models/user.rb', line 95 def event_types!(opts = {}) @cached_event_types = nil event_types opts end |
#fetch ⇒ Calendly::User
Get basic information associated with self.
52 53 54 |
# File 'lib/calendly/models/user.rb', line 52 def fetch client.user uuid end |
#organization_membership ⇒ Calendly::OrganizationMembership
Get an organization membership information associated with self.
62 63 64 65 66 67 |
# File 'lib/calendly/models/user.rb', line 62 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
70 71 72 73 |
# File 'lib/calendly/models/user.rb', line 70 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.
116 117 118 119 120 121 |
# File 'lib/calendly/models/user.rb', line 116 def scheduled_events(opts = {}) return @cached_scheduled_events if @cached_scheduled_events request_proc = proc { || client.scheduled_events_by_user uri, } @cached_scheduled_events = auto_pagination request_proc, opts end |
#scheduled_events!(opts = {}) ⇒ Object
124 125 126 127 |
# File 'lib/calendly/models/user.rb', line 124 def scheduled_events!(opts = {}) @cached_scheduled_events = nil scheduled_events opts end |