zendesk2 0.4.3 → 0.4.4

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NTEwMjM0ZDE4MjQ2Mzc5N2RkYTFmODU5MjRkZGQ1YTQ0MjA5MmYzMA==
5
- data.tar.gz: !binary |-
6
- YzBjZmVmOGNiNzU1NDgyNTQ0MDBkMGJkYzNiNTVlOTI1OGFiNjhmNA==
2
+ SHA1:
3
+ metadata.gz: 36f8f737437bc490b562bba51cd72fec6ffad957
4
+ data.tar.gz: 2497c5274d2462c7d601ced33979ee752d344d51
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MmNlYTRjZjk2NjI1ZDY5MjQ1N2Y3M2I2MzI5OGIyNmI1N2Y5ZWNiM2M4N2Fm
10
- OWU1ZDg0OTE3N2I5MGVmMDIwYzBiZjNlOWE1NjlmYzY5MDE2OTc5MGZjODNj
11
- MTE5OWZlOWI5YTIyZDA0NDNiNDZkNDY2MGEwMDIwMGYxYzNlNmU=
12
- data.tar.gz: !binary |-
13
- MmE4NWQyNWIyMjEzMTU1MTYyODYxYTA5OWFmZTg4NTIyMWRjMGU4ZTNkYjM2
14
- NjUzNTRjMGRjYjFhOTMzYzMzZGFmYThhZDYzMGUyMDI1YjdjYzlhZTkwYzkw
15
- OWRkNzkzMTk4Y2NhYjY5MDYwNzViODU2ZGFhODE3YmFiNDQzOTQ=
6
+ metadata.gz: 963a99eddbf1d5533c549360051df1589b619e581b027887dc0abe8551bc71e518a8c70323135160c9ad57cfcdb01f61adeb26fd4ac09a6c9c20993e524f551f
7
+ data.tar.gz: b316d150a0ce25ba55e744f5e66dd3ebc5a1d957418d76bc2e817a214e26ecc78dc4de2352530ea1310e354f5458a0c74afad051d1ead7be59d9f672803dfece
data/.travis.yml CHANGED
@@ -1,11 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - "2.1.1"
3
4
  - "1.9.3"
4
- - "rbx-19mode"
5
5
  - "jruby-19mode"
6
6
  bundler_args: "--without development"
7
7
  before_install:
8
- - "gem install bundler -v 1.2.3"
8
+ - "gem install bundler -v 1.5.2"
9
9
  script: "bundle exec rake --trace"
10
10
  notifications:
11
11
  email:
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'rake'
7
- #To avoid warnings from JWT
7
+ # To avoid warnings from JWT
8
8
  gem 'json', '~> 1.7.7'
9
9
 
10
10
  group :development, :test do
@@ -0,0 +1,56 @@
1
+ class Zendesk2::Client::Membership < Zendesk2::Model
2
+ extend Zendesk2::Attributes
3
+
4
+ PARAMS = %w[user_id organization_id default]
5
+
6
+ # @return [Integer] Automatically assigned upon creation
7
+ identity :id, type: :integer
8
+
9
+ # @return [Time] The time the identity got created
10
+ attribute :created_at, type: :time
11
+ # @return [Boolean] Is membership the default
12
+ attribute :default, type: :boolean
13
+ # @return [Integer] The id of the organization
14
+ attribute :organization_id, type: :integer
15
+ # @return [Time] The time the identity got updated
16
+ attribute :updated_at, type: :time
17
+ # @return [Integer] The id of the user
18
+ attribute :user_id, type: :integer
19
+ # @return [String] The API url of this identity
20
+ attribute :url, type: :string
21
+
22
+ assoc_accessor :organization
23
+ assoc_accessor :user
24
+
25
+ def save!
26
+ data = if new_record?
27
+ requires :organization_id, :user_id
28
+
29
+ connection.create_membership(params).body["organization_membership"]
30
+ else
31
+ requires :identity
32
+
33
+ raise ArgumentError, "update not implemented"
34
+ end
35
+ merge_attributes(data)
36
+ end
37
+
38
+ def destroy
39
+ requires :identity
40
+
41
+ connection.destroy_membership("id" => self.identity)
42
+ end
43
+
44
+ def default!
45
+ requires :identity, :user_id
46
+
47
+ self.connection.mark_membership_default("user_id" => self.user_id, "id" => self.identity)
48
+ self.default = true
49
+ end
50
+
51
+ private
52
+
53
+ def params
54
+ Cistern::Hash.slice(Zendesk2.stringify_keys(attributes), *PARAMS)
55
+ end
56
+ end
@@ -0,0 +1,35 @@
1
+ class Zendesk2::Client::Memberships < Zendesk2::Collection
2
+ extend Zendesk2::Attributes
3
+
4
+ model Zendesk2::Client::Membership
5
+
6
+ attribute :user_id, type: :integer
7
+ attribute :organization_id, type: :integer
8
+
9
+ assoc_accessor :organization
10
+ assoc_accessor :user
11
+
12
+ self.collection_root = "organization_memberships"
13
+ self.model_method = :get_membership
14
+ self.model_root = "organization_membership"
15
+
16
+ def all(params={})
17
+ requires_one :user_id, :organization_id
18
+
19
+ body = if self.user_id && self.organization_id
20
+ { "organization_memberships" => [ connection.get_membership("user_id" => self.user_id, "organization_id" => self.organization_id).body["organization_membership"] ]
21
+ }
22
+ elsif self.user_id
23
+ connection.get_user_memberships("user_id" => self.user_id).body
24
+ else
25
+ connection.get_organization_memberships("organization_id" => self.organization_id).body
26
+ end
27
+
28
+ self.load(body[collection_root])
29
+ self.merge_attributes(Cistern::Hash.slice(body, "count", "next_page", "previous_page"))
30
+ self
31
+ end
32
+
33
+ scopes << :user_id
34
+ scopes << :organization_id
35
+ end
@@ -56,6 +56,13 @@ class Zendesk2::Client::Organization < Zendesk2::Model
56
56
  connection.users.load(data)
