Class: Podio::Extension

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/extension.rb

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes

Class Method Summary collapse

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(attributes, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/podio/models/extension.rb', line 34

def create(attributes, options={})
  response = Podio.connection.post do |req|
    req.url("/extension/", options)
    req.body = attributes
  end

  response.body
end

.delete(id) ⇒ Object



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

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

.find(id) ⇒ Object



73
74
75
# File 'lib/podio/models/extension.rb', line 73

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

.find_all(options = {}) ⇒ Object



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

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

.find_all_by_status(status, options = {}) ⇒ Object



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

def find_all_by_status(status, options = {})
  list Podio.connection.get { |req|
    req.url("/extension/status/#{status}", options)
  }.body
end

.find_all_for_current_user(options = {}) ⇒ Object



67
68
69
70
71
# File 'lib/podio/models/extension.rb', line 67

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

.find_overview(options = {}) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/podio/models/extension.rb', line 55

def find_overview(options = {})
  response = Podio.connection.get { |req|
    req.url("/extension/overview", options)
  }.body

  response['popular'] = list(response['popular'])
  response['staffpicks'] = list(response['staffpicks'])
  response['recent'] = list(response['recent'])

  response
end

.update(id, attributes, options = {}) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/podio/models/extension.rb', line 77

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