Class: Podio::Organization

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

Overview

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActivePodio::Updatable

#remove_nil_values, #update_attributes

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, has_many, has_one, #hash, #initialize, #initialize_attributes, klass_from_string, list, member, #new_record?, output_attribute_as_json, #parent_model, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.change_to_user_model(id) ⇒ Object



143
144
145
# File 'lib/podio/models/organization.rb', line 143

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

.create(attributes) ⇒ Object



70
71
72
73
74
75
76
77
# File 'lib/podio/models/organization.rb', line 70

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

  response.body
end

.delete(id) ⇒ Object



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

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

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



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

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

.find_all(options = {}) ⇒ Object



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

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

.find_all_with_private_sharesObject



131
132
133
# File 'lib/podio/models/organization.rb', line 131

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

.find_by_url(url) ⇒ Object



87
88
89
# File 'lib/podio/models/organization.rb', line 87

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

.find_by_url_slug(org_slug, options = {}) ⇒ Object



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

def find_by_url_slug(org_slug, options={})
  options['org_slug'] = org_slug

  member Podio.connection.get { |req|
    req.url('/org/url', options)
  }.body
end

.find_for_user(user_id) ⇒ Object



139
140
141
# File 'lib/podio/models/organization.rb', line 139

def find_for_user(user_id)
  list Podio.connection.get("/org/user/#{user_id}/").body
end

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



113
114
115
116
117
# File 'lib/podio/models/organization.rb', line 113

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

.get_statistics(id) ⇒ Object



135
136
137
# File 'lib/podio/models/organization.rb', line 135

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

.update(id, attributes) ⇒ Object



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

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



119
120
121
122
123
124
125
# File 'lib/podio/models/organization.rb', line 119

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



127
128
129
# File 'lib/podio/models/organization.rb', line 127

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

.validate_url_label(url_label) ⇒ Object



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

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



43
44
45
46
47
48
# File 'lib/podio/models/organization.rb', line 43

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

#updateObject



51
52
53
# File 'lib/podio/models/organization.rb', line 51

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