Class: Dawn::Key
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
- #fingerprint ⇒ Object
- #id ⇒ Object
-
#initialize(data) ⇒ Key
constructor
A new instance of Key.
- #key ⇒ Object
Methods included from BaseApi
Methods included from BaseApi::Extension
Constructor Details
#initialize(data) ⇒ Key
Returns a new instance of Key.
10 11 12 |
# File 'lib/dawn/api/key.rb', line 10 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/dawn/api/key.rb', line 8 def data @data end |
Class Method Details
.add(pubkey) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/dawn/api/key.rb', line 34 def self.add(pubkey) new json_request( method: :post, expects: 200, path: '/account/keys', query: { key: pubkey } )["key"] end |
.all(options = {}) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/dawn/api/key.rb', line 51 def self.all(={}) json_request( method: :get, expects: 200, path: '/account/keys', query: ).map { |hsh| new(hsh["key"]) } end |
.destroy(options = {}) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/dawn/api/key.rb', line 60 def self.destroy(={}) request( method: :delete, expects: 200, path: "/account/keys/#{[:id]}" ) end |
.get(id) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/dawn/api/key.rb', line 43 def self.get(id) new json_request( method: :get, expects: 200, path: "/account/keys/#{id}" )["key"] end |
Instance Method Details
#destroy ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/dawn/api/key.rb', line 26 def destroy request( method: :delete, expects: 200, path: "/account/keys/#{id}" ) end |
#fingerprint ⇒ Object
18 19 20 |
# File 'lib/dawn/api/key.rb', line 18 def fingerprint data["fingerprint"] end |
#id ⇒ Object
14 15 16 |
# File 'lib/dawn/api/key.rb', line 14 def id data["id"] end |
#key ⇒ Object
22 23 24 |
# File 'lib/dawn/api/key.rb', line 22 def key data["key"] end |