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, #error_code, #error_message, #error_parameters, #error_propagate

Class Method Summary collapse

Instance 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

.create(org_id, attributes) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/podio/models/organization_profile.rb', line 40

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



57
58
59
# File 'lib/podio/models/organization_profile.rb', line 57

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

.find(org_id) ⇒ Object



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

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

.update(org_id, attributes) ⇒ Object



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

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



21
22
23
# File 'lib/podio/models/organization_profile.rb', line 21

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

#destroyObject



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

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

#updateObject



25
26
27
# File 'lib/podio/models/organization_profile.rb', line 25

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