Class: Calendly::OrganizationMembership
- Inherits:
-
Object
- Object
- Calendly::OrganizationMembership
- 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
-
#created_at ⇒ Time
Moment when user record was first created.
-
#organization ⇒ Organization
Reference to Organization associated with this membership.
-
#role ⇒ String
User’s role within the organization.
-
#updated_at ⇒ Time
Moment when user record was last updated.
-
#uri ⇒ String
Canonical resource reference.
-
#user ⇒ Calendly::User
Primary account details of a specific user.
-
#uuid ⇒ String
unique id of the OrganizationMembership object.
Instance Method Summary collapse
-
#create_user_scope_webhook(url, events) ⇒ Calendly::WebhookSubscription
Create a user scope webhook associated with self.
-
#delete ⇒ Object
Remove self from associated Organization.
-
#fetch ⇒ Calendly::OrganizationMembership
Get Organization Membership associated with self.
-
#user_scope_webhooks(opts = {}) ⇒ Array<Calendly::WebhookSubscription>
Get List of user scope Webhooks associated with self.
- #user_scope_webhooks!(opts = {}) ⇒ Object
Methods included from ModelUtils
#client, #id, included, #initialize, #inspect
Instance Attribute Details
#created_at ⇒ Time
Moment when user record was first created.
27 28 29 |
# File 'lib/calendly/models/organization_membership.rb', line 27 def created_at @created_at end |
#organization ⇒ Organization
Reference to Organization associated with this membership.
38 39 40 |
# File 'lib/calendly/models/organization_membership.rb', line 38 def organization @organization end |
#role ⇒ String
User’s role within the organization
24 25 26 |
# File 'lib/calendly/models/organization_membership.rb', line 24 def role @role end |
#updated_at ⇒ Time
Moment when user record was last updated.
30 31 32 |
# File 'lib/calendly/models/organization_membership.rb', line 30 def updated_at @updated_at end |
#uri ⇒ String
Canonical resource reference.
21 22 23 |
# File 'lib/calendly/models/organization_membership.rb', line 21 def uri @uri end |
#user ⇒ Calendly::User
Primary account details of a specific user.
34 35 36 |
# File 'lib/calendly/models/organization_membership.rb', line 34 def user @user end |
#uuid ⇒ String
unique id of the OrganizationMembership object.
18 19 20 |
# File 'lib/calendly/models/organization_membership.rb', line 18 def uuid @uuid end |
Instance Method Details
#create_user_scope_webhook(url, events) ⇒ Calendly::WebhookSubscription
Create a user scope webhook associated with self.
100 101 102 103 104 |
# File 'lib/calendly/models/organization_membership.rb', line 100 def create_user_scope_webhook(url, events) org_uri = organization.uri if organization user_uri = user.uri if user client.create_webhook url, events, org_uri, user_uri end |
#delete ⇒ Object
Remove self from associated Organization.
57 58 59 |
# File 'lib/calendly/models/organization_membership.rb', line 57 def delete client.delete_membership uuid end |
#fetch ⇒ Calendly::OrganizationMembership
Get Organization Membership associated with self.
47 48 49 |
# File 'lib/calendly/models/organization_membership.rb', line 47 def fetch client.membership uuid end |
#user_scope_webhooks(opts = {}) ⇒ Array<Calendly::WebhookSubscription>
Get List of user scope Webhooks associated with self.
Accepts comma-separated list of field:direction values.
74 75 76 77 78 79 80 81 |
# File 'lib/calendly/models/organization_membership.rb', line 74 def user_scope_webhooks(opts = {}) return @cached_user_scope_webhooks if @cached_user_scope_webhooks org_uri = organization.uri if organization user_uri = user.uri if user request_proc = proc { || client.user_scope_webhooks org_uri, user_uri, } @cached_user_scope_webhooks = auto_pagination request_proc, opts end |
#user_scope_webhooks!(opts = {}) ⇒ Object
84 85 86 87 |
# File 'lib/calendly/models/organization_membership.rb', line 84 def user_scope_webhooks!(opts = {}) @cached_user_scope_webhooks = nil user_scope_webhooks opts end |