Method: Megam::SshKey.json_create

Defined in:
lib/megam/core/sshkey.rb

.json_create(o) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/megam/core/sshkey.rb', line 111

def self.json_create(o)
    sshKey = new({})
    sshKey.id(o["id"]) if o.has_key?("id")
    sshKey.name(o["name"]) if o.has_key?("name")
    sshKey.privatekey(o["privatekey"]) if o.has_key?("privatekey")
    sshKey.publickey(o["publickey"]) if o.has_key?("publickey")
    sshKey.created_at(o["created_at"]) if o.has_key?("created_at")
    #success or error
    sshKey.some_msg[:code] = o["code"] if o.has_key?("code")
    sshKey.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
    sshKey.some_msg[:msg]= o["msg"] if o.has_key?("msg")
    sshKey.some_msg[:links] = o["links"] if o.has_key?("links")
    sshKey
end