zendesk2 0.3.2 → 0.4.0
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 +15 -0
- data/Guardfile +2 -2
- data/lib/zendesk2/client/models/organization.rb +32 -16
- data/lib/zendesk2/client/requests/get_topic_comments.rb +3 -2
- data/lib/zendesk2/collection.rb +13 -7
- data/lib/zendesk2/version.rb +1 -1
- data/lib/zendesk2.rb +1 -0
- data/spec/shared/resource.rb +2 -2
- data/zendesk2.gemspec +2 -2
- metadata +11 -23
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODU3ZjQzNTA5Y2UzYzM5NmEwZDEyM2QyNjk1NmRmYjFhZDliMTkwNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTJjNmY4MTVmN2UwYjM5MmY0YmIzODA3YzNiNDI5MWYzNTAxZjdhNw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzA2Y2E0MmI2NzA5MDZmMmRhZjZlNmY3MDQyZDM5YzY4NGU2NWI3NDJjNWNj
|
10
|
+
MTkyYjJhNzllMDgyNjMxZjAzZGYyMDA5ODVlM2QzNThlNmQ3NjdjNTM1ZWI4
|
11
|
+
OTFmODQyODVlOTYwNTkzNTE3ODJmZjA2NzlmMGVjMzY1MDhhMTk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MGNkMjE0M2M4OGFmOTQ4MjM2YTU2Y2M1NzRmMTg4NDFmMGEzZDE0YWM0NDA4
|
14
|
+
N2I3MjE2YTNmMTAzM2ViOTVkYjgxMDJkOWNkZTUzNTM2ZWQ1ZWJjN2EzOGFl
|
15
|
+
MGZhOTQ2MWY0NDI4OGFhMjM2MGExZDM1ZThlOWU0ZGExZDhjNjA=
|
data/Guardfile
CHANGED
@@ -3,9 +3,9 @@ guard 'bundler' do
|
|
3
3
|
watch(/^.+\.gemspec/)
|
4
4
|
end
|
5
5
|
|
6
|
-
guard 'rspec' do
|
6
|
+
guard 'rspec', cmd: 'bundle exec rspec' do
|
7
7
|
watch(%r{^spec/.+_spec\.rb$})
|
8
8
|
watch(%r{^lib/(.+)\.rb$}) { "spec" }
|
9
9
|
watch('spec/spec_helper.rb') { "spec" }
|
10
|
-
watch(%r{^spec/(support|matchers|shared)/(.+)\.rb$})
|
10
|
+
watch(%r{^spec/(support|matchers|shared)/(.+)\.rb$}) { "spec" }
|
11
11
|
end
|
@@ -1,19 +1,35 @@
|
|
1
1
|
class Zendesk2::Client::Organization < Zendesk2::Model
|
2
|
-
PARAMS = %w[id details domain_names external_id group_id shared_comments shared_tickets tags name notes]
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
attribute :
|
9
|
-
|
10
|
-
attribute :
|
11
|
-
|
12
|
-
attribute :
|
13
|
-
|
14
|
-
attribute :
|
15
|
-
|
16
|
-
attribute :
|
2
|
+
PARAMS = %w[id details domain_names external_id group_id organization_fields shared_comments shared_tickets tags name notes]
|
3
|
+
|
4
|
+
# @return [integer] Automatically assigned when creating organization
|
5
|
+
identity :id, type: :integer # ro[yes] required[no]
|
6
|
+
|
7
|
+
# @return [Date] The time the organization was created
|
8
|
+
attribute :created_at, type: :date # ro[yes] required[no]
|
9
|
+
# @return [String] In this field you can store any details obout the organization. e.g. the address
|
10
|
+
attribute :details, type: :string # ro[no] required[no]
|
11
|
+
# @return [Array] An array of domain names associated with this organization
|
12
|
+
attribute :domain_names, type: :array # ro[no] required[no]
|
13
|
+
# @return [String] A unique external id, you can use this to associate organizations to an external record
|
14
|
+
attribute :external_id, type: :string # ro[no] required[no]
|
15
|
+
# @return [Integer] New tickets from users in this organization will automatically be put in this group
|
16
|
+
attribute :group_id, type: :integer # ro[no] required[no]
|
17
|
+
# @return [String] The name of the organization
|
18
|
+
attribute :name, type: :string # ro[no] required[yes]
|
19
|
+
# @return [String] In this field you can store any notes you have about the organization
|
20
|
+
attribute :notes, type: :string # ro[no] required[no]
|
21
|
+
# @return [Hash] Custom fields for this organization
|
22
|
+
attribute :organization_fields, type: :hash # ro[no] required[no]
|
23
|
+
# @return [Boolean] End users in this organization are able to see each other's comments on tickets
|
24
|
+
attribute :shared_comments, type: :boolean # ro[no] required[no]
|
25
|
+
# @return [Boolean] End users in this organization are able to see each other's tickets
|
26
|
+
attribute :shared_tickets, type: :boolean # ro[no] required[no]
|
27
|
+
# @return [Array] The tags of the organization
|
28
|
+
attribute :tags, type: :array # ro[no] required[no]
|
29
|
+
# @return [Date] The time of the last update of the organization
|
30
|
+
attribute :updated_at, type: :date # ro[yes] required[no]
|
31
|
+
# @return [String] The API url of this organization
|
32
|
+
attribute :url, type: :string # ro[yes] required[no]
|
17
33
|
|
18
34
|
def destroy!
|
19
35
|
requires :identity
|
@@ -56,4 +72,4 @@ class Zendesk2::Client::Organization < Zendesk2::Model
|
|
56
72
|
writable_attributes.delete("group_id") if writable_attributes["group_id"].to_s == "0"
|
57
73
|
writable_attributes
|
58
74
|
end
|
59
|
-
end
|
75
|
+
end
|
@@ -14,9 +14,10 @@ class Zendesk2::Client
|
|
14
14
|
def get_topic_comments(params={})
|
15
15
|
topic_id = params["topic_id"]
|
16
16
|
topic = self.data[:topics][topic_id] # TODO: 404 if !topic
|
17
|
-
filter = lambda{|comments| comments.select{|c| c["topic_id"] == topic_id}}
|
17
|
+
filter = lambda { |comments| comments.select { |c| c["topic_id"] == topic_id } }
|
18
18
|
|
19
|
-
page(params, :topic_comments, "/topics/#{topic_id}/comments.json", "topic_comments", filter: filter)
|
19
|
+
page(params, :topic_comments, "/topics/#{topic_id}/comments.json", "topic_comments", filter: filter).tap do
|
20
|
+
end
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
data/lib/zendesk2/collection.rb
CHANGED
@@ -13,12 +13,19 @@ class Zendesk2::Collection < Cistern::Collection
|
|
13
13
|
def model_method; self.class.model_method; end
|
14
14
|
def model_root; self.class.model_root; end
|
15
15
|
|
16
|
+
def new_page
|
17
|
+
page = self.clone
|
18
|
+
%w[count next_page_link previous_page_link].each { |k| page.attributes.delete(k) }
|
19
|
+
page.records = []
|
20
|
+
page
|
21
|
+
end
|
22
|
+
|
16
23
|
def next_page
|
17
|
-
|
24
|
+
new_page.all("url" => next_page_link) if next_page_link
|
18
25
|
end
|
19
26
|
|
20
27
|
def previous_page
|
21
|
-
|
28
|
+
new_page.all("url" => previous_page_link) if previous_page_link
|
22
29
|
end
|
23
30
|
|
24
31
|
# Attempt creation of resource and explode if unsuccessful
|
@@ -39,13 +46,12 @@ class Zendesk2::Collection < Cistern::Collection
|
|
39
46
|
|
40
47
|
# Fetch a collection of resources
|
41
48
|
def all(params={})
|
42
|
-
scoped_attributes = self.class.scopes.inject({}){|r,k| r.merge(k.to_s => send(k))}
|
43
|
-
scoped_attributes.merge!(params)
|
49
|
+
scoped_attributes = self.class.scopes.inject({}){|r,k| r.merge(k.to_s => send(k))}.merge(params)
|
44
50
|
body = connection.send(collection_method, scoped_attributes).body
|
45
51
|
|
46
|
-
|
47
|
-
|
48
|
-
|
52
|
+
self.load(body[collection_root])
|
53
|
+
self.merge_attributes(Cistern::Hash.slice(body, "count", "next_page", "previous_page"))
|
54
|
+
self
|
49
55
|
end
|
50
56
|
|
51
57
|
# Fetch a single of resource
|
data/lib/zendesk2/version.rb
CHANGED
data/lib/zendesk2.rb
CHANGED
data/spec/shared/resource.rb
CHANGED
@@ -17,7 +17,7 @@ shared_examples "a resource" do |_collection, _params, _update_params, _options|
|
|
17
17
|
|
18
18
|
context "that is paged" do
|
19
19
|
before(:each) do
|
20
|
-
|
20
|
+
3.times.each { collection.create(instance_exec(&_params)) }
|
21
21
|
end
|
22
22
|
|
23
23
|
it "by retrieving the first page" do
|
@@ -44,7 +44,7 @@ shared_examples "a resource" do |_collection, _params, _update_params, _options|
|
|
44
44
|
update_params.each {|k,v| record.send(k).should == v}
|
45
45
|
end
|
46
46
|
|
47
|
-
it "by
|
47
|
+
it "by destroying a record" do
|
48
48
|
pending if _collection == :forums
|
49
49
|
record = collection.create(params)
|
50
50
|
record.identity.should_not be_nil
|
data/zendesk2.gemspec
CHANGED
@@ -17,8 +17,8 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.version = Zendesk2::VERSION
|
18
18
|
|
19
19
|
gem.add_dependency "addressable"
|
20
|
-
gem.add_dependency "cistern", "~> 0.
|
21
|
-
gem.add_dependency "faraday"
|
20
|
+
gem.add_dependency "cistern", "~> 0.5.1"
|
21
|
+
gem.add_dependency "faraday", "~> 0.8.8"
|
22
22
|
gem.add_dependency "faraday_middleware"
|
23
23
|
gem.add_dependency "jwt"
|
24
24
|
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Josh Lane
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: addressable
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,39 +27,34 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: cistern
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.
|
33
|
+
version: 0.5.1
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.
|
40
|
+
version: 0.5.1
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: faraday
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: 0.8.8
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
54
|
+
version: 0.8.8
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: faraday_middleware
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: jwt
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -226,27 +215,26 @@ files:
|
|
226
215
|
homepage: http://joshualane.com/zendesk2
|
227
216
|
licenses:
|
228
217
|
- MIT
|
218
|
+
metadata: {}
|
229
219
|
post_install_message:
|
230
220
|
rdoc_options: []
|
231
221
|
require_paths:
|
232
222
|
- lib
|
233
223
|
required_ruby_version: !ruby/object:Gem::Requirement
|
234
|
-
none: false
|
235
224
|
requirements:
|
236
225
|
- - ! '>='
|
237
226
|
- !ruby/object:Gem::Version
|
238
227
|
version: '0'
|
239
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
|
-
none: false
|
241
229
|
requirements:
|
242
230
|
- - ! '>='
|
243
231
|
- !ruby/object:Gem::Version
|
244
232
|
version: '0'
|
245
233
|
requirements: []
|
246
234
|
rubyforge_project:
|
247
|
-
rubygems_version:
|
235
|
+
rubygems_version: 2.2.0
|
248
236
|
signing_key:
|
249
|
-
specification_version:
|
237
|
+
specification_version: 4
|
250
238
|
summary: Zendesk V2 API client
|
251
239
|
test_files:
|
252
240
|
- spec/categories_spec.rb
|