Class: AppformaAccount
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- AppformaAccount
- Defined in:
- lib/sharkapps/account.rb
Class Method Summary collapse
- .check_admin_authorized(cur_account, userid = nil) ⇒ Object
- .initialize_from_yaml ⇒ Object
- .set_account_info(cur_account) ⇒ Object
Class Method Details
.check_admin_authorized(cur_account, userid = nil) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/sharkapps/account.rb', line 24 def self.(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 ⇒ Object
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 |
# 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 cur_account. = acc.branding cur_account.save(false) cur_account end |