Class: Podio::Organization

Inherits:
ActivePodio::Base show all
Includes:
ActivePodio::Updatable
Defined in:
lib/podio/models/organization.rb

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

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

Class Method Summary collapse

Instance 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

.create(attributes) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/podio/models/organization.rb', line 57

def create(attributes)
  response = Podio.connection.post do |req|
    req.url '/org/'
    req.body = attributes
  end

  response.body
end

.delete(id) ⇒ Object



53
54
55
# File 'lib/podio/models/organization.rb', line 53

def delete(id)
  Podio.connection.delete("/org/#{id}").status
end

.find(id) ⇒ Object



66
67
68
# File 'lib/podio/models/organization.rb', line 66

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

.find_allObject



81
82
83
# File 'lib/podio/models/organization.rb', line 81

def find_all
  list Podio.connection.get("/org/").body
end

.find_by_url(url) ⇒ Object



70
71
72
# File 'lib/podio/models/organization.rb', line 70

def find_by_url(url)
  member Podio.connection.get("/org/url?url=#{url}").body
end

.get_login_report(id, options = {}) ⇒ Object



93
94
95
96
97
# File 'lib/podio/models/organization.rb', line 93

def (id, options = {})
  Podio.connection.get { |req|
    req.url("/org/#{id}/report/login/", options)
  }.body
end

.get_member_count(id) ⇒ Object



89
90
91
# File 'lib/podio/models/organization.rb', line 89

def get_member_count(id)
  Podio.connection.get("/org/#{id}/member/count").body
end

.get_statistics(id) ⇒ Object



85
86
87
# File 'lib/podio/models/organization.rb', line 85

def get_statistics(id)
  Podio.connection.get("/org/#{id}/statistics").body
end

.update(id, attributes) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/podio/models/organization.rb', line 45

def update(id, attributes)
  response = Podio.connection.put do |req|
    req.url "/org/#{id}"
    req.body = attributes
  end
  response.status
end

.update_billing_profile(id, attributes) ⇒ Object



99
100
101
102
103
104
105
# File 'lib/podio/models/organization.rb', line 99

def update_billing_profile(id, attributes)
  response = Podio.connection.put do |req|
    req.url "/org/#{id}/billing"
    req.body = attributes
  end
  response.status
end

.upgrade(id) ⇒ Object



107
108
109
# File 'lib/podio/models/organization.rb', line 107

def upgrade(id)
  Podio.connection.post("/org/#{id}/upgrade").body
end

.validate_url_label(url_label) ⇒ Object



74
75
76
77
78
79
# File 'lib/podio/models/organization.rb', line 74

def validate_url_label(url_label)
  Podio.connection.post { |req|
    req.url '/org/url/validate'
    req.body = {:url_label => url_label}
  }.body
end

Instance Method Details

#createObject



31
32
33
34
35
36
# File 'lib/podio/models/organization.rb', line 31

def create
  attributes = Organization.create(:name => name, :logo => )
  self.org_id = attributes['org_id']
  self.url = attributes['url']
  self.url_label = attributes['url_label']
end

#updateObject



38
39
40
# File 'lib/podio/models/organization.rb', line 38

def update
  Organization.update(id, {:name => name, :logo => , :url_label => url_label, :billing_interval => billing_interval})
end