57
57
  end
58
58
 
59
+ # @return [Zendesk2::Client::Memberships] memberships associated with this organization
60
+ def memberships
61
+ requires :identity
62
+
63
+ connection.memberships(organization: self)
64
+ end
65
+
59
66
  # @return [Zendesk2::Client::Tickets] tickets associated with this organization
60
67
  def tickets
61
68
  requires :identity
@@ -72,4 +79,4 @@ class Zendesk2::Client::Organization < Zendesk2::Model
72
79
  writable_attributes.delete("group_id") if writable_attributes["group_id"].to_s == "0"
73
80
  writable_attributes
74
81
  end
75
- end
82
+ end
@@ -1,6 +1,6 @@
1
1
  class Zendesk2::Client
2
2
  class TicketVoiceComment < AuditEvent
3
- # @return [integer] Automatically assigned when creating events
3
+ # @return [Integer] Automatically assigned when creating events
4
4
  identity :id, type: :integer
5
5
 
6
6
  # @return [Array] The attachments on this comment as Attachment objects
@@ -19,8 +19,6 @@ class Zendesk2::Client
19
19
  attribute :html_body, type: :string
20
20
  # @return [Boolean] If this is a public comment or an internal agents only note
21
21
  attribute :public, type: :boolean
22
- # @return [Boolean] If true, the ticket requester can see this comment
23
- attribute :public, type: :boolean
24
22
  # @return [Boolean] If this comment is trusted or marked as being potentially fraudulent
25
23
  attribute :trusted, type: :boolean
26
24
  # @return [String] Has the value VoiceComment
@@ -178,6 +178,11 @@ class Zendesk2::Client::User < Zendesk2::Model
178
178
  self.connection.user_identities("user_id" => self.identity)
179
179
  end
180
180
 
181
+ # @return [Zendesk2::Client::Memberships] the organization memberships of this user
182
+ def memberships
183
+ self.connection.memberships(user: self)
184
+ end
185
+
181
186
  private
182
187
 
183
188
  def params
