class AppformaAccount

Public Class Methods

check_admin_authorized(cur_account, userid=nil) click to toggle source
# File lib/sharkapps/account.rb, line 30
def self.check_admin_authorized(cur_account, userid=nil)
  return false if userid == nil
  a = self.find("#{cur_account.fbid}-#{cur_account.acc_hash}-#{SharkApps.app_id}")
  c_array = a.collaborators.select {|c| c.fbid.to_s == userid.to_s}
  return c_array.empty? == false
end
initialize_from_yaml() click to toggle source
# File lib/sharkapps/account.rb, line 6
def self.initialize_from_yaml
  self.site = SharkApps.server_url
  self.user = SharkApps.username
  self.password = SharkApps.password
end
set_account_info(cur_account) click to toggle source
# File lib/sharkapps/account.rb, line 12
def self.set_account_info(cur_account)
  acc = self.find("#{cur_account.fbid}-#{cur_account.acc_hash}-#{SharkApps.app_id}")#, :hash => account.acc_hash)
  cur_account.approval_status = acc.state
  unless acc.state == Subscription::UNAUTHORIZED
    cur_account.trial_remaining = acc.trial_remaining
  end
  cur_account.last_approval_check = Time.now
  if acc.reseller.blank?
    cur_account.footer_state = acc.branding
  else
    cur_account.footer_state = 0
  end
  cur_account.reseller = acc.reseller
  cur_account.reseller_url = acc.reseller_url
  cur_account.save(false)
  cur_account
end