zendesk2 0.0.5 → 0.0.6

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.
Files changed (37) hide show
  1. data/lib/zendesk2.rb +1 -0
  2. data/lib/zendesk2/client.rb +25 -17
  3. data/lib/zendesk2/{models → client/models}/organization.rb +31 -25
  4. data/lib/zendesk2/{models → client/models}/organizations.rb +2 -2
  5. data/lib/zendesk2/{models → client/models}/ticket.rb +17 -8
  6. data/lib/zendesk2/{models → client/models}/tickets.rb +0 -0
  7. data/lib/zendesk2/{models → client/models}/user.rb +34 -11
  8. data/lib/zendesk2/{models → client/models}/users.rb +0 -0
  9. data/lib/zendesk2/{requests → client/requests}/create_organization.rb +0 -0
  10. data/lib/zendesk2/{requests → client/requests}/create_ticket.rb +6 -5
  11. data/lib/zendesk2/{requests → client/requests}/create_user.rb +5 -4
  12. data/lib/zendesk2/{requests → client/requests}/destroy_organization.rb +0 -0
  13. data/lib/zendesk2/{requests → client/requests}/destroy_ticket.rb +0 -0
  14. data/lib/zendesk2/client/requests/destroy_user.rb +47 -0
  15. data/lib/zendesk2/client/requests/get_ccd_tickets.rb +22 -0
  16. data/lib/zendesk2/{requests → client/requests}/get_current_user.rb +0 -0
  17. data/lib/zendesk2/{requests → client/requests}/get_organization.rb +1 -2
  18. data/lib/zendesk2/{requests → client/requests}/get_organization_tickets.rb +0 -0
  19. data/lib/zendesk2/{requests → client/requests}/get_organization_users.rb +0 -0
  20. data/lib/zendesk2/{requests → client/requests}/get_organizations.rb +0 -0
  21. data/lib/zendesk2/client/requests/get_requested_tickets.rb +22 -0
  22. data/lib/zendesk2/{requests → client/requests}/get_ticket.rb +8 -7
  23. data/lib/zendesk2/{requests → client/requests}/get_tickets.rb +0 -0
  24. data/lib/zendesk2/{requests → client/requests}/get_user.rb +0 -0
  25. data/lib/zendesk2/{requests → client/requests}/get_users.rb +0 -0
  26. data/lib/zendesk2/client/requests/search.rb +26 -0
  27. data/lib/zendesk2/{requests → client/requests}/update_organization.rb +0 -0
  28. data/lib/zendesk2/{requests → client/requests}/update_ticket.rb +0 -0
  29. data/lib/zendesk2/{requests → client/requests}/update_user.rb +0 -2
  30. data/lib/zendesk2/error.rb +13 -0
  31. data/lib/zendesk2/errors.rb +8 -0
  32. data/lib/zendesk2/paged_collection.rb +3 -0
  33. data/lib/zendesk2/version.rb +1 -1
  34. data/spec/shared/resource.rb +2 -0
  35. data/spec/users_spec.rb +24 -0
  36. metadata +30 -26
  37. data/lib/zendesk2/requests/destroy_user.rb +0 -27
data/lib/zendesk2.rb CHANGED
@@ -10,6 +10,7 @@ require 'time'
10
10
 
11
11
  module Zendesk2
12
12
  require 'zendesk2/errors'
13
+ require 'zendesk2/error'
13
14
  autoload :Client, "zendesk2/client"
14
15
  autoload :PagedCollection, "zendesk2/paged_collection"
15
16
 
@@ -1,7 +1,7 @@
1
1
  class Zendesk2::Client < Cistern::Service
2
2
 
3
- model_path "zendesk2/models"
4
- request_path "zendesk2/requests"
3
+ model_path "zendesk2/client/models"
4
+ request_path "zendesk2/client/requests"
5
5
 
6
6
  model :organization
7
7
  collection :organizations
@@ -23,8 +23,11 @@ class Zendesk2::Client < Cistern::Service
23
23
  request :get_ticket
24
24
  request :get_user
25
25
  request :get_organizations
26
+ request :get_requested_tickets
27
+ request :get_ccd_tickets
26
28
  request :get_tickets
