Module: ConnectWiseWebReports
- Defined in:
- lib/connect_wise_web_reports.rb,
lib/connect_wise_web_reports/error.rb,
lib/connect_wise_web_reports/report.rb,
lib/connect_wise_web_reports/version.rb,
lib/connect_wise_web_reports/configuration.rb
Defined Under Namespace
Classes: Configuration, ConnectionError, Report
Constant Summary collapse
- DEFAULT_OPTIONS =
{ conditions: nil, fields: [], limit: 100, order_by: nil, skip: nil, timeout: 5, # authentication host: ConnectWiseWebReports.configuration.host, company_id: ConnectWiseWebReports.configuration.company_id, integrator_id: ConnectWiseWebReports.configuration.integrator_id, integrator_password: ConnectWiseWebReports.configuration.integrator_password, version: ConnectWiseWebReports.configuration.version, proxy_host: ConnectWiseWebReports.configuration.proxy_host, proxy_port: ConnectWiseWebReports.configuration.proxy_port, proxy_user: ConnectWiseWebReports.configuration.proxy_user, proxy_pass: ConnectWiseWebReports.configuration.proxy_pass }.freeze
- VERSION =
'1.2.0'
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
- .logger ⇒ Object
Class Method Summary collapse
-
.agent(options) ⇒ Mechanize
Create a new Mechanize agent.
- .configure {|configuration| ... } ⇒ Object
- .info(options) ⇒ Object
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
4 5 6 |
# File 'lib/connect_wise_web_reports/configuration.rb', line 4 def configuration @configuration end |
.logger ⇒ Object
32 33 34 35 36 |
# File 'lib/connect_wise_web_reports/configuration.rb', line 32 def logger @logger ||= Logger.new($stdout).tap do |log| log.progname = self.name end end |
Class Method Details
.agent(options) ⇒ Mechanize
Create a new Mechanize agent.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/connect_wise_web_reports.rb', line 33 def self.agent() Mechanize.new do |agent| if [:proxy_host] agent.set_proxy([:proxy_host], [:proxy_port], [:proxy_user], [:proxy_pass]) end agent.read_timeout = [:timeout] agent.keep_alive = false agent.idle_timeout = 5 end end |
.configure {|configuration| ... } ⇒ Object
11 12 13 |
# File 'lib/connect_wise_web_reports/configuration.rb', line 11 def self.configure yield(configuration) end |
.info(options) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/connect_wise_web_reports.rb', line 46 def self.info() = DEFAULT_OPTIONS.merge() url = "https://#{[:host]}/login/companyinfo/#{[:company_id]}" response = agent().get(url) return {} if response.content == 'null' JSON.parse(response.content) rescue StandardError => e raise ConnectionError.new(e.) end |