Class: AppformaAccount

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/sharkapps/account.rb

Class Method Summary collapse

Class Method Details

.check_admin_authorized(cur_account, userid = nil) ⇒ Object



30
31
32
33
34
35
# File 'lib/sharkapps/account.rb', line 30

def self.check_admin_authorized(, userid=nil)
  return false if userid == nil
  a = self.find("#{.fbid}-#{.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_yamlObject



6
7
8
9
10
# 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) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sharkapps/account.rb', line 12

def self.()
  acc = self.find("#{.fbid}-#{.acc_hash}-#{SharkApps.app_id}")#, :hash => account.acc_hash)
  .approval_status = acc.state
  unless acc.state == Subscription::UNAUTHORIZED
    .trial_remaining = acc.trial_remaining
  end
  .last_approval_check = Time.now
  if acc.reseller.blank?
    .footer_state = acc.branding
  else
    .footer_state = 0
  end
  .reseller = acc.reseller
  .reseller_url = acc.reseller_url
  .save(false)
  
end