Class: CF::Account

Inherits:
Object
  • Object
show all
Includes:
Client
Defined in:
lib/cf/account.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.errorsObject

Contains Error message if any



8
9
10
# File 'lib/cf/account.rb', line 8

def errors
  @errors
end

Class Method Details

.infoObject

Returns Account Info

Usage Example:

CF::Account.info


13
14
15
16
17
# File 'lib/cf/account.rb', line 13

def info
  resp = get('/account.json')
  self.errors = resp['error']['message'] if resp['code'] != 200
  return resp
end

.login(email, passwd) ⇒ Object

Login to CloudFactory app through cloudfactory GEM

Usage Example:

CF::Account.("[email protected]", "password")


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

def (email, passwd)
  resp = post('/account_login.json', :user => {:email => email, :password => passwd})
  self.errors = resp['error']['message'] if resp['code'] != 200
  return resp
end

.valid?Boolean

Validation of account

Usage Example:

CF::Account.valid?

Returns:

  • (Boolean)


22
23
24
25
# File 'lib/cf/account.rb', line 22

def valid?
  info
  errors.nil?
end