Class: Grist::Type::Access
Overview
Defines a Grist Organization
Constant Summary collapse
- PATH =
"/access"- KEYS =
%w[ id email name picture ref access isMember ].freeze
Class Method Summary collapse
- .access(id) ⇒ Object
-
.all ⇒ Array
List all organizations.
-
.delete(id) ⇒ self | nil
Deletes the organization.
-
.find(id) ⇒ Object
Finds an organization by ID return [self | nil] The organization or nil if not found.
-
.update(id, data) ⇒ self | nil
Updates the organization.
Methods inherited from Base
Methods included from Searchable
Methods included from Accessible
Methods included from Rest
#create, #delete, #get, #list, #path, #request, #update
Constructor Details
This class inherits a constructor from Grist::Type::Base
Class Method Details
.access(id) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/grist/type/access.rb', line 60 def self.access(id) org = find(id) grist_res = org.access return unless grist_res.success? && grist_res.data grist_res.data end |
.all ⇒ Array
List all organizations
22 23 24 25 26 27 |
# File 'lib/grist/type/access.rb', line 22 def self.all grist_res = new.list return [] unless grist_res&.data.is_a?(Array) grist_res.data&.map { |org| Organization.new(org) } end |
.delete(id) ⇒ self | nil
Deletes the organization
53 54 55 56 57 58 |
# File 'lib/grist/type/access.rb', line 53 def self.delete(id) org = find(id) return unless org org.delete end |
.find(id) ⇒ Object
Finds an organization by ID return [self | nil] The organization or nil if not found
32 33 34 35 36 37 |
# File 'lib/grist/type/access.rb', line 32 def self.find(id) grist_res = new.get(id) return unless grist_res.success? && grist_res.data new(grist_res.data) end |
.update(id, data) ⇒ self | nil
Updates the organization
43 44 45 46 47 48 |
# File 'lib/grist/type/access.rb', line 43 def self.update(id, data) org = find(id) return unless org org.update(data) end |