lib/dailycred.rb in dailycred-0.1.25 vs lib/dailycred.rb in dailycred-0.1.26

- old
+ new

@@ -60,12 +60,28 @@ :tag => tag } post "/admin/api/user/untag.json", opts end - def post(url, opts) - opts.merge! base_opts + # Send a reset password email + # + # - @param [string] user the user's email or username + def passReset(user) + opts = { + :user => user + } + post "/password/api/reset", opts + end + + # A wildcard for making any post requests to dailycred. + # client_id and client_secret are automatically added to the request + # + # - @param [string] url + # - @param [hash] opts + # - @param [boolean] secure whether the client_secret should be passed. Defaults to true + def post(url, opts, secure=true) + opts.merge! base_opts(secure) response = get_conn.post url, opts end private @@ -75,14 +91,13 @@ opts[:ssl] = @options[:client_options][:ssl] end opts end - def base_opts - { - :client_id => @client_id, - :client_secret => @secret_key - } + def base_opts secure=true + opts = {:client_id => @client_id} + opts[:client_secret] = @secret_key if secure + opts end def get_conn Faraday::Connection.new @url, ssl_opts end