27
29
  request :get_users
30
+ request :search
28
31
  request :update_organization
29
32
  request :update_ticket
30
33
  request :update_user
@@ -55,15 +58,15 @@ class Zendesk2::Client < Cistern::Service
55
58
  logger = options[:logger]
56
59
  adapter = options[:adapter] || :net_http
57
60
  connection_options = options[:connection_options] || {ssl: {verify: false}}
58
- username = options[:username] || Zendesk2.defaults[:username]
61
+ @username = options[:username] || Zendesk2.defaults[:username]
59
62
  password = options[:password] || Zendesk2.defaults[:password]
60
63
  @token = options[:token]
61
64
 
62
- raise "Missing required options: [:username, :password]" unless username && password
65
+ raise "Missing required options: [:username, :password]" unless @username && password
63
66
 
64
67
  @connection = Faraday.new({url: @url}.merge(connection_options)) do |builder|
65
68
  # response
66
- builder.use Faraday::Request::BasicAuthentication, username, password
69
+ builder.use Faraday::Request::BasicAuthentication, @username, password
67
70
  builder.use Faraday::Response::RaiseError
68
71
  builder.use Faraday::Response::Logger, logger if logger
69
72
  builder.response :json
@@ -89,14 +92,15 @@ class Zendesk2::Client < Cistern::Service
89
92
  req.params.merge!(params)
90
93
  req.body= body
91
94
  end
95
+ rescue Faraday::Error::ClientError => e
96
+ raise Zendesk2::Error.new(e)
92
97
  end
93
-
94
98
  end
95
99
 
96
100
  class Mock
97
101
  include Zendesk2::Errors
98
102
 
99
- attr_reader :username, :url
103
+ attr_reader :username, :url, :token
100
104
 
101
105
  def self.data
102
106
  @data ||= {
@@ -135,6 +139,7 @@ class Zendesk2::Client < Cistern::Service
135
139
  @url = url
136
140
  @path = URI.parse(url).path
137
141
  @username, @password = options[:username], options[:password]
142
+ @token = options[:token]
138
143
 
139
144
  @current_user_id = self.class.new_id
140
145
 
@@ -178,8 +183,8 @@ class Zendesk2::Client < Cistern::Service
178
183
  }
179
184
 
180
185
  response(
181
- body: body,
182
- path: path
186
+ :body => body,
187
+ :path => path
183
188
  )
184
189
  end
185
190
 
@@ -191,15 +196,18 @@ class Zendesk2::Client < Cistern::Service
191
196
 
192
197
  url = options[:url] || url_for(path)
193
198
 
