Class: Yao::Resources::Keypair

Inherits:
Base
  • Object
show all
Defined in:
lib/yao/resources/keypair.rb

Instance Attribute Summary

Attributes included from RestfullyAccessible

#service

Class Method Summary collapse

Methods inherited from Base

#[], #[]=, #created, friendly_attributes, #id, #initialize, map_attribute_to_attribute, map_attribute_to_resource, map_attribute_to_resources, #to_hash, #updated

Methods included from RestfullyAccessible

#admin=, #api_version, #api_version=, #as_member, #client, #create, #destroy, extended, #find_by_name, #get, #get!, #list, #resources_path, #resources_path=, #return_single_on_querying, #return_single_on_querying=, #update

Constructor Details

This class inherits a constructor from Yao::Resources::Base

Class Method Details

.list(query = {}) ⇒ Array<Yao::Resources::Keypairs>

os-keypairs API returns very complicated JSON. For example. {

"keypairs": [
  {
    "keypair": {
       "fingerprint": "...",
     }
  },
  {
    "keypair": {
       "fingerprint": "...",
     }
  },
]

Parameters:

  • query (Hash) (defaults to: {})

Returns:

  • (Array<Yao::Resources::Keypairs>)


27
28
29
30
31
32
# File 'lib/yao/resources/keypair.rb', line 27

def self.list(query={})
  res = GET(resources_name, query)
  res.body['keypairs'].map { |attribute|
    new(attribute['keypair'])
  }
end