diff options
Diffstat (limited to 'lib/chef/api_client.rb')
-rw-r--r-- | lib/chef/api_client.rb | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/chef/api_client.rb b/lib/chef/api_client.rb index c27dfe82ba..a3346b5b68 100644 --- a/lib/chef/api_client.rb +++ b/lib/chef/api_client.rb @@ -124,21 +124,22 @@ class Chef Chef::JSONCompat.to_json(to_hash, *a) end - class << self - def from_hash(o) - client = Chef::ApiClient.new - client.name(o["name"] || o["clientname"]) - client.private_key(o["private_key"]) if o.key?("private_key") - client.public_key(o["public_key"]) - client.admin(o["admin"]) - client.validator(o["validator"]) - client - end - alias :json_create :from_hash + def self.from_hash(o) + client = Chef::ApiClient.new + client.name(o["name"] || o["clientname"]) + client.private_key(o["private_key"]) if o.key?("private_key") + client.public_key(o["public_key"]) + client.admin(o["admin"]) + client.validator(o["validator"]) + client + end - def from_json(j) - Chef::ApiClient.from_hash(Chef::JSONCompat.parse(j)) - end + def self.json_create(data) + from_hash(data) + end + + def self.from_json(j) + from_hash(Chef::JSONCompat.parse(j)) end def self.http_api |