Class: EatabitRails::Account
- Inherits:
-
Object
- Object
- EatabitRails::Account
- Defined in:
- lib/eatabit_rails/account.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Account
constructor
A new instance of Account.
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_at ⇒ Object (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 |
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/eatabit_rails/account.rb', line 5 def enabled @enabled end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
5 6 7 |
# File 'lib/eatabit_rails/account.rb', line 5 def environment @environment end |
#name ⇒ Object (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
.find ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/eatabit_rails/account.rb', line 17 def self.find account_uri = EatabitRails::REST::Uri.new.account params = EatabitRails::REST::Uri.default_params response = RestClient.get account_uri, params attributes = JSON.parse(response.body)['account'] new(attributes) end |