Class: VitableConnect::Resources::Groups
- Inherits:
-
Object
- Object
- VitableConnect::Resources::Groups
- Defined in:
- lib/vitable_connect/resources/groups.rb,
lib/vitable_connect/resources/groups/members.rb,
lib/vitable_connect/resources/groups/members/sync.rb
Defined Under Namespace
Classes: Members
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(external_reference_id:, name:, request_options: {}) ⇒ VitableConnect::Models::GroupResponse
Creates a new group scoped to the authenticated organization.
-
#initialize(client:) ⇒ Groups
constructor
private
A new instance of Groups.
-
#list(limit: nil, page: nil, request_options: {}) ⇒ VitableConnect::Internal::PageNumberPage<VitableConnect::Models::Group>
Returns a paginated list of groups belonging to the authenticated organization.
-
#retrieve(group_id, request_options: {}) ⇒ VitableConnect::Models::GroupResponse
Retrieves a single group by its prefixed ID.
-
#update(group_id, external_reference_id: nil, name: nil, request_options: {}) ⇒ VitableConnect::Models::GroupResponse
Partially updates a group’s name or external reference ID.
Constructor Details
#initialize(client:) ⇒ Groups
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Groups.
108 109 110 111 |
# File 'lib/vitable_connect/resources/groups.rb', line 108 def initialize(client:) @client = client @members = VitableConnect::Resources::Groups::Members.new(client: client) end |
Instance Attribute Details
#members ⇒ VitableConnect::Resources::Groups::Members (readonly)
7 8 9 |
# File 'lib/vitable_connect/resources/groups.rb', line 7 def members @members end |
Instance Method Details
#create(external_reference_id:, name:, request_options: {}) ⇒ VitableConnect::Models::GroupResponse
Creates a new group scoped to the authenticated organization.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/vitable_connect/resources/groups.rb', line 20 def create(params) parsed, = VitableConnect::GroupCreateParams.dump_request(params) @client.request( method: :post, path: "v1/groups", body: parsed, model: VitableConnect::GroupResponse, options: ) end |
#list(limit: nil, page: nil, request_options: {}) ⇒ VitableConnect::Internal::PageNumberPage<VitableConnect::Models::Group>
Returns a paginated list of groups belonging to the authenticated organization.
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/vitable_connect/resources/groups.rb', line 92 def list(params = {}) parsed, = VitableConnect::GroupListParams.dump_request(params) query = VitableConnect::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/groups", query: query, page: VitableConnect::Internal::PageNumberPage, model: VitableConnect::Group, options: ) end |
#retrieve(group_id, request_options: {}) ⇒ VitableConnect::Models::GroupResponse
Retrieves a single group by its prefixed ID. Returns 404 if the group does not belong to the authenticated organization.
43 44 45 46 47 48 49 50 |
# File 'lib/vitable_connect/resources/groups.rb', line 43 def retrieve(group_id, params = {}) @client.request( method: :get, path: ["v1/groups/%1$s", group_id], model: VitableConnect::GroupResponse, options: params[:request_options] ) end |
#update(group_id, external_reference_id: nil, name: nil, request_options: {}) ⇒ VitableConnect::Models::GroupResponse
Partially updates a group’s name or external reference ID. Returns 404 if the group does not belong to the authenticated organization.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/vitable_connect/resources/groups.rb', line 68 def update(group_id, params = {}) parsed, = VitableConnect::GroupUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/groups/%1$s", group_id], body: parsed, model: VitableConnect::GroupResponse, options: ) end |