@@ -0,0 +1,39 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def create_membership(params={})
4
+ user_id = params["user_id"]
5
+
6
+ request(
7
+ :body => {"organization_membership" => params },
8
+ :method => :post,
9
+ :path => "/users/#{user_id}/organization_memberships.json",
10
+ )
11
+ end
12
+ end # Real
13
+
14
+ class Mock
15
+ def create_membership(params={})
16
+ user_id = params["user_id"]
17
+ organization_id = params["organization_id"]
18
+
19
+ resource_id = self.class.new_id
20
+
21
+ default_membership = false # !self.data[:memberships].values.find { |m| m["user_id"] == user_id && m["default"] }
22
+
23
+ resource = {
24
+ "id" => resource_id,
25
+ "user_id" => user_id,
26
+ "organization_id" => organization_id,
27
+ "default" => default_membership,
28
+ }
29
+
30
+ self.data[:memberships][resource_id] = resource
31
+
32
+ response(
33
+ :method => :post,
34
+ :body => { "organization_membership" => resource },
35
+ :path => "/users/#{user_id}/organization_memberships.json",
36
+ )
37
+ end
38
+ end # Mock
39
+ end
@@ -0,0 +1,27 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def destroy_membership(params={})
4
+ id = params["id"]
5
+
6
+ request(
7
+ :method => :delete,
8
+ :path => "/organization_memberships/#{id}.json"
9
+ )
10
+ end
11
+ end
12
+
13
+ class Mock
14
+ def destroy_membership(params={})
15
+ id = params["id"]
16
+
17
+ body = self.data[:memberships].delete(id)
18
+ response(
19
+ :method => :delete,
20
+ :path => "/organization_memberships/#{id}.json",
21
+ :body => {
22
+ "membership" => body,
23
+ },
24
+ )
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,35 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def get_membership(params={})
4
+ id = params["id"]
5
+
6
+ request(
7
+ :method => :get,
8
+ :path => "/organization_memberships/#{id}.json",
9
+ )
10
+ end
11
+ end # Real
12
+
13
+ class Mock
14
+ def get_membership(params={})
15
+ membership_id = params["id"]
16
+
17
+ path = "/organization_memberships/#{membership_id}.json"
18
+
19
+ if body = self.data[:memberships][membership_id]
20
+ response(
21
+ :path => path,
22
+ :body => {
23
+ "organization_membership" => body
24
+ },
25
+ )
26
+ else
27
+ response(
28
+ :path => path,
29
+ :status => 404,
30
+ :body => {"error" => "RecordNotFound", "description" => "Not found"},
31
+ )
32
+ end
33
+ end
34
+ end # Mock
35
+ end
@@ -0,0 +1,20 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def get_organization_memberships(params={})
4
+ organization_id = params["organization_id"]
5
+
6
+ request(
7
+ :method => :get,
8
+ :path => "/organizations/#{organization_id}/memberships.json",
9
+ )
10
+ end
11
+ end # Real
12
+
13
+ class Mock
14
+ def get_organization_memberships(params={})
15
+ organization_id = params["organization_id"]
16
+
17
+ page(params, :memberships, "/organizations/#{organization_id}/memberships.json", "organization_memberships", filter: lambda { |c| c.select { |m| m["organization_id"] == organization_id } })
18
+ end
19
+ end # Mock
20
+ end
@@ -0,0 +1,22 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def get_user_memberships(params={})
4
+ user_id = params["user_id"]
5
+ page_params = Zendesk2.paging_parameters(params)
6
+
7
+ request(
8
+ :params => page_params,
9
+ :method => :get,
10
+ :path => "/users/#{user_id}/organization_memberships.json",
11
+ )
12
+ end
13
+ end # Real
14
+
15
+ class Mock
16
+ def get_user_memberships(params={})
17
+ user_id = params["user_id"]
18
+
19
+ page(params, :memberships, "/users/#{user_id}/organization_memberships.json", "organization_memberships", filter: lambda{|c| c.select { |a| a["user_id"] == user_id }})
20
+ end
21
+ end # Mock
22
+ end
@@ -0,0 +1,40 @@
1
+ class Zendesk2::Client
2
+ class Real
3
+ def mark_membership_default(params={})
4
+ id = params.delete("id")
5
+ user_id = params.delete("user_id")
6
+
7
+ path = "/users/#{user_id}/organization_memberships/#{id}/make_default.json"
8
+
9
+ request(
10
+ :method => :put,
11
+ :path => path,
12
+ )
13
+ end
14
+ end
15
+ class Mock
16
+ def mark_membership_default(params={})
17
+ id = params.delete("id")
18
+ user_id = params.delete("user_id")
19
+
20
+ path = "/users/#{user_id}/organization_memberships/#{id}/make_default.json"
21
+
22
+ if (membership = self.data[:memberships][id]) && membership["user_id"] == user_id
23
+ # only one user can be default
24
+ other_user_memberships = self.data[:memberships].values.select { |m| m["user_id"] == user_id }
25
+ other_user_memberships.each { |i| i["default"] = false }
26
+ membership["default"] = true
27
+
28
+ response(
29
+ :method => :put,
30
+ :path => path
31
+ )
32
+ else
33
+ response(
34
+ :path => path,
35
+ :status => 404
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
@@ -9,6 +9,7 @@ class Zendesk2::Client < Cistern::Service
9
9
  collection :categories
10
10
  collection :forums
11
11
  collection :groups
12
+ collection :memberships
12
13
  collection :organizations
13
14
  collection :ticket_audits
14
15
  collection :ticket_fields
@@ -22,6 +23,7 @@ class Zendesk2::Client < Cistern::Service
22
23
  model :category
23
24
  model :forum
24
25
  model :group
26
+ model :membership
25
27
  model :organization
26
28
  model :ticket
27
29
  model :ticket_audit
@@ -42,6 +44,7 @@ class Zendesk2::Client < Cistern::Service
42
44
  request :create_category
43
45
  request :create_forum
44
46
  request :create_group
47
+ request :create_membership
45
48
  request :create_organization
46
49
  request :create_ticket
47
50
  request :create_ticket_field
@@ -52,6 +55,7 @@ class Zendesk2::Client < Cistern::Service
52
55
  request :destroy_category
53
56
  request :destroy_forum
54
57
  request :destroy_group
58
+ request :destroy_membership
55
59
  request :destroy_organization
56
60
  request :destroy_ticket
57
61
  request :destroy_ticket_field
@@ -68,6 +72,9 @@ class Zendesk2::Client < Cistern::Service
68
72
  request :get_forums
69
73
  request :get_group
70
74
  request :get_groups
75
+ request :get_membership
76
+ request :get_user_memberships
77
+ request :get_organization_memberships
71
78
  request :get_organization
72
79
  request :get_organization_by_external_id
73
80
  request :get_organization_tickets
@@ -91,9 +98,10 @@ class Zendesk2::Client < Cistern::Service
91
98
  request :get_user_identities
92
99
  request :get_user_identity
93
100
  request :get_users
101
+ request :mark_membership_default
102
+ request :mark_user_identity_primary
94
103
  request :search
95
104
  request :search_user
96
- request :mark_user_identity_primary
97
105
  request :update_category
98
106
  request :update_forum
99
107
  request :update_group
@@ -182,6 +190,7 @@ class Zendesk2::Client < Cistern::Service
182
190
  :forums => {},
183
191
  :groups => {},
184
192
  :identities => {},
193
+ :memberships => {},
185
194
  :organizations => {},
186
195
  :ticket_audits => {},
187
196
  :ticket_comments => {},
@@ -1,3 +1,3 @@
1
1
  module Zendesk2
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe "memberships" do
4
+ let(:client) { create_client }
5
+ let(:user) { client.users.create!(email: "zendesk2+#{Zendesk2.uuid}@example.org", name: Zendesk2.uuid, verified: true) }
6
+ let(:organization) { client.organizations.create!(name: Zendesk2.uuid) }
7
+
8
+ include_examples "zendesk resource", {
9
+ :params => lambda { {organization_id: organization.id, user_id: user.id} },
10
+ :collection => lambda { client.memberships(user: user) },
11
+ :paged => false,
12
+ :update => false,
13
+ :search => false,
14
+ }
15
+
16
+ it "should be marked as default" do
17
+ membership = client.memberships.create!(organization: organization, user: user)
18
+ another_organization = client.organizations.create!(name: Zendesk2.uuid)
19
+
20
+ another_membership = client.memberships.create!(organization: another_organization, user: user)
21
+
22
+ membership.default.should be_false # for some reason
23
+ another_membership.default.should be_false
24
+
25
+ expect { another_membership.default! }.to change { another_membership.reload.default }.from(false).to(true)
26
+
27
+ membership.reload.default.should be_false
28
+ end
29
+
30
+ it "should get an organization's memberships" do
31
+ another_user = client.users.create!(email: "zendesk2+#{Zendesk2.uuid}@example.org", name: Zendesk2.uuid, verified: true)
32
+ another_organization = client.organizations.create!(name: Zendesk2.uuid)
33
+
34
+ another_organization.memberships.create!(user: another_user)
35
+ another_organization.memberships.create!(user: user)
36
+ organization.memberships.create!(user: another_user)
37
+
38
+ organization.memberships.size.should == 1
39
+ another_organization.memberships.size.should == 2
40
+ end
41
+
42
+ it "should get an user's memberships" do
43
+ another_user = client.users.create!(email: "zendesk2+#{Zendesk2.uuid}@example.org", name: Zendesk2.uuid, verified: true)
44
+ another_organization = client.organizations.create!(name: Zendesk2.uuid)
45
+
46
+ another_organization.memberships.create!(user: another_user)
47
+ user_membership = another_organization.memberships.create!(user: user)
48
+ organization.memberships.create!(user: another_user)
49
+
50
+ user.memberships.to_a.should == [user_membership]
51
+ another_user.memberships.size.should == 2
52
+ end
53
+ end
@@ -1,4 +1,4 @@
1
- shared_examples "a resource" do |_collection, _params, _update_params, _options|
1
+ shared_examples "a resource" do |_collection, _params, _update_params, _options={}|
2
2
  let(:options) { _options || {} }
3
3
  let(:collection) { options[:collection] ? instance_exec(&options[:collection]) : client.send(_collection) }
4
4
  let(:params) { instance_exec(&_params) || {} }
@@ -12,36 +12,40 @@ shared_examples "a resource" do |_collection, _params, _update_params, _options|
12
12
 
13
13
  it "by fetching a specific record" do
14
14
  record = collection.create!(params)
15
- collection.get(fetch_params.call(record)).should == record
15
+ collection.get!(fetch_params.call(record)).should == record
16
16
  end
17
17
 
18
- context "that is paged" do
19
- before(:each) do
20
- 3.times.each { collection.create!(instance_exec(&_params)) }
21
- end
18
+ if _options.fetch(:paged, true)
19
+ context "that is paged" do
20
+ before(:each) do
21
+ 3.times.each { collection.create!(instance_exec(&_params)) }
22
+ end
22
23
 
23
- it "by retrieving the first page" do
24
- collection.all("per_page" => "1").size.should == 1
25
- end
24
+ it "by retrieving the first page" do
25
+ collection.all("per_page" => "1").size.should == 1
26
+ end
26
27
 
27
- it "by retrieving the next page" do
28
- first_page = collection.all("per_page" => 1)
29
- second_page = collection.all("per_page" => 1).next_page
30
- second_page.should_not == first_page
31
- end
28
+ it "by retrieving the next page" do
29
+ first_page = collection.all("per_page" => 1)
30
+ second_page = collection.all("per_page" => 1).next_page
31
+ second_page.should_not == first_page
32
+ end
32
33
 
33
- it "by retrieving the previous page" do
34
- first_page = collection.all("per_page" => "1")
35
- previous_to_second_page = collection.all("per_page" => 1).next_page.previous_page
36
- previous_to_second_page.should == first_page
34
+ it "by retrieving the previous page" do
35
+ first_page = collection.all("per_page" => "1")
36
+ previous_to_second_page = collection.all("per_page" => 1).next_page.previous_page
37
+ previous_to_second_page.should == first_page
38
+ end
37
39
  end
38
40
  end
39
41
 
40
- it "by updating a record" do
41
- record = collection.create!(params)
42
- record.merge_attributes(update_params)
43
- record.save
44
- update_params.each {|k,v| record.send(k).should == v}
42
+ if _options.fetch(:update, true)
43
+ it "by updating a record" do
44
+ record = collection.create!(params)
45
+ record.merge_attributes(update_params)
46
+ record.save
47
+ update_params.each {|k,v| record.send(k).should == v}
48
+ end
45
49
  end
46
50
 
47
51
  it "by destroying a record" do
@@ -55,6 +59,7 @@ shared_examples "a resource" do |_collection, _params, _update_params, _options|
55
59
  # Search index takes 2-3 minutes according to the docs
56
60
  it "should search" do
57
61
  pending unless Zendesk2::Client.mocking?
62
+ pending unless collection.is_a?(Zendesk2::Searchable)
58
63
  record = collection.create!(params)
59
64
  collection.search(params).should include(record)
60
65
  end
@@ -0,0 +1,64 @@
1
+ shared_examples "zendesk resource" do |options={}|
2
+ let(:collection) { instance_exec(&options[:collection]) }
3
+ let(:params) { instance_exec(&options[:params]) || {} }
4
+ let(:update_params) { instance_exec(&options[:update_params]) }
5
+ let(:fetch_params) { options[:fetch_params] || lambda { |r| r.identity } }
6
+
7
+ it "should be created" do
8
+ record = collection.create!(params)
9
+ record.identity.should_not be_nil
10
+ end
11
+
12
+ it "should be fetched" do
13
+ record = collection.create!(params)
14
+ collection.get!(fetch_params.call(record)).should == record
15
+ end
16
+
17
+ if options.fetch(:paged, true)
18
+ context "paging" do
19
+ before(:each) do
20
+ 3.times.each { collection.create!(instance_exec(&_params)) }
21
+ end
22
+
23
+ it "should retrieve first page" do
24
+ collection.all("per_page" => "1").size.should == 1
25
+ end
26
+
27
+ it "should retrieve next page" do
28
+ first_page = collection.all("per_page" => 1)
29
+ second_page = collection.all("per_page" => 1).next_page
30
+ second_page.should_not == first_page
31
+ end
32
+
33
+ it "should retreive previous page" do
34
+ first_page = collection.all("per_page" => "1")
35
+ previous_to_second_page = collection.all("per_page" => 1).next_page.previous_page
36
+ previous_to_second_page.should == first_page
37
+ end
38
+ end
39
+ end
40
+
41
+ if options.fetch(:update, true)
42
+ it "should be updated" do
43
+ record = collection.create!(params)
44
+ record.merge_attributes(update_params)
45
+ record.save
46
+ update_params.each {|k,v| record.send(k).should == v}
47
+ end
48
+ end
49
+
50
+ it "should be destroyed" do
51
+ record = collection.create!(params)
52
+ record.identity.should_not be_nil
53
+ record.destroy
54
+ record.should be_destroyed
55
+ end
56
+
57
+ if options.fetch(:search, true) && Zendesk2::Client.mocking?
58
+ # Search index takes 2-3 minutes according to the docs
59
+ it "should search" do
60
+ record = collection.create!(params)
61
+ collection.search(params).should include(record)
62
+ end
63
+ end
64
+ end
data/spec/tickets_spec.rb CHANGED
@@ -39,6 +39,8 @@ describe "tickets" do
39
39
  end
40
40
 
41
41
  it "should have empty custom fields by default" do
42
+ pending if !Zendesk2::Client.mocking?
43
+
42
44
  ticket.custom_fields.should == []
43
45
  end
44
46
  end
@@ -66,7 +68,7 @@ describe "tickets" do
66
68
  body = Zendesk2.uuid
67
69
  ticket.comment(body)
68
70
 
69
- (comment = ticket.comments.find{|c| c.body == body}).should_not be_nil
71
+ ticket.comments.find{|c| c.body == body}.should_not be_nil
70
72
  end
71
73
  end
72
74
 
data/zendesk2.gemspec CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = Zendesk2::VERSION
18
18
 
19
- gem.add_dependency "addressable"
19
+ gem.add_dependency "addressable", "~> 2.2"
20
20
  gem.add_dependency "cistern", "~> 0.5.1"
21
21
  gem.add_dependency "faraday", "~> 0.8.8"
22
- gem.add_dependency "faraday_middleware"
23
- gem.add_dependency "jwt"
22
+ gem.add_dependency "faraday_middleware", "~> 0.8"
23
+ gem.add_dependency "jwt", "~> 0.1.11"
24
24
  end
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
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-02-28 00:00:00.000000000 Z
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '2.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cistern
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.5.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.5.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.8.8
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.8.8
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: faraday_middleware
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.8'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.8'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jwt
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 0.1.11
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 0.1.11
83
83
  description: Zendesk V2 API client
84
84
  email:
85
85
  - me@joshualane.com
@@ -87,8 +87,8 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".travis.yml"
92
92
  - Gemfile
93
93
  - Guardfile
94
94
  - LICENSE
@@ -106,6 +106,8 @@ files:
106
106
  - lib/zendesk2/client/models/forums.rb
107
107
  - lib/zendesk2/client/models/group.rb
108
108
  - lib/zendesk2/client/models/groups.rb
109
+ - lib/zendesk2/client/models/membership.rb
110
+ - lib/zendesk2/client/models/memberships.rb
109
111
  - lib/zendesk2/client/models/organization.rb
110
112
  - lib/zendesk2/client/models/organizations.rb
111
113
  - lib/zendesk2/client/models/ticket.rb
@@ -134,6 +136,7 @@ files:
134
136
  - lib/zendesk2/client/requests/create_category.rb
135
137
  - lib/zendesk2/client/requests/create_forum.rb
136
138
  - lib/zendesk2/client/requests/create_group.rb
139
+ - lib/zendesk2/client/requests/create_membership.rb
137
140
  - lib/zendesk2/client/requests/create_organization.rb
138
141
  - lib/zendesk2/client/requests/create_ticket.rb
139
142
  - lib/zendesk2/client/requests/create_ticket_field.rb
@@ -144,6 +147,7 @@ files:
144
147
  - lib/zendesk2/client/requests/destroy_category.rb
145
148
  - lib/zendesk2/client/requests/destroy_forum.rb
146
149
  - lib/zendesk2/client/requests/destroy_group.rb
150
+ - lib/zendesk2/client/requests/destroy_membership.rb
147
151
  - lib/zendesk2/client/requests/destroy_organization.rb
148
152
  - lib/zendesk2/client/requests/destroy_ticket.rb
149
153
  - lib/zendesk2/client/requests/destroy_ticket_field.rb
@@ -161,8 +165,10 @@ files:
161
165
  - lib/zendesk2/client/requests/get_forums.rb
162
166
  - lib/zendesk2/client/requests/get_group.rb
163
167
  - lib/zendesk2/client/requests/get_groups.rb
168
+ - lib/zendesk2/client/requests/get_membership.rb
164
169
  - lib/zendesk2/client/requests/get_organization.rb
165
170
  - lib/zendesk2/client/requests/get_organization_by_external_id.rb
171
+ - lib/zendesk2/client/requests/get_organization_memberships.rb
166
172
  - lib/zendesk2/client/requests/get_organization_tickets.rb
167
173
  - lib/zendesk2/client/requests/get_organization_users.rb
168
174
  - lib/zendesk2/client/requests/get_organizations.rb
@@ -183,7 +189,9 @@ files:
183
189
  - lib/zendesk2/client/requests/get_user.rb
184
190
  - lib/zendesk2/client/requests/get_user_identities.rb
185
191
  - lib/zendesk2/client/requests/get_user_identity.rb
192
+ - lib/zendesk2/client/requests/get_user_memberships.rb
186
193
  - lib/zendesk2/client/requests/get_users.rb
194
+ - lib/zendesk2/client/requests/mark_membership_default.rb
187
195
  - lib/zendesk2/client/requests/mark_user_identity_primary.rb
188
196
  - lib/zendesk2/client/requests/search.rb
189
197
  - lib/zendesk2/client/requests/search_user.rb
@@ -208,8 +216,10 @@ files:
208
216
  - spec/config_spec.rb
209
217
  - spec/forums_spec.rb
210
218
  - spec/groups_spec.rb
219
+ - spec/memberships_spec.rb
211
220
  - spec/organizations_spec.rb
212
221
  - spec/shared/resource.rb
222
+ - spec/shared/zendesk_resource.rb
213
223
  - spec/spec_helper.rb
214
224
  - spec/support/client_helper.rb
215
225
  - spec/ticket_fields_spec.rb
@@ -229,17 +239,17 @@ require_paths:
229
239
  - lib
230
240
  required_ruby_version: !ruby/object:Gem::Requirement
231
241
  requirements:
232
- - - ! '>='
242
+ - - ">="
233
243
  - !ruby/object:Gem::Version
234
244
  version: '0'
235
245
  required_rubygems_version: !ruby/object:Gem::Requirement
236
246
  requirements:
237
- - - ! '>='
247
+ - - ">="
238
248
  - !ruby/object:Gem::Version
239
249
  version: '0'
240
250
  requirements: []
241
251
  rubyforge_project:
242
- rubygems_version: 2.2.0
252
+ rubygems_version: 2.2.2
243
253
  signing_key:
244
254
  specification_version: 4
245
255
  summary: Zendesk V2 API client
@@ -248,8 +258,10 @@ test_files:
248
258
  - spec/config_spec.rb
249
259
  - spec/forums_spec.rb
250
260
  - spec/groups_spec.rb
261
+ - spec/memberships_spec.rb
251
262
  - spec/organizations_spec.rb
252
263
  - spec/shared/resource.rb
264
+ - spec/shared/zendesk_resource.rb
253
265
  - spec/spec_helper.rb
254
266
  - spec/support/client_helper.rb
255
267
  - spec/ticket_fields_spec.rb
@@ -258,4 +270,3 @@ test_files:
258
270
  - spec/topics_spec.rb
259
271
  - spec/user_identities_spec.rb
260
272
  - spec/users_spec.rb
261
- has_rdoc: