zendesk2 1.3.2 → 1.3.3

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: ed5cd2b9f54357316f66656d811ef3e6718eba22
4
- data.tar.gz: ea10043b0c18a118eb7a93de954c56059076e0a2
3
+ metadata.gz: aeacdd1baed3d95569ba4f094e5019e896802326
4
+ data.tar.gz: 1fa4b658c4a044099e3662b675d032825d784d87
5
5
  SHA512:
6
- metadata.gz: fbfa268c8848d68edc143372334c332f96b5cd4daee18cec251404f563abb52564a4974fa0edeabab99e5e347573cb9d1c9468a213d44e1dee395268740494de
7
- data.tar.gz: 7633461afdc6c38b878aa9893baf69bbad65e23ad21f37721c3b87126cf7df91839e73c222402a61fb89a75619cb26ac92c1ec0badc2217d91942b415c120be1
6
+ metadata.gz: bfc438e64a48e5909ab3567cb0c11ebef385955de7393b67840a870213f643e3949098dd1abbc41536b75335fb161bb0edbfa89017a9dc65436d9741a783d62d
7
+ data.tar.gz: 4946663f0020af266949b279c73243a16387909a89f67f4dd32049fa6c1cd81ddfe80454bf125504f4c10b3e041475f6bf3c37a63276a7ada49dbb186f03f058
@@ -75,13 +75,14 @@ class Zendesk2::Client
75
75
  }.merge(params)
76
76
 
77
77
  record["requester_id"] ||= (requester_id && requester_id.to_s) || current_user["id"].to_s
78
- requester = self.find!(:users, record["requester_id"])
79
-
80
78
  record["submitter_id"] = current_user["id"].to_s
81
79
 
82
- if record["organization_id"] = params.delete('organization_id') || requester["organization_id"]
83
- self.find!(:organizations, record["organization_id"])
84
- end
80
+ # @note invalid requester id does NOT cause a 404 or 422
81
+ record["organization_id"] = if requester = self.data[:users][record["requester_id"]]
82
+ requester["organization_id"]
83
+ else
84
+ nil
85
+ end
85
86
 
86
87
  self.data[:tickets][identity] = record
87
88
 
@@ -1,3 +1,3 @@
1
1
  module Zendesk2
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
data/spec/tickets_spec.rb CHANGED
@@ -35,10 +35,12 @@ describe "Zendesk2::Client" do
35
35
  end
36
36
  end
37
37
 
38
- it "should require a valid organization if not blank" do
39
- expect {
40
- client.tickets.create!(subject: mock_uuid, description: mock_uuid, organization_id: -1)
41
- }.to raise_exception(Zendesk2::Error, /RecordNotFound/)
38
+ context 'valid requester exists' do
39
+ it 'sets organization id' do
40
+ ticket = client.tickets.create!(subject: mock_uuid, description: mock_uuid, requester_id: 11111111111199)
41
+
42
+ expect(ticket.organization_id).to be_nil
43
+ end
42
44
  end
43
45
 
44
46
  it "should default to the requesters primary organization if organization is not specified" do
@@ -101,7 +103,7 @@ describe "Zendesk2::Client" do
101
103
  target_comments = 2.times.map { ticket.comment(mock_uuid) }
102
104
  2.times.map { another_ticket.comment(mock_uuid) }
103
105
 
104
- expect(ticket.comments.all).to match_array(target_comments)
106
+ expect(ticket.comments.all).to include(*target_comments) # @fixme model (subject + description) || (comment) on create_ticket as a comment
105
107
  end
106
108
  end
107
109
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-06 00:00:00.000000000 Z
11
+ date: 2014-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable