class Podio::Grant

Public Class Methods

count_by_reference(ref_type, ref_id) click to toggle source

hoist.podio.com/api/item/19275931

# File lib/podio/models/grant.rb, line 55
def count_by_reference(ref_type, ref_id)
  Podio.connection.get("/grant/#{ref_type}/#{ref_id}/count").body['count']
end
create(ref_type, ref_id, attributes={}) click to toggle source

hoist.podio.com/api/item/16168841

# File lib/podio/models/grant.rb, line 21
def create(ref_type, ref_id, attributes={})
  response = Podio.connection.post do |req|
    req.url "/grant/#{ref_type}/#{ref_id}"
    req.body = attributes
  end

  response.body
end
delete(ref_type, ref_id, user_id) click to toggle source

hoist.podio.com/api/item/16496711

# File lib/podio/models/grant.rb, line 50
def delete(ref_type, ref_id, user_id)
  Podio.connection.delete("grant/#{ref_type}/#{ref_id}/#{user_id}").body
end
find_all(ref_type, ref_id, options = {}) click to toggle source

hoist.podio.com/api/item/16491464

# File lib/podio/models/grant.rb, line 43
def find_all(ref_type, ref_id, options = {})
  list Podio.connection.get { |req|
    req.url("grant/#{ref_type}/#{ref_id}/", options)
  }.body
end
find_for_user_on_space(space_id, user_id, options = {}) click to toggle source

hoist.podio.com/api/item/19389786

# File lib/podio/models/grant.rb, line 60
def find_for_user_on_space(space_id, user_id, options = {})
  list Podio.connection.get { |req|
    req.url("/grant/space/#{space_id}/user/#{user_id}/", options)
  }.body
end
find_own(ref_type, ref_id, options = {}) click to toggle source

hoist.podio.com/api/item/16490748

# File lib/podio/models/grant.rb, line 31
def find_own(ref_type, ref_id, options = {})
  response = Podio.connection.get { |req|
    req.url("/grant/#{ref_type}/#{ref_id}/own", options)
  }
  if response.status == 200
    member response.body
  else
    nil
  end
end
find_own_on_org(org_id, options = {}) click to toggle source

hoist.podio.com/api/item/22330891

# File lib/podio/models/grant.rb, line 67
def find_own_on_org(org_id, options = {})
  list Podio.connection.get { |req|
    req.url("/grant/org/#{org_id}/own/", options)
  }.body
end

Public Instance Methods

save() click to toggle source
# File lib/podio/models/grant.rb, line 15
def save
  self.class.create(self.ref_type, self.ref_id, self.attributes)
end