Class: Dawn::Key
Overview
:nodoc:
Class Method Summary collapse
- .all(options = {}) ⇒ Array<Dawn::Key>
- .create(options = {}) ⇒ Dawn::Key
- .destroy(options = {}) ⇒ Void
- .find(options = {}) ⇒ Dawn::Key
Instance Method Summary collapse
- #destroy(options = {}) ⇒ Void
-
#initialize(data) ⇒ Key
constructor
A new instance of Key.
Methods included from BaseApi
Methods included from BaseApi::RequestExtension
Methods included from SafeExtension
Constructor Details
#initialize(data) ⇒ Key
Returns a new instance of Key.
21 22 23 |
# File 'lib/dawn/api/models/key.rb', line 21 def initialize(data) @data = data end |
Class Method Details
.all(options = {}) ⇒ Array<Dawn::Key>
49 50 51 52 53 54 |
# File 'lib/dawn/api/models/key.rb', line 49 def self.all(={}) get( path: '/account/keys', query: ).map { |hsh| new hsh["key"] } end |
.create(options = {}) ⇒ Dawn::Key
36 37 38 39 40 41 42 43 |
# File 'lib/dawn/api/models/key.rb', line 36 def self.create(={}) .fetch(:key) new post( path: '/account/keys', body: .to_json )["key"] end |
.destroy(options = {}) ⇒ Void
72 73 74 75 76 77 78 79 |
# File 'lib/dawn/api/models/key.rb', line 72 def self.destroy(={}) id = id_param() delete( path: "/account/keys/#{id}", query: ) end |
.find(options = {}) ⇒ Dawn::Key
60 61 62 63 64 65 66 67 |
# File 'lib/dawn/api/models/key.rb', line 60 def self.find(={}) id = id_param() new get( path: "/account/keys/#{id}", query: )["key"] end |
Instance Method Details
#destroy(options = {}) ⇒ Void
28 29 30 |
# File 'lib/dawn/api/models/key.rb', line 28 def destroy(={}) self.class.destroy(.merge(id: id)) end |