class Podio::AppStoreShare

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

Public Class Methods

create(attributes) click to toggle source

@see developers.podio.com/doc/app-market/share-app-22504

# File lib/podio/models/app_store_share.rb, line 58
def create(attributes)
  response = Podio.connection.post do |req|
    req.url "/app_store/"
    req.body = attributes
  end

  response.body['share_id']
end
destroy(id) click to toggle source

@see developers.podio.com/doc/app-market/unshare-app-37917

# File lib/podio/models/app_store_share.rb, line 76
def destroy(id)
  response = Podio.connection.delete do |req|
    req.url "/app_store/#{id}"
  end
end
find(id, options = {}) click to toggle source
# File lib/podio/models/app_store_share.rb, line 92
def find(id, options = {})
  member Podio.connection.get { |req|
    req.url "/app_store/#{id}/v2", options
  }.body
end
find_all_by_category(share_type, category_id, options = {}) click to toggle source
# File lib/podio/models/app_store_share.rb, line 144
def find_all_by_category(share_type, category_id, options = {})
  shares_collection Podio.connection.get { |req|
    req.url("/app_store/#{share_type}/category/#{category_id}/", options)
  }.body
end
find_all_by_reference(ref_type, ref_id) click to toggle source

@see developers.podio.com/doc/app-market/get-share-by-reference-45002

# File lib/podio/models/app_store_share.rb, line 134
def find_all_by_reference(ref_type, ref_id)
  list Podio.connection.get("/app_store/#{ref_type}/#{ref_id}/").body
end
find_all_own(share_type, options = {}) click to toggle source

@see developers.podio.com/doc/app-market/get-own-shares-38645

# File lib/podio/models/app_store_share.rb, line 99
def find_all_own(share_type, options = {})
  shares_collection Podio.connection.get { |req|
    req.url "/app_store/#{share_type}/own/", options
  }.body
end
find_all_private_for_org(share_type, org_id, options = {}) click to toggle source
# File lib/podio/models/app_store_share.rb, line 105
def find_all_private_for_org(share_type, org_id, options = {})
  shares_collection Podio.connection.get { |req|
    req.url "/app_store/#{share_type}/org/#{org_id}/", options
  }.body
end
find_all_public_for_org(share_type, org_url, options = {}) click to toggle source
# File lib/podio/models/app_store_share.rb, line 111
def find_all_public_for_org(share_type, org_url, options = {})
  shares_collection Podio.connection.get { |req|
    req.url "/app_store/#{share_type}/org/#{org_url}/", options
  }.body
end
find_top(share_type, options = {}) click to toggle source
# File lib/podio/models/app_store_share.rb, line 138
def find_top(share_type, options = {})
  shares_collection Podio.connection.get { |req|
    req.url("/app_store/#{share_type}/top/", options)
  }.body
end
install(share_id, space_id, dependencies, social = true) click to toggle source

@see developers.podio.com/doc/app-market/install-share-22499

# File lib/podio/models/app_store_share.rb, line 83
def install(share_id, space_id, dependencies, social = true)
  response = Podio.connection.post do |req|
    req.url "/app_store/#{share_id}/install/v2"
    req.body = {:space_id => space_id, :dependencies => dependencies, :social => social}
  end

  response.body
end
update(id, attributes) click to toggle source

@see developers.podio.com/doc/app-market/update-share-38639

# File lib/podio/models/app_store_share.rb, line 68
def update(id, attributes)
  response = Podio.connection.put do |req|
    req.url "/app_store/#{id}"
    req.body = attributes
  end
end

Private Class Methods

shares_collection(response) click to toggle source
# File lib/podio/models/app_store_share.rb, line 158
def shares_collection(response)
  result = Struct.new(:all, :total_count).new(response['shares'], response['total'])
  result.all.map! { |share| new(share, :values_from_api => true) } if result.all.present?
  result
end

Public Instance Methods

api_friendly_ref_type() click to toggle source
# File lib/podio/models/app_store_share.rb, line 51
def api_friendly_ref_type
  'share'
end
create() click to toggle source

@see developers.podio.com/doc/app-market/share-app-22504

# File lib/podio/models/app_store_share.rb, line 37
def create
  self.share_id = self.class.create(self.attributes)
end
destroy() click to toggle source

@see developers.podio.com/doc/app-market/unshare-app-37917

# File lib/podio/models/app_store_share.rb, line 42
def destroy
  self.class.destroy(self.share_id)
end
install(space_id, dependencies, social = true) click to toggle source

@see developers.podio.com/doc/app-market/install-share-22499

# File lib/podio/models/app_store_share.rb, line 47
def install(space_id, dependencies, social = true)
  self.class.install(self.share_id, space_id, dependencies, social)
end