class Podio::Category

@see developers.podio.com/doc/app-store

Public Class Methods

create(attributes) click to toggle source
# File lib/podio/models/category.rb, line 10
def create(attributes)
  response = Podio.connection.post do |req|
    req.url "/app_store/category/"
    req.body = attributes
  end

  response.status
end
delete(id) click to toggle source
# File lib/podio/models/category.rb, line 28
def delete(id)
  Podio.connection.delete("/app_store/category/#{id}").status
end
find(id) click to toggle source
# File lib/podio/models/category.rb, line 32
def find(id)
  member Podio.connection.get("/app_store/category/#{id}/v2").body
end
find_all(options = {}) click to toggle source
# File lib/podio/models/category.rb, line 36
def find_all(options = {})
  collection Podio.connection.get { |req|
    req.url("/app_store/category/", options)
  }.body
end
update(id, attributes) click to toggle source
# File lib/podio/models/category.rb, line 19
def update(id, attributes)
  response = Podio.connection.put do |req|
    req.url "/app_store/category/#{id}"
    req.body = attributes
  end

  response.status
end

Private Class Methods

collection(response) click to toggle source
# File lib/podio/models/category.rb, line 44
def collection(response)
  return Struct.new(:functional, :vertical).new([], []) if response.blank?
  functionals = response['functional'].map! { |cat| member(cat) }
  verticals   = response['vertical'].map! { |cat| member(cat) }
  Struct.new(:functional, :vertical).new(functionals, verticals)
end