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.
22 23 24 |
# File 'lib/calendly/models/organization_membership.rb', line 22 def created_at @created_at end |
#organization ⇒ Organization
Reference to Organization associated with this membership.
33 34 35 |
# File 'lib/calendly/models/organization_membership.rb', line 33 def organization @organization end |
#role ⇒ String
User’s role within the organization
19 20 21 |
# File 'lib/calendly/models/organization_membership.rb', line 19 def role @role end |
#updated_at ⇒ Time
Moment when user record was last updated.
25 26 27 |
# File 'lib/calendly/models/organization_membership.rb', line 25 def updated_at @updated_at end |
#uri ⇒ String
Canonical resource reference.
16 17 18 |
# File 'lib/calendly/models/organization_membership.rb', line 16 def uri @uri end |
#user ⇒ Calendly::User
Primary account details of a specific user.
29 30 31 |
# File 'lib/calendly/models/organization_membership.rb', line 29 def user @user end |
#uuid ⇒ String
unique id of the OrganizationMembership object.
13 14 15 |
# File 'lib/calendly/models/organization_membership.rb', line 13 def uuid @uuid end |
Instance Method Details
#create_user_scope_webhook(url, events) ⇒ Calendly::WebhookSubscription
Create a user scope webhook associated with self.
95 96 97 98 99 |
# File 'lib/calendly/models/organization_membership.rb', line 95 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.
52 53 54 |
# File 'lib/calendly/models/organization_membership.rb', line 52 def delete client.delete_membership uuid end |
#fetch ⇒ Calendly::OrganizationMembership
Get Organization Membership associated with self.
42 43 44 |
# File 'lib/calendly/models/organization_membership.rb', line 42 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.
69 70 71 72 73 74 75 76 |
# File 'lib/calendly/models/organization_membership.rb', line 69 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
79 80 81 82 |
# File 'lib/calendly/models/organization_membership.rb', line 79 def user_scope_webhooks!(opts = {}) @cached_user_scope_webhooks = nil user_scope_webhooks opts end |