Class: Podio::OrganizationMember

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/organization_member.rb

Overview

Encapsulates a user’s indirect membership (through spaces) of an organization.

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes, #error_code, #error_message, #error_parameters, #error_propagate

Class Method Summary collapse

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, list, member, #new_record?, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.delete(org_id, user_id) ⇒ Object



23
24
25
# File 'lib/podio/models/organization_member.rb', line 23

def delete(org_id, user_id)
  Podio.connection.delete("/org/#{org_id}/member/#{user_id}").status
end

.find(org_id, user_id) ⇒ Object



19
20
21
# File 'lib/podio/models/organization_member.rb', line 19

def find(org_id, user_id)
  member Podio.connection.get("/org/#{org_id}/member/#{user_id}").body
end

.find_all_for_org(org_id, options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/podio/models/organization_member.rb', line 13

def find_all_for_org(org_id, options = {})
  list Podio.connection.get { |req|
    req.url("/org/#{org_id}/member/", options)
  }.body
end

.make_admin(org_id, user_id) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/podio/models/organization_member.rb', line 27

def make_admin(org_id, user_id)
  response = Podio.connection.post do |req|
    req.url "/org/#{org_id}/admin/"
    req.body = { :user_id => user_id.to_i }
  end
  response.status
end

.remove_admin(org_id, user_id) ⇒ Object



35
36
37
# File 'lib/podio/models/organization_member.rb', line 35

def remove_admin(org_id, user_id)
  Podio.connection.delete("/org/#{org_id}/admin/#{user_id}").status
end