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

#==, #[], #[]=, #api_friendly_ref_type, #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



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

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

.find(org_id, user_id) ⇒ Object



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

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



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

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



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

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



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

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