194
- Faraday::Response.new(
195
- :method => method,
196
- :status => status,
197
- :url => url,
198
- :body => body,
199
- :request_headers => {
200
- "Content-Type" => "application/json; charset=utf-8"
199
+ env = {
200
+ :method => method,
201
+ :status => status,
202
+ :url => url,
203
+ :body => body,
204
+ :response_headers => {
205
+ "Content-Type" => "application/json; charset=utf-8"
201
206
  },
202
- )
207
+ }
208
+ Faraday::Response::RaiseError.new.on_complete(env) || Faraday::Response.new(env)
209
+ rescue Faraday::Error::ClientError => e
210
+ raise Zendesk2::Error.new(e)
203
211
  end
204
212
  end
205
213
  end
@@ -1,49 +1,49 @@
1
1
  class Zendesk2::Client::Organization < Cistern::Model
2
2
  include Zendesk2::Errors
3
3
  identity :id, type: :integer
4
- attribute :shared_comments, type: :boolean
5
- attribute :notes, type: :array
6
- attribute :tags
4
+ attribute :created_at, type: :time
5
+ attribute :details, type: :string
7
6
  attribute :domain_names, type: :array
8
- attribute :group_id, type: :integer
9
7
  attribute :external_id, type: :integer
10
- attribute :name
11
- attribute :created_at, type: :time
12
- attribute :details
8
+ attribute :group_id, type: :integer
9
+ attribute :shared_comments, type: :boolean
13
10
  attribute :shared_tickets, type: :boolean
11
+ attribute :tags, type: :array
12
+ attribute :name, type: :string
13
+ attribute :notes, type: :array
14
14
  attribute :updated_at, type: :time
15
15
 
16
- def destroy
16
+ def destroy!
17
17
  requires :identity
18
18
 
19
- response = connection.destroy_organization("id" => self.identity)
19
+ connection.destroy_organization("id" => self.identity)
20
+ end
21
+
22
+ def destroy
23
+ destroy!
24
+ rescue Zendesk2::Error
25
+ false
20
26
  end
21
27
 
22
28
  def destroyed?
23
- self.reload
24
- rescue not_found
25
- true
29
+ !self.reload
26
30
  end
27
31
 
28
32
  def save
29
- if new_record?
30
- requires :name
31
- data = connection.create_organization(attributes).body["organization"]
32
- merge_attributes(data)
33
- else
34
- requires :identity
35
- params = {
36
- "id" => self.identity,
37
- "name" => self.name,
38
- }
39
- data = connection.update_organization(params).body["organization"]
40
- merge_attributes(data)
41
- end
33
+ data = if new_record?
34
+ requires :name
35
+ connection.create_organization(params).body["organization"]
36
+ else
37
+ requires :identity
38
+ connection.update_organization(params).body["organization"]
39
+ end
40
+ merge_attributes(data)
42
41
  end
43
42
 
44
43
  def users
45
44
  requires :identity
46
45
  data = connection.get_organization_users("id" => self.identity).body["users"]
46
+
47
47
  connection.users.load(data)
48
48
  end
49
49
 
@@ -53,4 +53,10 @@ class Zendesk2::Client::Organization < Cistern::Model
53
53
 
54
54
  connection.tickets.load(data)
55
55
  end
56
+
57
+ private
58
+
59
+ def params
60
+ Cistern::Hash.slice(Zendesk2.stringify_keys(attributes), "id", "details", "domain_names", "external_id", "group_id", "shared_comments", "shared_tickets", "tags", "name", "notes")
61
+ end
56
62
  end
@@ -12,8 +12,8 @@ class Zendesk2::Client::Organizations < Cistern::Collection
12
12
  new(connection.get_current_organization.body["organization"])
13
13
  end
14
14
 
15
- def search(term)
16
- body = connection.search_organization("query" => term).body
15
+ def search(parameters)
16
+ body = connection.search(parameters.merge("type" => "organization")).body
17
17
  if data = body.delete("results")
18
18
  load(data)
19
19
  end
@@ -42,18 +42,16 @@ class Zendesk2::Client::Ticket < Cistern::Model
42
42
  connection.destroy_ticket("id" => self.identity)
43
43
  end
44
44
 
45
- def destroyed?
46
- self.reload
47
- rescue not_found
48
- true
45
+ def collaborators
46
+ self.collaborator_ids.map{|cid| self.connection.users.get(cid)}
49
47
  end
50
48
 
51
- def params
52
- Cistern::Hash.slice(Zendesk2.stringify_keys(attributes), "external_id", "via", "requester_id", "submitter_id", "assignee_id", "organization_id", "subject", "description", "fields", "recipient", "status")
49
+ def collaborators=(collaborators)
50
+ self.collaborator_ids= collaborators.map(&:identity)
53
51
  end
54
52
 
55
- def submitter
56
- self.connection.users.get(submitter_id)
53
+ def destroyed?
54
+ !self.reload
57
55
  end
58
56
 
59
57
  def requester=(requester)
@@ -63,4 +61,15 @@ class Zendesk2::Client::Ticket < Cistern::Model
63
61
  def requester
64
62
  self.connection.users.get(self.requester_id)
65
63
  end
64
+
65
+ def submitter
66
+ self.connection.users.get(submitter_id)
67
+ end
68
+
69
+ private
70
+
71
+ def params
72
+ Cistern::Hash.slice(Zendesk2.stringify_keys(attributes), "external_id", "via", "requester_id", "submitter_id", "assignee_id", "organization_id", "subject", "description", "fields", "recipient", "status", "collaborator_ids")
73
+ end
74
+
66
75
  end
File without changes
@@ -1,4 +1,5 @@
1
1
  class Zendesk2::Client::User < Cistern::Model
2
+ include Zendesk2::Errors
2
3
  identity :id, type: :id
3
4
  attribute :url
4
5
  attribute :external_id
@@ -16,7 +17,7 @@ class Zendesk2::Client::User < Cistern::Model
16
17
  attribute :email
17
18
  attribute :phone
18
19
  attribute :signature
19
- attribute :details
20
+ attribute :details, type: :string
20
21
  attribute :notes
21
22
  attribute :organization_id, type: :integer
22
23
  attribute :role
@@ -41,7 +42,7 @@ class Zendesk2::Client::User < Cistern::Model
41
42
  end
42
43
  end
43
44
 
44
- def destroy
45
+ def destroy!
45
46
  requires :identity
46
47
  raise "don't nuke yourself" if self.email == connection.username
47
48
 
@@ -49,23 +50,21 @@ class Zendesk2::Client::User < Cistern::Model
49
50
  merge_attributes(data)
50
51
  end
51
52
 
52
- def destroyed?
53
- !self.active
54
- end
55
-
56
- def organization=(organization)
57
- self.organization_id= organization.id
53
+ def destroy
54
+ destroy!
55
+ rescue Zendesk2::Error => e
56
+ false
58
57
  end
59
58
 
60
- def organization
61
- self.connection.organizations.get(self.organization_id)
59
+ def destroyed?
60
+ !reload || !self.active
62
61
  end
63
62
 
64
63
  def login_url(timestamp, options={})
65
64
  requires :name, :email
66
65
 
67
66
  return_to = options[:return_to]
68
- token = self.token || options[:token]
67
+ token = self.connection.token || options[:token]
69
68
 
70
69
  uri = Addressable::URI.parse(self.connection.url)
71
70
  uri.path = "/access/remote"
@@ -87,6 +86,30 @@ class Zendesk2::Client::User < Cistern::Model
87
86
  uri.to_s
88
87
  end
89
88
 
89
+ def requested_tickets
90
+ requires :identity
91
+
92
+ data = connection.get_requested_tickets("id" => self.identity).body["tickets"]
93
+
94
+ connection.tickets.load(data)
95
+ end
96
+
97
+ def ccd_tickets
98
+ requires :identity
99
+
100
+ data = connection.get_ccd_tickets("id" => self.identity).body["tickets"]
101
+
102
+ connection.tickets.load(data)
103
+ end
104
+
105
+ def organization=(organization)
106
+ self.organization_id= organization.id
107
+ end
108
+
109
+ def organization
110
+ self.connection.organizations.get(self.organization_id)
111
+ end
112
+
90
113
  private
91
114
 
92
115
  def params
File without changes
@@ -14,10 +14,11 @@ class Zendesk2::Client
14
14
  identity = self.class.new_id
15
15
 
16
16
  record = {
17
- "id" => identity,
18
- "url" => url_for("/tickets/#{identity}.json"),
19
- "created_at" => Time.now.iso8601,
20
- "updated_at" => Time.now.iso8601,
17
+ "id" => identity,
18
+ "url" => url_for("/tickets/#{identity}.json"),
19
+ "created_at" => Time.now.iso8601,
20
+ "updated_at" => Time.now.iso8601,
21
+ "collaborator_ids" => [],
21
22
  }.merge(params)
22
23
 
23
24
  record["requester_id"] ||= @current_user_id
@@ -34,4 +35,4 @@ class Zendesk2::Client
34
35
  )
