Class: Dawn::Account
- Inherits:
-
Object
- Object
- Dawn::Account
- Includes:
- BaseApi
- Defined in:
- lib/dawn/api/models/account.rb
Overview
:nodoc:
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Account
constructor
A new instance of Account.
- #refresh(options = {}) ⇒ self
-
#save ⇒ self
Using the currently stored @data, #update self.
- #update(options = {}) ⇒ self
Methods included from BaseApi
Methods included from BaseApi::RequestExtension
Methods included from SafeExtension
Constructor Details
#initialize(data) ⇒ Account
Returns a new instance of Account.
23 24 25 |
# File 'lib/dawn/api/models/account.rb', line 23 def initialize(data) @data = data end |
Class Method Details
.current(options = {}) ⇒ Dawn::Account
65 66 67 68 69 70 |
# File 'lib/dawn/api/models/account.rb', line 65 def self.current(={}) new get( path: "/account", query: )["user"] end |
Instance Method Details
#refresh(options = {}) ⇒ self
31 32 33 34 35 36 37 |
# File 'lib/dawn/api/models/account.rb', line 31 def refresh(={}) @data = get( path: "/account", query: )["user"] self end |
#save ⇒ self
Using the currently stored @data, #update self
57 58 59 |
# File 'lib/dawn/api/models/account.rb', line 57 def save update(account: @data) end |
#update(options = {}) ⇒ self
43 44 45 46 47 48 49 50 51 |
# File 'lib/dawn/api/models/account.rb', line 43 def update(={}) .fetch(:account) @data = patch( path: "/account", body: .to_json )["user"] self end |