Module: ConnectWiseWebReports
- Defined in:
- lib/connect_wise_web_reports.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, 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 }
- VERSION =
'0.5.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.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/connect_wise_web_reports.rb', line 34 def self.agent() Mechanize.new do |agent| agent.set_proxy( [:proxy_host], [:proxy_port], [:proxy_user], [:proxy_pass] ) unless [:proxy_host].nil? 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
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/connect_wise_web_reports.rb', line 49 def self.info() = DEFAULT_OPTIONS.merge() url = "https://#{[:host]}/login/companyinfo/#{[:company_id]}" response = agent().get(url) if response.content == 'null' return {} else return JSON.parse(response.content) end end |