35
36
  end
36
37
  end # Mock
37
- end
38
+ end # Zendesk2::Client
@@ -14,10 +14,11 @@ class Zendesk2::Client
14
14
  identity = self.class.new_id
15
15
 
16
16
  record = {
17
- "id" => identity,
18
- "url" => url_for("/users/#{identity}.json"),
19
- "created_at" => Time.now.iso8601,
20
- "updated_at" => Time.now.iso8601
17
+ "id" => identity,
18
+ "url" => url_for("/users/#{identity}.json"),
19
+ "created_at" => Time.now.iso8601,
20
+ "updated_at" => Time.now.iso8601,
21
+ "active" => true,
21
22
  }.merge(params)
22
23
 
23
24
  self.data[:users][identity]= record
@@ -0,0 +1,47 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def destroy_user(params={})
4
+ id = params["id"]
5
+
6
+ request(
7
+ :method => :delete,
8
+ :path => "/users/#{id}.json"
9
+ )
10
+ end
11
+ end
12
+
13
+ class Mock
14
+ def destroy_user(params={})
15
+ id = params["id"]
16
+ path = "/users/#{id}.json"
17
+
18
+ tickets = self.data[:tickets].values.select{|t| t["requester_id"] == id}.size
19
+ if tickets < 1
20
+ body = self.data[:users].delete(id)
21
+ response(
22
+ :method => :delete,
23
+ :path => path,
24
+ :body => {
25
+ "user" => body,
26
+ },
27
+ )
28
+ else
29
+ response(
30
+ :method => :delete,
31
+ :path => path,
32
+ :status => 422,
33
+ :body => {
34
+ "error" => "RecordInvalid",
35
+ "description" => "Record validation errors",
36
+ "details" => {
37
+ "base" => [{
38
+ "type" => "User is requester on #{tickets} ticket(s) that are not closed.",
39
+ "description" => "Base User is requester on #{tickets} ticket(s) that are not closed."
40
+ }]
41
+ }
42
+ }
43
+ )
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,22 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def get_ccd_tickets(params={})
4
+ id = params["id"]
5
+ page_params = Zendesk2.paging_parameters(params)
6
+
7
+ request(
8
+ :params => page_params,
9
+ :method => :get,
10
+ :path => "/users/#{id}/tickets/ccd.json",
11
+ )
12
+ end
13
+ end # Real
14
+
15
+ class Mock
16
+ def get_ccd_tickets(params={})
17
+ id = params["id"]
18
+
19
+ page(params, :tickets, "/ccds/#{id}/tickets.json", "tickets", filter: lambda{|c| c.select{|u| u["collaborator_ids"].include?(id)}})
20
+ end
21
+ end # Mock
22
+ end
@@ -22,11 +22,10 @@ class Zendesk2::Client
22
22
  },
23
23
  )
24
24
  else
25
- r = response(
25
+ response(
26
26
  :path => "/organizations/#{id}.json",
27
27
  :status => 404
28
28
  )
29
- raise not_found!(nil, r)
30
29
  end
31
30
  end
32
31
  end # Mock
@@ -0,0 +1,22 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def get_requested_tickets(params={})
4
+ id = params["id"]
5
+ page_params = Zendesk2.paging_parameters(params)
6
+
7
+ request(
8
+ :params => page_params,
9
+ :method => :get,
10
+ :path => "/users/#{id}/tickets/requested.json",
11
+ )
12
+ end
13
+ end # Real
14
+
15
+ class Mock
16
+ def get_requested_tickets(params={})
17
+ id = params["id"]
18
+
19
+ page(params, :tickets, "/requesteds/#{id}/tickets.json", "tickets", filter: lambda{|c| c.select{|u| u["requester_id"] == id}})
20
+ end
21
+ end # Mock
22
+ end
@@ -13,20 +13,21 @@ class Zendesk2::Client
13
13
  class Mock
14
14
  def get_ticket(params={})
15
15
  id = params["id"]
16
- if body = self.data[:tickets][id]
16
+ path = "/tickets/#{id}.json"
17
17
 
18
+ if body = self.data[:tickets][id]
18
19
  response(
19
- :path => "/tickets/#{id}.json",
20
- :body => {
20
+ :path => path,
21
+ :body => {
21
22
  "ticket" => body
22
23
  },
23
24
  )
24
25
  else
25
- r = response(
26
- :path => "/tickets/#{id}.json",
27
- :status => 404
26
+ response(
27
+ :path => path,
28
+ :status => 404,
29
+ :body => {"error" => "RecordNotFound", "description" => "Not found"},
28
30
  )
29
- raise not_found!(nil, r)
30
31
  end
31
32
  end
32
33
  end # Mock
@@ -0,0 +1,26 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def search(query)
4
+ term = query.map{|k,v| "#{k}:#{v}"}.join(" ")
5
+ request(
6
+ :method => :get,
7
+ :params => {query: term},
8
+ :path => "/search.json",
9
+ )
10
+ end
11
+ end # Real
12
+
13
+ class Mock
14
+ def search(query)
15
+ type = query.delete("type")
16
+ collection = type.nil? ? self.data.values : self.data["#{type}s".to_sym]
17
+
18
+ results = collection.select{|k,v| query.all?{|term, condition| v[term.to_s] == condition}}.values
19
+
20
+ response(
21
+ :path => "/search.json",
22
+ :body => {"results" => results},
23
+ )
24
+ end
25
+ end # Mock
26
+ end
@@ -10,8 +10,6 @@ class Zendesk2::Client
10
10
  "user" => params
11
11
  },
12
12
  )
13
- rescue => e
14
- p e.response
15
13
  end
16
14
  end
17
15
  class Mock
@@ -0,0 +1,13 @@
1
+ class Zendesk2::Error < StandardError
2
+
3
+ attr_reader :message
4
+ def initialize(exception)
5
+ @exception = exception
6
+ message = if exception.response
7
+ "#{exception.response[:status]} #{exception.response[:body]}"
8
+ else
9
+ exception.message
10
+ end
11
+ super(message)
12
+ end
13
+ end
@@ -6,4 +6,12 @@ module Zendesk2::Errors
6
6
  def not_found!(*args)
7
7
  not_found.new(args)
8
8
  end
9
+
10
+ def unprocessable_entity
11
+ Faraday::Error::ClientError
12
+ end
13
+
14
+ def unprocessable_entity!(*args)
15
+ unprocessable_entity.new(args)
16
+ end
9
17
  end
@@ -3,6 +3,7 @@ module Zendesk2::PagedCollection
3
3
  klass.send(:attribute, :count)
4
4
  klass.send(:attribute, :next_page_link, {:aliases => "next_page"})
5
5
  klass.send(:attribute, :previous_page_link, {:aliases => "previous_page"})
6
+ klass.send(:include, Zendesk2::Errors)
6
7
  klass.send(:extend, Zendesk2::PagedCollection::Attributes)
7
8
  end
8
9
 
@@ -23,6 +24,8 @@ module Zendesk2::PagedCollection
23
24
  if data = self.connection.send(model_method, {"id" => id}).body[self.model_root]
24
25
  new(data)
25
26
  end
27
+ rescue Zendesk2::Error
28
+ nil
26
29
  end
27
30
 
28
31
  def next_page
@@ -1,3 +1,3 @@
1
1
  module Zendesk2
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -47,4 +47,6 @@ shared_examples "a resource" do |_collection, _params, _update_params|
47
47
  record.destroy
48
48
  record.should be_destroyed
49
49
  end
50
+
51
+ it "should search"
50
52
  end
data/spec/users_spec.rb CHANGED
@@ -12,4 +12,28 @@ describe "users" do
12
12
  current_user.should be_a(Zendesk2::Client::User)
13
13
  current_user.email.should == client.username
14
14
  end
15
+
16
+ describe do
17
+ let(:user) { client.users.create(email: "zendesk2+#{Zendesk2.uuid}@example.org", name: Zendesk2.uuid) }
18
+
19
+ it "should get requested tickets" do
20
+ ticket = client.tickets.create(requester: user, subject: Zendesk2.uuid, description: Zendesk2.uuid)
21
+
22
+ user.requested_tickets.should include ticket
23
+ end
24
+
25
+ it "should get ccd tickets" do
26
+ ticket = client.tickets.create(collaborators: [user], subject: Zendesk2.uuid, description: Zendesk2.uuid)
27
+
28
+ user.ccd_tickets.should include ticket
29
+ end
30
+
31
+ it "cannot destroy a user with a ticket" do
32
+ ticket = client.tickets.create(requester: user, subject: Zendesk2.uuid, description: Zendesk2.uuid)
33
+
34
+ user.destroy.should be_false
35
+
36
+ user.should_not be_destroyed
37
+ end
38
+ end
15
39
  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: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-08 00:00:00.000000000 Z
12
+ date: 2012-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cistern
@@ -108,32 +108,36 @@ files:
108
108
  - Rakefile
109
109
  - lib/zendesk2.rb
110
110
  - lib/zendesk2/client.rb
111
+ - lib/zendesk2/client/models/organization.rb
112
+ - lib/zendesk2/client/models/organizations.rb
113
+ - lib/zendesk2/client/models/ticket.rb
114
+ - lib/zendesk2/client/models/tickets.rb
115
+ - lib/zendesk2/client/models/user.rb
116
+ - lib/zendesk2/client/models/users.rb
117
+ - lib/zendesk2/client/requests/create_organization.rb
118
+ - lib/zendesk2/client/requests/create_ticket.rb
119
+ - lib/zendesk2/client/requests/create_user.rb
120
+ - lib/zendesk2/client/requests/destroy_organization.rb
121
+ - lib/zendesk2/client/requests/destroy_ticket.rb
122
+ - lib/zendesk2/client/requests/destroy_user.rb
123
+ - lib/zendesk2/client/requests/get_ccd_tickets.rb
124
+ - lib/zendesk2/client/requests/get_current_user.rb
125
+ - lib/zendesk2/client/requests/get_organization.rb
126
+ - lib/zendesk2/client/requests/get_organization_tickets.rb
127
+ - lib/zendesk2/client/requests/get_organization_users.rb
128
+ - lib/zendesk2/client/requests/get_organizations.rb
129
+ - lib/zendesk2/client/requests/get_requested_tickets.rb
130
+ - lib/zendesk2/client/requests/get_ticket.rb
131
+ - lib/zendesk2/client/requests/get_tickets.rb
132
+ - lib/zendesk2/client/requests/get_user.rb
133
+ - lib/zendesk2/client/requests/get_users.rb
134
+ - lib/zendesk2/client/requests/search.rb
135
+ - lib/zendesk2/client/requests/update_organization.rb
136
+ - lib/zendesk2/client/requests/update_ticket.rb
137
+ - lib/zendesk2/client/requests/update_user.rb
138
+ - lib/zendesk2/error.rb
111
139
  - lib/zendesk2/errors.rb
112
- - lib/zendesk2/models/organization.rb
113
- - lib/zendesk2/models/organizations.rb
114
- - lib/zendesk2/models/ticket.rb
115
- - lib/zendesk2/models/tickets.rb
116
- - lib/zendesk2/models/user.rb
117
- - lib/zendesk2/models/users.rb
118
140
  - lib/zendesk2/paged_collection.rb
119
- - lib/zendesk2/requests/create_organization.rb
120
- - lib/zendesk2/requests/create_ticket.rb
121
- - lib/zendesk2/requests/create_user.rb
122
- - lib/zendesk2/requests/destroy_organization.rb
123
- - lib/zendesk2/requests/destroy_ticket.rb
124
- - lib/zendesk2/requests/destroy_user.rb
125
- - lib/zendesk2/requests/get_current_user.rb
126
- - lib/zendesk2/requests/get_organization.rb
127
- - lib/zendesk2/requests/get_organization_tickets.rb
128
- - lib/zendesk2/requests/get_organization_users.rb
129
- - lib/zendesk2/requests/get_organizations.rb
130
- - lib/zendesk2/requests/get_ticket.rb
131
- - lib/zendesk2/requests/get_tickets.rb
132
- - lib/zendesk2/requests/get_user.rb
133
- - lib/zendesk2/requests/get_users.rb
134
- - lib/zendesk2/requests/update_organization.rb
135
- - lib/zendesk2/requests/update_ticket.rb
136
- - lib/zendesk2/requests/update_user.rb
137
141
  - lib/zendesk2/version.rb
138
142
  - spec/organizations_spec.rb
139
143
  - spec/shared/resource.rb
@@ -1,27 +0,0 @@
1
- class Zendesk2::Client
2
- class Real
3
- def destroy_user(params={})
4
- id = params["id"]
5
-
6
- request(
7
- :method => :delete,
8
- :path => "/users/#{id}.json"
9
- )
10
- end
11
- end
12
-
13
- class Mock
14
- def destroy_user(params={})
15
- id = params["id"]
16
- body = self.data[:users].delete(id)
17
-
18
- response(
19
- :method => :delete,
20
- :path => "/users/#{id}.json",
21
- :body => {
22
- "user" => body,
23
- },
24
- )
25
- end
26
- end
27
- end