zendesk2 1.5.5 → 1.5.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae7794df49e6001b5afe94bf42032f484e7064a5
|
4
|
+
data.tar.gz: 1d8cc12a0ddd74b1a247e7844a116523a34f31d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9d325750f39bee7408bd0c39a56a732285d325e0bb90320f07cd0ca2e918492fa8b2dd50e87000cf2622a58524996c586adff07ac54dd53435c31d9318c23eb
|
7
|
+
data.tar.gz: 95be3f9e5c3c53e072ee82a9b752d25e402afc0765f0b34774ebf624044e7b4515d78de9abdffeb272c595aa5481b6a1b9c2bd68db8375208634670233940c06
|
@@ -1,12 +1,16 @@
|
|
1
1
|
class Zendesk2::Client::CreateOrganization < Zendesk2::Client::Request
|
2
2
|
request_method :post
|
3
3
|
request_path { |_| "/organizations.json" }
|
4
|
-
request_body { |r| { "organization" =>
|
4
|
+
request_body { |r| { "organization" => r.organization_params } }
|
5
5
|
|
6
6
|
def self.accepted_attributes
|
7
7
|
%w[details domain_names external_id group_id organization_fields shared_comments shared_tickets tags name notes]
|
8
8
|
end
|
9
9
|
|
10
|
+
def organization_params
|
11
|
+
@_organization_params ||= Cistern::Hash.slice(params.fetch("organization"), *self.class.accepted_attributes)
|
12
|
+
end
|
13
|
+
|
10
14
|
def mock
|
11
15
|
identity = service.serial_id
|
12
16
|
|
@@ -15,7 +19,7 @@ class Zendesk2::Client::CreateOrganization < Zendesk2::Client::Request
|
|
15
19
|
"url" => url_for("/organizations/#{identity}.json"),
|
16
20
|
"created_at" => Time.now.iso8601,
|
17
21
|
"updated_at" => Time.now.iso8601,
|
18
|
-
}.merge(
|
22
|
+
}.merge(self.organization_params)
|
19
23
|
|
20
24
|
unless record["name"]
|
21
25
|
error!(:invalid, details: { "name" => [ { "description" => "Name cannot be blank" } ]})
|
@@ -3,6 +3,10 @@ class Zendesk2::Client::UpdateOrganization < Zendesk2::Client::Request
|
|
3
3
|
request_path { |r| "/organizations/#{r.organization_id}.json" }
|
4
4
|
request_body { |r| { "organization" => Cistern::Hash.except(r.organization, "id") } }
|
5
5
|
|
6
|
+
def organization_params
|
7
|
+
@_organization_params ||= Cistern::Hash.slice(organization, *Zendesk2::Client::CreateOrganization.accepted_attributes)
|
8
|
+
end
|
9
|
+
|
6
10
|
def organization
|
7
11
|
params.fetch("organization")
|
8
12
|
end
|
@@ -25,7 +29,7 @@ class Zendesk2::Client::UpdateOrganization < Zendesk2::Client::Request
|
|
25
29
|
error!(:invalid, details: {"name" => [ { "description" => "External has already been taken" } ]})
|
26
30
|
end
|
27
31
|
|
28
|
-
record.merge!(
|
32
|
+
record.merge!(organization_params)
|
29
33
|
|
30
34
|
mock_response("organization" => record)
|
31
35
|
end
|
data/lib/zendesk2/version.rb
CHANGED