lib/berkshelf/api_client/remote_cookbook.rb in berkshelf-3.0.0.beta1 vs lib/berkshelf/api_client/remote_cookbook.rb in berkshelf-3.0.0.beta2
- old
+ new
@@ -1,5 +1,7 @@
+require 'json'
+
module Berkshelf
class APIClient
# A representation of cookbook metadata indexed by a Berkshelf API Server. Returned
# by sending messages to a {Berkshelf::APIClient} and used to download cookbooks
# indexed by the Berkshelf API Server.
@@ -34,9 +36,20 @@
end
# @return [String]
def location_path
@attributes[:location_path]
+ end
+
+ def to_hash
+ {
+ name: name,
+ version: version
+ }
+ end
+
+ def to_json(options = {})
+ ::JSON.pretty_generate(to_hash, options)
end
end
end
end