zendesk2 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da53e74ee09d2c85abc260d39f02878a346d769e
|
4
|
+
data.tar.gz: 255c672c805f8bfd51b8bd3ee682fa6f5de1d30d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35529ac971be807243949d67d763a07192dd27491f8e16822ec0a2d27056c163bf5dbb2a590815c63d178ca2fffe82c4c2a5b5444ab9d22f9472a4a6823dffc9
|
7
|
+
data.tar.gz: 53945ba5705d696416c9d7e073d3e9bdeb85b2143ee592f8e5874f6cdcb62940c97ae6c1493e0ce9fa77a99a84fa1dde864da810d262a2f4a85e85fa2341257c
|
@@ -21,46 +21,13 @@ class Zendesk2::Client
|
|
21
21
|
}.merge(params)
|
22
22
|
|
23
23
|
unless record["name"]
|
24
|
-
|
25
|
-
:status => 422,
|
26
|
-
:headers => {
|
27
|
-
"status" => "422 Unprocessable Entity",
|
28
|
-
},
|
29
|
-
:body => {
|
30
|
-
"error" => "RecordInvalid",
|
31
|
-
"description" => "Record validation errors",
|
32
|
-
"details" => {
|
33
|
-
"name" => [
|
34
|
-
{
|
35
|
-
"description" => "Name cannot be blank"
|
36
|
-
}
|
37
|
-
]
|
38
|
-
}
|
39
|
-
}
|
40
|
-
)
|
24
|
+
error!(:invalid, details: { "name" => [ { "description" => "Name cannot be blank" } ]})
|
41
25
|
end
|
42
26
|
|
43
27
|
if self.data[:organizations].values.find{|o| o["name"] == record["name"]}
|
44
|
-
|
45
|
-
:status => 422,
|
46
|
-
:headers => {
|
47
|
-
"status" => "422 Unprocessable Entity",
|
48
|
-
},
|
49
|
-
:body => {
|
50
|
-
"error" => "RecordInvalid",
|
51
|
-
"description" => "Record validation errors",
|
52
|
-
"details" => {
|
53
|
-
"name" => [
|
54
|
-
{
|
55
|
-
"description" => "Name: has already been taken"
|
56
|
-
}
|
57
|
-
]
|
58
|
-
}
|
59
|
-
}
|
60
|
-
)
|
28
|
+
error!(:invalid, details: {"name" => [ { "description" => "Name: has already been taken" } ]})
|
61
29
|
end
|
62
30
|
|
63
|
-
|
64
31
|
self.data[:organizations][identity]= record
|
65
32
|
|
66
33
|
response(
|
@@ -14,8 +14,15 @@ class Zendesk2::Client
|
|
14
14
|
end
|
15
15
|
class Mock
|
16
16
|
def update_organization(params={})
|
17
|
-
id
|
18
|
-
|
17
|
+
id = params.delete("id")
|
18
|
+
|
19
|
+
organization = self.find!(:organizations, id)
|
20
|
+
|
21
|
+
if self.data[:organizations].values.find { |o| o["name"] == params["name"] && o["id"] != id }
|
22
|
+
error!(:invalid, details: {"name" => [ { "description" => "Name: has already been taken" } ]})
|
23
|
+
end
|
24
|
+
|
25
|
+
body = organization.merge!(params)
|
19
26
|
|
20
27
|
response(
|
21
28
|
:method => :put,
|
data/lib/zendesk2/version.rb
CHANGED
data/spec/organizations_spec.rb
CHANGED
@@ -10,7 +10,8 @@ describe "organizations" do
|
|
10
10
|
}
|
11
11
|
|
12
12
|
describe "with an organization" do
|
13
|
-
let(:organization) { client.organizations.create(name: Zendesk2.uuid) }
|
13
|
+
let(:organization) { client.organizations.create!(name: Zendesk2.uuid) }
|
14
|
+
|
14
15
|
it "should get #users" do
|
15
16
|
user = client.users.create(email: "#{Zendesk2.uuid}@example.org", name: Zendesk2.uuid, organization: organization)
|
16
17
|
expect(organization.users).to include user
|
@@ -26,15 +27,17 @@ describe "organizations" do
|
|
26
27
|
expect { client.organizations.create!(name: organization.name) }.to raise_exception(Zendesk2::Error)
|
27
28
|
model = client.organizations.create(name: organization.name)
|
28
29
|
expect(model.errors).to eq({"name" => ["Name: has already been taken"]})
|
30
|
+
model = client.organizations.create(name: Zendesk2.uuid)
|
31
|
+
model.name = organization.name
|
32
|
+
model.save
|
33
|
+
expect(model.errors).to eq({"name" => ["Name: has already been taken"]})
|
29
34
|
end
|
30
35
|
|
31
36
|
it "should be able to find organizations by external id" do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
found = client.organizations.find_by_external_id(external_id).first
|
37
|
-
expect(found).to be === o
|
37
|
+
external_id = organization.external_id = Zendesk2.uuid
|
38
|
+
organization.save!
|
39
|
+
|
40
|
+
expect(client.organizations.find_by_external_id(external_id).first).to eq(organization)
|
38
41
|
end
|
39
42
|
|
40
43
|
end
|
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.2.
|
4
|
+
version: 1.2.1
|
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-09-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -306,3 +306,4 @@ test_files:
|
|
306
306
|
- spec/user_fields_spec.rb
|
307
307
|
- spec/user_identities_spec.rb
|
308
308
|
- spec/users_spec.rb
|
309
|
+
has_rdoc:
|