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: 3479390f9ff82a301dc63983aadab83e14d5e579
4
- data.tar.gz: 0cd7f1bfcc79e7121c08844e458fb8b5a56e39c9
3
+ metadata.gz: ae7794df49e6001b5afe94bf42032f484e7064a5
4
+ data.tar.gz: 1d8cc12a0ddd74b1a247e7844a116523a34f31d2
5
5
  SHA512:
6
- metadata.gz: 04cd524b57745773f12c9275ba454e929bd0a190f3e5987c8299f7b581969cb14f0cf8ee1f5ba0932f857cdead565b965eb35388703983c9060f4d2b2676da54
7
- data.tar.gz: 227108ea6a5deb81aee08572353810ff3408390b42814dde62398c83a1f34cc3e7d3bb6c924a27ea309ad20677d02ddb6cbb293bb0f9b8e929b75d6043480638
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" => Cistern::Hash.except(r.params["organization"], "id") } }
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(Cistern::Hash.slice(params.fetch("organization"), *self.class.accepted_attributes))
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!(Cistern::Hash.slice(organization, *Zendesk2::Client::CreateOrganization.accepted_attributes))
32
+ record.merge!(organization_params)
29
33
 
30
34
  mock_response("organization" => record)
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module Zendesk2
2
- VERSION = "1.5.5"
2
+ VERSION = "1.5.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.5
4
+ version: 1.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Lane