Class: SupportOps::Calendly::OrganizationMemberships
- Defined in:
- lib/support_ops_calendly/calendly/organization_memberships.rb
Overview
Defines the module Organizations within the module SupportOps::Calendly.
Instance Attribute Summary collapse
-
#created_at ⇒ String
The moment when the membership record was created (e.g. “2020-01-02T03:04:05.678123Z”).
-
#organization ⇒ String
A unique reference to the organization.
-
#role ⇒ String
The user’s role in the organization.
-
#updated_at ⇒ String
The moment when the membership record was last updated (e.g. “2020-01-02T03:04:05.678123Z”).
-
#uri ⇒ String
Canonical reference (unique identifier) for the membership.
-
#user ⇒ Object
An instance of Users.
Class Method Summary collapse
-
.get(object) ⇒ Object
Returns information about a specified Organization Membership.
-
.get!(object) ⇒ Object
Returns information about a specified Organization Membership.
-
.list(object) ⇒ Object
Returns a list of Organization Memberships for a specified Organization.
Instance Method Summary collapse
-
#delete! ⇒ Object
Removes a membership from an organization.
-
#uuid ⇒ String
Returns the UUID of an organization membership.
Methods inherited from Base
attributes, client, #client=, configure, define_attributes, #find, #find!, #initialize, #members, readonly_attributes, #save!, #store_original_attributes
Constructor Details
This class inherits a constructor from SupportOps::Calendly::Base
Instance Attribute Details
#created_at ⇒ String
The moment when the membership record was created (e.g. “2020-01-02T03:04:05.678123Z”)
18 19 20 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 18 def created_at @created_at end |
#organization ⇒ String
A unique reference to the organization
18 19 20 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 18 def organization @organization end |
#role ⇒ String
The user’s role in the organization
18 19 20 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 18 def role @role end |
#updated_at ⇒ String
The moment when the membership record was last updated (e.g. “2020-01-02T03:04:05.678123Z”)
18 19 20 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 18 def updated_at @updated_at end |
#uri ⇒ String
Canonical reference (unique identifier) for the membership
18 19 20 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 18 def uri @uri end |
#user ⇒ Object
An instance of Users
18 19 20 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 18 def user @user end |
Class Method Details
.get(object) ⇒ Object
Returns information about a specified Organization Membership
151 152 153 154 155 156 157 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 151 def self.get(object) if object.is_a? OrganizationMemberships OrganizationMemberships.new(uri: uri).find else OrganizationMemberships.new(uri: object).find end end |
.get!(object) ⇒ Object
Returns information about a specified Organization Membership
177 178 179 180 181 182 183 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 177 def self.get!(object) if object.is_a? OrganizationMemberships OrganizationMemberships.new(uri: uri).find! else OrganizationMemberships.new(uri: object).find! end end |
.list(object) ⇒ Object
Returns a list of Organization Memberships for a specified Organization
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 109 def self.list(object) id = if object.is_a? Organizations object.uri elsif object =~ /^https/ object else "https://api.calendly.com/organizations/#{object}" end data = { organization: id, count: 100 } array = [] loop do response = client.connection.get('organization_memberships', data) body = Oj.load(response.body) body['collection'].each_with_index do |member, index| body['collection'][index]['user'] = Users.new(member['user']) end array += body['collection'].map { |c| OrganizationMemberships.new(c) } break if body['pagination']['next_page_token'].nil? data = { organization: id, count: 100, page_token: body['pagination']['next_page_token'] } end array end |
Instance Method Details
#delete! ⇒ Object
This is inherited from Base#delete!
Removes a membership from an organization
20 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 20 def delete!; end |
#uuid ⇒ String
This is inherited from Base#uuid
Returns the UUID of an organization membership
18 |
# File 'lib/support_ops_calendly/calendly/organization_memberships.rb', line 18 def uuid; end |