class Subscription

Constants

EXPIRED
TRIAL
UNAUTHORIZED
VALID

Public Class Methods

check_account_authorized(account_id, acc_hash) click to toggle source
# File lib/sharkapps/subscription.rb, line 10
def self.check_account_authorized(account_id, acc_hash)
  path = "#{self.site}accounts/app_authorized/#{account_id}/#{SharkApps.app_id}/#{acc_hash}.xml"
  url = URI.parse(path)
  req = Net::HTTP::Get.new(url.path)
  req.basic_auth self.user, self.password
  res = Net::HTTP.start(url.host, url.port) {|http|
    http.request(req)
  }
  
  return res.body
  #doc = REXML::Document.new(res.body)
end
check_admin_authorized(account_id, user_id) click to toggle source
# File lib/sharkapps/subscription.rb, line 24
def self.check_admin_authorized(account_id, user_id)
  path = "#{self.site}accounts/app_authorized/#{account_id}/#{user_id}.xml"
  url = URI.parse(path)
  req = Net::HTTP::Get.new(url.path)
  req.basic_auth self.user, self.password
  res = Net::HTTP.start(url.host, url.port) {|http|
    http.request(req)
  }
  
  return res.body
end
get_all_subscriptions(account) click to toggle source
# File lib/sharkapps/subscription.rb, line 36
def self.get_all_subscriptions(account)
  sub = Subscription.find(account.fbid)
  return sub.subscriptions unless sub.nil?
end
initialize_from_yaml() click to toggle source
# File lib/sharkapps/subscription.rb, line 41
def self.initialize_from_yaml
  self.site = SharkApps.server_url
  self.user = SharkApps.username
  self.password = SharkApps.password
end