vimaly 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -0
- data/CHANGELOG.md +20 -0
- data/lib/vimaly/client.rb +28 -5
- data/lib/vimaly/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e67a18552b8d4a3c3bf527a2bb4fb859a15b8c59e0fded3fc7f5138df00d375
|
4
|
+
data.tar.gz: 5a1c9269b2556e45fe0eb867f4ad31f4fa73b11bd581da743ea5dc15eca2717c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610de2b9dac4235222006ab0361a3d62f0c42ff6c6a67e5c6173ddb700ba19608a17f51e6d06c7d07bdf10b3791f3a88fe9dd98bf52a3cd6f355fb227a474142
|
7
|
+
data.tar.gz: a58e11c17157e1192383164018457b11502f6b284582432c6d04224bdbd7365f2a322847cfd7eebb8176f713a5025098276683bcee79277a9b6294d487741c4d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5
|
1
|
+
2.6.5
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.2.0
|
4
|
+
|
5
|
+
* add support for more than 500 bins, refactored and options added [#21](https://github.com/sharesight/vimaly/pull/21)
|
6
|
+
|
7
|
+
## 1.1.1
|
8
|
+
|
9
|
+
* add support for more than 500 bins [#20](https://github.com/sharesight/vimaly/pull/20)
|
10
|
+
|
11
|
+
## 1.1.0
|
12
|
+
|
13
|
+
* add support for searching tickets [#19](https://github.com/sharesight/vimaly/pull/19)
|
14
|
+
|
15
|
+
## 1.0.2
|
16
|
+
|
17
|
+
* Fix unfriendly filenames not attaching to Vimaly tickets [#17](https://github.com/sharesight/vimaly/pull/17)
|
18
|
+
|
19
|
+
## 1.0.1
|
20
|
+
|
21
|
+
* Update for Ruby 2.6.3 compatibility.
|
22
|
+
|
3
23
|
## 1.0.0
|
4
24
|
|
5
25
|
* allow adding attachments with providing a content-type [#15](https://github.com/sharesight/vimaly/pull/15)
|
data/lib/vimaly/client.rb
CHANGED
@@ -54,8 +54,17 @@ module Vimaly
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
def search_tickets(query_string, state: 'active')
|
58
|
+
ticket_type_map = Hash[ticket_types.map { |t| [t.id, t] }]
|
59
|
+
bin_map = Hash[bins.map { |b| [b.id, b] }]
|
60
|
+
|
61
|
+
get("/ticket-search?text=#{query_string}&state=#{state}").map do |ticket_data|
|
62
|
+
Ticket.from_vimaly(ticket_data, ticket_type_map, bin_map, custom_fields)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
57
66
|
def add_attachment(ticket_id, file_name, file_content, request_options={})
|
58
|
-
response = post("/tickets/#{ticket_id}/attachments?name=#{file_name}", file_content, request_options)
|
67
|
+
response = post("/tickets/#{ticket_id}/attachments?name=#{CGI.escape(file_name)}", file_content, request_options)
|
59
68
|
case response.status
|
60
69
|
when 200..299
|
61
70
|
true
|
@@ -75,10 +84,25 @@ module Vimaly
|
|
75
84
|
end
|
76
85
|
end
|
77
86
|
|
78
|
-
def bins
|
87
|
+
def bins(options={})
|
79
88
|
@bins ||= begin
|
80
|
-
|
81
|
-
|
89
|
+
# 500 is the vimaly limit
|
90
|
+
bins_per_request = options[:bins_per_request] || 500
|
91
|
+
# 5000 is just a random value here; hopefully we never reach this limit
|
92
|
+
max_number_of_bins = options[:max_number_of_bins] || 5000
|
93
|
+
|
94
|
+
bins = []
|
95
|
+
current_page = 0
|
96
|
+
while bins.size < max_number_of_bins
|
97
|
+
# those request parameters are not documented, maybe this gets added at some
|
98
|
+
# point to https://vimaly.com/public/rest-help.html#Bins
|
99
|
+
chunk_of_bins = get("/bins?max-results=#{bins_per_request}&page-token=#{current_page * bins_per_request}")
|
100
|
+
current_page += 1
|
101
|
+
bins += chunk_of_bins
|
102
|
+
break if chunk_of_bins.size < bins_per_request
|
103
|
+
end
|
104
|
+
bins.map do |bin|
|
105
|
+
Bin.new(bin['_id'], bin['name'])
|
82
106
|
end
|
83
107
|
end
|
84
108
|
end
|
@@ -113,7 +137,6 @@ module Vimaly
|
|
113
137
|
get("/tickets?bin_id=#{bin_id}").map do |ticket_data|
|
114
138
|
Ticket.from_vimaly(ticket_data, ticket_type_map, bin_map, custom_fields)
|
115
139
|
end
|
116
|
-
|
117
140
|
end
|
118
141
|
|
119
142
|
def matching_tickets_in_named_bin(bin_name, title_matcher)
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorsten Boettger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -166,7 +166,7 @@ homepage: https://github.com/sharesight/vimaly
|
|
166
166
|
licenses:
|
167
167
|
- MIT
|
168
168
|
metadata: {}
|
169
|
-
post_install_message:
|
169
|
+
post_install_message:
|
170
170
|
rdoc_options: []
|
171
171
|
require_paths:
|
172
172
|
- lib
|
@@ -181,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
- !ruby/object:Gem::Version
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
|
-
rubygems_version: 3.
|
185
|
-
signing_key:
|
184
|
+
rubygems_version: 3.2.17
|
185
|
+
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: Wrapper for the Vimaly API
|
188
188
|
test_files: []
|