vimaly 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/vimaly/client.rb +25 -2
- data/lib/vimaly/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fbe16192cd230b1bc9195d5ef9f8faea9c0bdd99041be3b04abf87fb26f27e6
|
4
|
+
data.tar.gz: 713fa776cc88c0cf8b37dcbeae00cc4a3faabc5da76e17ad36c1e4cfd37fe385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f68b2e105cf61343ac2d2eb452ac3bb1b427deef775fc0d31b9a327839debe8a403a2c37780bd013275b16b8b70fde7be07a2211ba2ce12b670a99711b05c416
|
7
|
+
data.tar.gz: c50e2bb91e042557c69a74a608c6625898b6272359822e4c10e846e86aaad959e1d408d3babcc194e6be130c94dd94449703294c7a412c8e0cffd5efdfc9a1e8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.3.0
|
4
|
+
|
5
|
+
* add support for more than 200 results when searching for tickets [#22](https://github.com/sharesight/vimaly/pull/22)
|
6
|
+
|
3
7
|
## 1.2.0
|
4
8
|
|
5
9
|
* add support for more than 500 bins, refactored and options added [#21](https://github.com/sharesight/vimaly/pull/21)
|
data/lib/vimaly/client.rb
CHANGED
@@ -58,9 +58,32 @@ module Vimaly
|
|
58
58
|
ticket_type_map = Hash[ticket_types.map { |t| [t.id, t] }]
|
59
59
|
bin_map = Hash[bins.map { |b| [b.id, b] }]
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
tickets = []
|
62
|
+
i = 0
|
63
|
+
|
64
|
+
while (i * 500) <= 5000
|
65
|
+
# Without max-results the request defaults to 200.
|
66
|
+
# The maximum max-results is 500, so will do 10 requests to get our maximum of 5000 tickets.
|
67
|
+
search_response = get("/ticket-search?text=#{query_string}&state=#{state}&max-results=500&page-token=#{i * 500}")
|
68
|
+
|
69
|
+
response_tickets = case search_response
|
70
|
+
when Array
|
71
|
+
search_response.map do |ticket_data|
|
72
|
+
Ticket.from_vimaly(ticket_data, ticket_type_map, bin_map, custom_fields)
|
73
|
+
end
|
74
|
+
when Hash # Will be a hash when only 1 ticket is returned.
|
75
|
+
[Ticket.from_vimaly(search_response, ticket_type_map, bin_map, custom_fields)]
|
76
|
+
else # If reponse is nil then we know we've got all the data
|
77
|
+
break
|
78
|
+
end
|
79
|
+
|
80
|
+
tickets.concat(response_tickets)
|
81
|
+
break if response_tickets.size < 500 # Can finish search because we've returned all there is.
|
82
|
+
|
83
|
+
i += 1
|
63
84
|
end
|
85
|
+
|
86
|
+
tickets
|
64
87
|
end
|
65
88
|
|
66
89
|
def add_attachment(ticket_id, file_name, file_content, request_options={})
|
data/lib/vimaly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimaly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorsten Boettger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
|
-
rubygems_version: 3.
|
184
|
+
rubygems_version: 3.0.6
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Wrapper for the Vimaly API
|