module ConnectStoopid

ConnectStoopid::Company Provides an interface to the ConnectWise Time Entry API

ConnectStoopid::ReportingClient Provides an interface to the ConnectWise Reporting API

ConnectStoopid::TimeEntry Provides an interface to the ConnectWise Time Entry API

Constants

LOG_LEVELS
VERSION

Attributes

soap_client[RW]
wsdl[RW]

Public Class Methods

base_soap_hash() click to toggle source
# File lib/connect-stoopid.rb, line 54
def base_soap_hash
        request_options = {
                "credentials" => {
                        "CompanyId"          => @company,
                        "IntegratorLoginId"  => @username,
                        "IntegratorPassword" => @password
                }
        }
        return request_options
end
connect(company, username, password, options = {}) click to toggle source

Parameters:

psa_address -- The hostname of your ConnectWise PSA, ie. con.companyconnect.net
company -- Company id used when logging into ConnectWise
username -- ConnectWise Integration username
password -- ConnectWise Integration password
options -- Override the default ReportingClient options
# File lib/connect-stoopid.rb, line 24
def connect(company, username, password, options = {})
        @company  = company
        @username = username
        @password = password

        @client_options = {
                :client_logging       => true,
                :client_logging_level => :error,
                :soap_version         => 2,
                :soap_logging         => false,
                :soap_logging_level   => :fatal
        }
        @client_options.merge!(options)

        @soap_client = Savon.client({
                :wsdl         => @wsdl,
                :soap_version => @client_options[:soap_version],
                :log          => @client_options[:soap_logging],
                :log_level    => @client_options[:soap_logging_level]
        })
end
log_client_message(message, level = :error) click to toggle source
# File lib/connect-stoopid.rb, line 46
def log_client_message(message, level = :error)
        if logging
                if LOG_LEVELS[level] >= LOG_LEVELS[@client_options[:client_logging_level]]
                        puts "#{self.class.to_s.split("::").last} Logger -- #{message}"
                end
        end
end

Private Class Methods

logging() click to toggle source
# File lib/connect-stoopid.rb, line 73
def logging
        return @client_options[:client_logging]
end