connectwise_sdk 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/connectwise/ticket.rb +9 -1
- data/lib/connectwise/version.rb +1 -1
- data/spec/lib/connectwise/ticket_spec.rb +17 -0
- data/spec/spec_helper.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70ce73cadcc0bc9f53aef9d11f95088b34e5dc33
|
4
|
+
data.tar.gz: 03fae785f7477983b3e17d279a2c94c3bafabb08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36e9eebd4e99ab3a62dbc3e9a5df86edfd34838b7d6fb7acd52b4bebf00962c78a22646a8182590b1bc98a54ff80b186d10a58a9fe30cd6014780025e23f6c5e
|
7
|
+
data.tar.gz: 4b03d8dd15d1b8b785ddb225cf78f8043fe944497abde3b639f25e272b424ab8c6f372442d9238502e18f5fdf4ad1f87531ecf118745db53ebc1970c816893d4
|
data/lib/connectwise/ticket.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Connectwise
|
2
4
|
class Ticket
|
3
5
|
include Model
|
4
6
|
model_name 'service_ticket'
|
5
|
-
attr_accessor :id, :summary, :problem_description, :status_name, :board, :site_name, :status, :resolution, :remote_internal_company_name, :priority, :source, :severity, :impact, :company, :company_id
|
7
|
+
attr_accessor :id, :summary, :problem_description, :status_name, :board, :site_name, :status, :resolution, :remote_internal_company_name, :priority, :source, :severity, :impact, :company, :company_id, :closed_flag, :member_id, :member_rec_id
|
6
8
|
|
7
9
|
#TODO - The use of SrServiceRecid and TicketNumber instead of id - may want to configure these
|
8
10
|
# but this is so inconsistent for tickets that it may not be worth it unless other calls do the same thing
|
@@ -16,6 +18,12 @@ module Connectwise
|
|
16
18
|
raise RecordNotFound
|
17
19
|
end
|
18
20
|
|
21
|
+
def self.parse(connection, params)
|
22
|
+
resp = JSON.parse(params.keys.first)
|
23
|
+
ticket_info = JSON.parse(resp['Entity'])
|
24
|
+
self.new(connection, id: params[:id], summary: ticket_info['Summary'], closed_flag: ticket_info['ClosedFlag'], severity: ticket_info['Severity'], company_id: ticket_info['CompanyId'], member_id: ticket_info['memberId'])
|
25
|
+
end
|
26
|
+
|
19
27
|
def status_name
|
20
28
|
@status_name ||= 'New'
|
21
29
|
end
|
data/lib/connectwise/version.rb
CHANGED
@@ -14,6 +14,8 @@ describe Connectwise::Ticket do
|
|
14
14
|
new_ticket = subject.save
|
15
15
|
expect(new_ticket.persisted?).to eq true
|
16
16
|
expect(new_ticket.company_id).to eq orig_company.company_id
|
17
|
+
expect(new_ticket.closed_flag).to eq false
|
18
|
+
#expect(new_ticket.member_id).to eq ''
|
17
19
|
end
|
18
20
|
|
19
21
|
it 'finds a service ticket' do
|
@@ -68,4 +70,19 @@ describe Connectwise::Ticket do
|
|
68
70
|
expect(ticket_note.persisted?).to eq true
|
69
71
|
expect(ticket_note.internal?).to eq true
|
70
72
|
end
|
73
|
+
|
74
|
+
it 'parses a post callback' do
|
75
|
+
entity = {'Summary' => 'A summary', 'ClosedFlag' => false, 'Severity' => 'High', 'CompanyId' => 'acompany Id', 'memberId' => 'Admin1'}
|
76
|
+
cw_params = {'Other data' => 'not sure what', 'Entity' => entity.to_json}
|
77
|
+
params = {
|
78
|
+
cw_params.to_json => nil,
|
79
|
+
id: 12
|
80
|
+
}
|
81
|
+
ticket = Connectwise::Ticket.parse(conn, params)
|
82
|
+
expect(ticket.summary).to eq entity['Summary']
|
83
|
+
expect(ticket.closed_flag).to eq entity['ClosedFlag']
|
84
|
+
expect(ticket.severity).to eq entity['Severity']
|
85
|
+
expect(ticket.company_id).to eq entity['CompanyId']
|
86
|
+
expect(ticket.member_id).to eq entity['memberId']
|
87
|
+
end
|
71
88
|
end
|
data/spec/spec_helper.rb
CHANGED