connect_wise_web_reports 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67eec370a164ecc8c560b0506acdb1d1320bd32a
4
- data.tar.gz: f0e04e5d1413b1581317e34254c41b423610ac9c
3
+ metadata.gz: 085d9e2b4bb5e954cbbae643bcd48ac26960bf46
4
+ data.tar.gz: bb691e363fb58740afe1e51261826ae1a0ea0564
5
5
  SHA512:
6
- metadata.gz: c62891b63bbaf575f34cd8247411ddb9aae0209282baf17d3c53588054a793e1018b8d62a3e682b82e999bd187bfccae4303207268bb0178f0a6fcfbb7f532c4
7
- data.tar.gz: f6100e573c77a70a89c5c104671881ee5c9767cdd8d2e5d860fbbc91b929647f3b9aed95f691671d439463411c72fdf1348719c04f7e2797042f1852cb782657
6
+ metadata.gz: 580b463eaf8b94478531f6ed35e3978a2a49fac60f71593209bd5fe221db46c330cb4e5b1ce94ae872b73ae478c91752eb495484e98e0bf728be23b54f3aa5ea
7
+ data.tar.gz: 296e004f1ed0de8ace35864d78475517334bdfec1d5c24894457e49ca6b8d2cc86b2a39f1c8560e8efc3bc482dd8f4857d0c54116e54e060477d68a3568a048a
@@ -4,6 +4,41 @@ module ConnectWiseWebReports
4
4
 
5
5
  attr_accessor :options, :name, :records
6
6
 
7
+ # Generate the Web Report request url.
8
+ #
9
+ # @param name [String]
10
+ # @param options [Hash]
11
+ # @return [String]
12
+ def self.url(name, options = {})
13
+ url = "https://#{options[:host]}/#{options[:version]}/webreport/"
14
+
15
+ # Report
16
+ url += "?r=#{name}"
17
+
18
+ # API credentials
19
+ url += "&c=#{options[:company_id].to_s}"
20
+ url += "&u=#{options[:integrator_id].to_s}"
21
+ url += "&p=#{options[:integrator_password].to_s}"
22
+
23
+ #order
24
+ url += "&o=#{options[:order_by].to_s}" unless options[:order_by].nil?
25
+
26
+ # pagination
27
+ url += "&l=#{options[:limit].to_s}" unless options[:limit].nil?
28
+ url += "&s=#{options[:skip].to_s}" unless options[:skip].nil?
29
+
30
+ # timeout
31
+ url += "&t=#{options[:timeout].to_s}" unless options[:timeout].nil?
32
+
33
+ # fields
34
+ url += "&f=#{options[:fields].join('&f=')}" unless options[:fields].nil? || options[:fields].empty?
35
+
36
+ # conditions
37
+ url += "&q=#{options[:conditions]}" unless options[:conditions].blank?
38
+
39
+ return URI.escape(url)
40
+ end
41
+
7
42
  def initialize(name, options = {})
8
43
  @name = name
9
44
  @options = ConnectWiseWebReports::DEFAULT_OPTIONS.merge(options)
@@ -25,37 +60,8 @@ module ConnectWiseWebReports
25
60
  return self.records
26
61
  end
27
62
 
28
- # Generate the Web Report request url.
29
- #
30
- # @return [String]
31
63
  def url
32
- url = "https://#{self.options[:host]}/#{self.options[:version]}/webreport/"
33
-
34
- # Report
35
- url += "?r=#{self.name}"
36
-
37
- # API credentials
38
- url += "&c=#{self.options[:company_id].to_s}"
39
- url += "&u=#{self.options[:integrator_id].to_s}"
40
- url += "&p=#{self.options[:integrator_password].to_s}"
41
-
42
- #order
43
- url += "&o=#{self.options[:order_by].to_s}" unless self.options[:order_by].nil?
44
-
45
- # pagination
46
- url += "&l=#{self.options[:limit].to_s}" unless self.options[:limit].nil?
47
- url += "&s=#{self.options[:skip].to_s}" unless self.options[:skip].nil?
48
-
49
- # timeout
50
- url += "&t=#{self.options[:timeout].to_s}" unless self.options[:timeout].nil?
51
-
52
- # fields
53
- url += "&f=#{self.options[:fields].join('&f=')}" unless self.options[:fields].nil? || self.options[:fields].empty?
54
-
55
- # conditions
56
- url += "&q=#{self.options[:conditions]}" unless self.options[:conditions].blank?
57
-
58
- return URI.escape(url)
64
+ Report.url(self.name, self.options)
59
65
  end
60
66
 
61
67
  def parse_records(rows)
@@ -1,3 +1,3 @@
1
1
  module ConnectWiseWebReports
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: connect_wise_web_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Pheasey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-19 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler