Class: RollbarApi::Account
- Inherits:
-
Object
- Object
- RollbarApi::Account
- Defined in:
- lib/rollbar-api/account.rb
Constant Summary collapse
- @@accounts =
{}
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
- .all ⇒ Object
- .configure(account_name, account_access_token) ⇒ Object
- .delete_all ⇒ Object
- .find(account_name) ⇒ Object
Instance Method Summary collapse
-
#initialize(name, access_token) ⇒ Account
constructor
A new instance of Account.
Constructor Details
#initialize(name, access_token) ⇒ Account
Returns a new instance of Account.
24 25 26 27 |
# File 'lib/rollbar-api/account.rb', line 24 def initialize(name, access_token) @name = name @access_token = access_token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
23 24 25 |
# File 'lib/rollbar-api/account.rb', line 23 def access_token @access_token end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
23 24 25 |
# File 'lib/rollbar-api/account.rb', line 23 def name @name end |
Class Method Details
.all ⇒ Object
15 16 17 |
# File 'lib/rollbar-api/account.rb', line 15 def self.all @@accounts.map { |account_name, _| find(account_name) } end |
.configure(account_name, account_access_token) ⇒ Object
5 6 7 8 |
# File 'lib/rollbar-api/account.rb', line 5 def self.configure(account_name, account_access_token) @@accounts[account_name] = account_access_token find(account_name) end |
.delete_all ⇒ Object
19 20 21 |
# File 'lib/rollbar-api/account.rb', line 19 def self.delete_all @@accounts = {} end |
.find(account_name) ⇒ Object
10 11 12 13 |
# File 'lib/rollbar-api/account.rb', line 10 def self.find(account_name) account_access_token = @@accounts[account_name] new(account_name, account_access_token) if account_access_token.present? end |