lib/client.rb in nsisam-0.2.2 vs lib/client.rb in nsisam-0.2.3

- old
+ new

@@ -1,19 +1,26 @@ require "json" require "net/http" require "errors" -module Client - +module NSISam class Client + # Initialize a client to a SAM node hosted at a specific url + # + # @param [String] url the SAM node url + # @return [Client] the object itself def initialize(url) user_and_pass = url.match(/(\w+):(\w+)/) @user, @password = user_and_pass[1], user_and_pass[2] @url = url.match(/@(.*):/)[1] @port = url.match(/([0-9]+)(\/)?$/)[1] end + # Store a given data in SAM + # + # @param [String] data the desired data to store + # @return [Hash] response with the data key and checksum def store(data) request_data = {:value => data}.to_json request = prepare_request :PUT, request_data execute_request(request) end