Class: Podio::Application

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/application.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

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

.activate(id) ⇒ Object



103
104
105
# File 'lib/podio/models/application.rb', line 103

def activate(id)
  Podio.connection.post("/app/#{id}/activate").body
end

.create(attributes) ⇒ Object



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

def create(attributes)
  response = Podio.connection.post do |req|
    req.url "/app/"
    req.body = attributes
  end
  response.body['app_id']
end

.deactivate(id) ⇒ Object



99
100
101
# File 'lib/podio/models/application.rb', line 99

def deactivate(id)
  Podio.connection.post("/app/#{id}/deactivate").body
end

.delete(id) ⇒ Object



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

def delete(id)
  Podio.connection.delete("/app/#{id}").body
end

.delete_field(app_id, field_id) ⇒ Object



95
96
97
# File 'lib/podio/models/application.rb', line 95

def delete_field(app_id, field_id)
  Podio.connection.delete("/app/#{app_id}/field/#{field_id}").status
end

.find(app_id) ⇒ Object



37
38
39
# File 'lib/podio/models/application.rb', line 37

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

.find_all(options = {}) ⇒ Object



41
42
43
44
45
# File 'lib/podio/models/application.rb', line 41

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

.find_all_for_space(space_id, options = {}) ⇒ Object



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

def find_all_for_space(space_id, options = {})
  list Podio.connection.get { |req|
    req.url("/app/space/#{space_id}/", options)
  }.body
end

.find_top(options = {}) ⇒ Object



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

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

.find_top_for_org(org_id, options = {}) ⇒ Object



52
53
54
55
56
# File 'lib/podio/models/application.rb', line 52

def find_top_for_org(org_id, options={})
  list Podio.connection.get { |req|
    req.url("/app/org/#{org_id}/top/", options)
  }.body
end

.get_calculations(app_id) ⇒ Object



64
65
66
67
68
# File 'lib/podio/models/application.rb', line 64

def get_calculations(app_id)
  list Podio.connection.get { |req|
    req.url("/app/#{app_id}/calculation/", {})
  }.body
end

.install_on_mobile(id) ⇒ Object



111
112
113
# File 'lib/podio/models/application.rb', line 111

def install_on_mobile(id)
  Podio.connection.post("/mobile/install_app/#{id}").body
end

.update(app_id, attributes) ⇒ Object



87
88
89
90
91
92
93
# File 'lib/podio/models/application.rb', line 87

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

.update_order(space_id, app_ids = []) ⇒ Object



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

def update_order(space_id, app_ids = [])
  response = Podio.connection.put do |req|
    req.url "/app/space/#{space_id}/order"
    req.body = app_ids
  end

  response.body
end

Instance Method Details

#item_nameObject



32
33
34
# File 'lib/podio/models/application.rb', line 32

def item_name
  self[:item_name] || self.config['item_name']
end

#nameObject



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

def name
  self[:name] || self.config['name']
end