Sha256: 5635e10eadc934b77b1a0957e8c2c9ed068ca45d851d9ab36bb0f5febfbee48e
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module Pinata class GroupsResource < Resource def create(name:, is_public: false) payload = { name: name, is_public: is_public } Group.new api_post_request("files/groups", body: payload).body["data"] end def get(group_id:) Group.new api_get_request("files/groups/#{group_id}").body.dig("data") end def list(**params) response = api_get_request("files/groups", params: params) Collection.from_response(response, key: "groups", type: Group) end def add_file(group_id:, file_id:) Group.new api_put_request("files/groups/#{group_id}/ids/#{file_id}").body["data"] end def remove_file(group_id:, file_id:) Group.new api_delete_request("files/groups/#{group_id}/ids/#{file_id}").body["data"] end def update(group_id:, **attributes) Group.new api_put_request("files/groups/#{group_id}", body: attributes).body["data"] end def delete(group_id:) Group.new api_delete_request("files/groups/#{group_id}").body.dig("data") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pinata-1.0.5 | lib/pinata/resources/groups.rb |
pinata-1.0.4 | lib/pinata/resources/groups.rb |