Class: Podio::OrganizationProfile

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

Overview

Encapsulates an organization profile, primarily used for in app store

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

.create(org_id, attributes) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/podio/models/organization_profile.rb', line 48

def create(org_id, attributes)
  response = Podio.connection.post do |req|
    req.url "/org/#{org_id}/appstore"
    req.body = attributes
  end

  response.body
end

.delete(org_id) ⇒ Object



67
68
69
# File 'lib/podio/models/organization_profile.rb', line 67

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

.find(org_id) ⇒ Object



39
40
41
# File 'lib/podio/models/organization_profile.rb', line 39

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

.find_by_url(url_label) ⇒ Object



43
44
45
# File 'lib/podio/models/organization_profile.rb', line 43

def find_by_url(url_label)
  member Podio.connection.get("/app_store/org/#{url_label}/profile").body
end

.update(org_id, attributes) ⇒ Object



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

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

Instance Method Details

#createObject



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

def create
  self.class.create(self.org_id, self.attributes)
end

#destroyObject



33
34
35
# File 'lib/podio/models/organization_profile.rb', line 33

def destroy
  self.class.delete(self.org_id)
end

#updateObject



28
29
30
# File 'lib/podio/models/organization_profile.rb', line 28

def update
  self.class.update(self.org_id, self.attributes)
end