lib/ps_utilities/connection.rb
# this runs the various options:
# @param command: [Symbol] - commands include direct api calls: :authenticate, :delete, :get, :patch, :post, :put (these require api_path: and options: params) & also pre-built commands - see included methods (they require params:)
# @param api_path: [String] - this is the api_endpoint (only needed for direct api calls)
# @param options: [Hash] - this is the data body or the query options (needed for direct api calls)
# @param params: [Hash] - this is the data needed for using pre-built commands - see the individual command for details
# @note with no command an authenticatation check is done
this runs the various options.
this runs the various options .
def run(command: nil, api_path: "", options: {}, params: {})
      authenticate                            unless auth_valid?
      case command
      when nil, :authenticate
        authenticate
      when :delete, :get, :patch, :post, :put
        api(command, api_path, options)       unless api_path.empty?
      else
        send(command, params)
      end
      rescue ArgumentError => error
        return {"error_message" => error.message}
    end
def run ( command : nil , api_path : "" , options : { } , params : { } ) authenticate unless auth_valid? case command when nil , :authenticate authenticate when :delete , :get , :patch , :post , :put api ( command , api_path , options ) unless api_path . empty? else send ( command , params ) end rescue ArgumentError => error return { "error_message" => error . message } end
this runs the various options:
this runs the various options :
# TODO: panick if api_path empty
command
api_path
options
params
command:
commands include direct api calls: :authenticate, :delete, :get, :patch, :post, :put (these require api_path: and options: params) & also pre-built commands - see included methods (they require params:)
commands include direct api calls : : authenticate : delete : get : patch : post : put ( these require api_path : and options : params ) & also pre - built commands - see included methods ( they require params : )
api_path:
this is the api_endpoint (only needed for direct api calls)
this is the api_endpoint ( only needed for direct api calls )
options:
this is the data body or the query options (needed for direct api calls)
this is the data body or the query options ( needed for direct api calls )
params:
this is the data needed for using pre-built commands - see the individual command for details
this is the data needed for using pre - built commands - see the individual command for details
note
with no command an authenticatation check is done
with no command an authenticatation check is done