Class: EatabitRails::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/eatabit_rails/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Account

Returns a new instance of Account.



10
11
12
13
14
15
# File 'lib/eatabit_rails/account.rb', line 10

def initialize(attributes)
  @name         = attributes['name']
  @environment  = attributes['environment']
  @enabled      = attributes['enabled']
  @created_at   = attributes['created_at']
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



5
6
7
# File 'lib/eatabit_rails/account.rb', line 5

def created_at
  @created_at
end

#enabledObject (readonly)

Returns the value of attribute enabled.



5
6
7
# File 'lib/eatabit_rails/account.rb', line 5

def enabled
  @enabled
end

#environmentObject (readonly)

Returns the value of attribute environment.



5
6
7
# File 'lib/eatabit_rails/account.rb', line 5

def environment
  @environment
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/eatabit_rails/account.rb', line 5

def name
  @name
end

Class Method Details

.findObject



17
18
19
20
21
22
23
24
# File 'lib/eatabit_rails/account.rb', line 17

def self.find
   = EatabitRails::REST::Uri.new.
  params      = EatabitRails::REST::Uri.default_params
  response    = RestClient.get , params
  attributes  = JSON.parse(response.body)['account']

  new(attributes)
end