zendesk_api 1.13.1 → 1.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zendesk_api/client.rb +1 -1
- data/lib/zendesk_api/middleware/response/parse_json.rb +0 -1
- data/lib/zendesk_api/version.rb +1 -1
- metadata +10 -205
- data/.gitignore +0 -15
- data/.rspec +0 -2
- data/.travis.yml +0 -10
- data/.yardopts +0 -10
- data/Gemfile +0 -14
- data/LICENSE +0 -176
- data/README.md +0 -425
- data/Rakefile +0 -52
- data/spec/core/association_spec.rb +0 -256
- data/spec/core/bulk_actions_spec.rb +0 -69
- data/spec/core/client_spec.rb +0 -280
- data/spec/core/collection_spec.rb +0 -901
- data/spec/core/configuration_spec.rb +0 -28
- data/spec/core/create_resource_spec.rb +0 -39
- data/spec/core/data_namespace_spec.rb +0 -15
- data/spec/core/data_resource_spec.rb +0 -239
- data/spec/core/inflection_spec.rb +0 -7
- data/spec/core/lru_cache_spec.rb +0 -26
- data/spec/core/middleware/request/encode_json_spec.rb +0 -73
- data/spec/core/middleware/request/etag_cache_spec.rb +0 -21
- data/spec/core/middleware/request/retry_spec.rb +0 -49
- data/spec/core/middleware/request/test.jpg +0 -0
- data/spec/core/middleware/request/upload_spec.rb +0 -164
- data/spec/core/middleware/response/callback_spec.rb +0 -17
- data/spec/core/middleware/response/deflate_spec.rb +0 -21
- data/spec/core/middleware/response/gzip_spec.rb +0 -25
- data/spec/core/middleware/response/parse_iso_dates_spec.rb +0 -44
- data/spec/core/middleware/response/parse_json_spec.rb +0 -53
- data/spec/core/middleware/response/raise_error_spec.rb +0 -128
- data/spec/core/middleware/response/sanitize_response_spec.rb +0 -19
- data/spec/core/read_resource_spec.rb +0 -97
- data/spec/core/resource_spec.rb +0 -541
- data/spec/core/resources/automation_spec.rb +0 -81
- data/spec/core/resources/macro_spec.rb +0 -27
- data/spec/core/resources/trigger_spec.rb +0 -67
- data/spec/core/resources/view_spec.rb +0 -97
- data/spec/core/search_spec.rb +0 -23
- data/spec/core/spec_helper.rb +0 -162
- data/spec/core/trackie_spec.rb +0 -129
- data/spec/fixtures/Argentina.gif +0 -0
- data/spec/fixtures/Argentina2.gif +0 -0
- data/spec/fixtures/credentials.yml.example +0 -3
- data/spec/fixtures/sample_app.zip +0 -0
- data/spec/fixtures/test_resources.rb +0 -22
- data/spec/fixtures/zendesk.rb +0 -109
- data/spec/live/Readme.md +0 -4
- data/spec/live/activity_spec.rb +0 -12
- data/spec/live/app_installation_spec.rb +0 -58
- data/spec/live/app_spec.rb +0 -58
- data/spec/live/audit_spec.rb +0 -15
- data/spec/live/automation_spec.rb +0 -23
- data/spec/live/bookmark_spec.rb +0 -11
- data/spec/live/brand_spec.rb +0 -14
- data/spec/live/category_spec.rb +0 -12
- data/spec/live/collection_spec.rb +0 -64
- data/spec/live/custom_role_spec.rb +0 -5
- data/spec/live/dynamic_content/item_spec.rb +0 -16
- data/spec/live/dynamic_content/variant_spec.rb +0 -19
- data/spec/live/forum_spec.rb +0 -14
- data/spec/live/forum_subscription_spec.rb +0 -12
- data/spec/live/group_membership_spec.rb +0 -18
- data/spec/live/group_spec.rb +0 -32
- data/spec/live/identity_spec.rb +0 -14
- data/spec/live/locale_spec.rb +0 -9
- data/spec/live/macro_spec.rb +0 -44
- data/spec/live/organization_field_spec.rb +0 -12
- data/spec/live/organization_membership_spec.rb +0 -11
- data/spec/live/organization_spec.rb +0 -12
- data/spec/live/push_notification_device_spec.rb +0 -21
- data/spec/live/request_spec.rb +0 -38
- data/spec/live/satisfaction_rating_spec.rb +0 -6
- data/spec/live/setting_spec.rb +0 -25
- data/spec/live/suspended_ticket_spec.rb +0 -8
- data/spec/live/tag_spec.rb +0 -58
- data/spec/live/target_spec.rb +0 -17
- data/spec/live/ticket_field_spec.rb +0 -12
- data/spec/live/ticket_form_spec.rb +0 -14
- data/spec/live/ticket_metrics_spec.rb +0 -6
- data/spec/live/ticket_spec.rb +0 -136
- data/spec/live/topic_comment_spec.rb +0 -52
- data/spec/live/topic_spec.rb +0 -46
- data/spec/live/topic_subscription_spec.rb +0 -12
- data/spec/live/topic_vote_spec.rb +0 -13
- data/spec/live/trigger_spec.rb +0 -23
- data/spec/live/upload_spec.rb +0 -10
- data/spec/live/user_field_spec.rb +0 -12
- data/spec/live/user_spec.rb +0 -71
- data/spec/live/user_view_spec.rb +0 -16
- data/spec/live/view_spec.rb +0 -22
- data/spec/live/voice/phone_number_spec.rb +0 -13
- data/spec/macros/resource_macros.rb +0 -169
- data/zendesk_api.gemspec +0 -38
data/spec/live/bookmark_spec.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Bookmark, :not_findable, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :ticket_id => ticket.id }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_deletable
|
10
|
-
it_should_be_readable :bookmarks, :create => true
|
11
|
-
end
|
data/spec/live/brand_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Brand, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :name => "awesomesauce", :subdomain => "zendeskapi#{SecureRandom.hex(3)}" }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_updatable :name
|
10
|
-
it_should_be_readable :brands
|
11
|
-
|
12
|
-
# Deleted brands are still findable by id, but in the index action
|
13
|
-
it_should_be_deletable :find => nil
|
14
|
-
end
|
data/spec/live/category_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Category, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :name => "My Category" }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_updatable :name
|
10
|
-
it_should_be_deletable
|
11
|
-
it_should_be_readable :categories, :create => true
|
12
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Collection do
|
4
|
-
subject do
|
5
|
-
ZendeskAPI::Collection.new(client, ZendeskAPI::TestResource)
|
6
|
-
end
|
7
|
-
|
8
|
-
context "with real data" do
|
9
|
-
subject do
|
10
|
-
ZendeskAPI::Collection.new(client, ZendeskAPI::User)
|
11
|
-
end
|
12
|
-
|
13
|
-
before(:each) do
|
14
|
-
VCR.use_cassette('collection_fetch_users') do
|
15
|
-
subject.per_page(1).page(2)
|
16
|
-
subject.fetch(true)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "pagination with no options", :vcr do
|
21
|
-
before(:each) { subject.per_page(nil).page(nil) }
|
22
|
-
|
23
|
-
it "should find the next page by calling fetch" do
|
24
|
-
current = subject.to_a.dup
|
25
|
-
nxt = subject.next
|
26
|
-
|
27
|
-
expect(nxt.size).to eq(1)
|
28
|
-
expect(nxt).to_not eq(current)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should find the prev page by calling fetch" do
|
32
|
-
current = subject.to_a.dup
|
33
|
-
prev = subject.prev
|
34
|
-
|
35
|
-
expect(prev.size).to eq(1)
|
36
|
-
expect(prev).to_not eq(current)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context "pagination with options", :vcr do
|
41
|
-
before(:each) { subject.per_page(1).page(2) }
|
42
|
-
|
43
|
-
it "should increase page option and not call fetch" do
|
44
|
-
expect(subject.next).to eq(3)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should decrease page option and not call fetch" do
|
48
|
-
expect(subject.prev).to eq(1)
|
49
|
-
end
|
50
|
-
|
51
|
-
context "with page == 1" do
|
52
|
-
before do
|
53
|
-
subject.page(1)
|
54
|
-
subject.clear_cache
|
55
|
-
expect(subject).to_not receive(:fetch)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should do nothing on #prev" do
|
59
|
-
expect(subject.prev).to eq([])
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::DynamicContent::Item, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{
|
6
|
-
:name => "Snowboard Problem",
|
7
|
-
:default_locale_id => 1,
|
8
|
-
:content => "Snowboard Problem variant"
|
9
|
-
}
|
10
|
-
end
|
11
|
-
|
12
|
-
it_should_be_readable :dynamic_content, :items, :create => true
|
13
|
-
it_should_be_creatable
|
14
|
-
it_should_be_updatable :name
|
15
|
-
it_should_be_deletable
|
16
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::DynamicContent::Item::Variant, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{
|
6
|
-
:locale_id => 43,
|
7
|
-
:active => true,
|
8
|
-
:default => false,
|
9
|
-
:content => 'Mon dieu!'
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
under dynamic_content_item do
|
14
|
-
it_should_be_readable dynamic_content_item, :variants, :create => true
|
15
|
-
it_should_be_creatable
|
16
|
-
it_should_be_updatable :content
|
17
|
-
it_should_be_deletable
|
18
|
-
end
|
19
|
-
end
|
data/spec/live/forum_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Forum, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :name => "My Forum", :forum_type => "articles", :access => "logged-in users", :category_id => category.id }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_updatable :name
|
10
|
-
# Forum delete jobs are queued, so don't look for it
|
11
|
-
it_should_be_deletable :find => false
|
12
|
-
it_should_be_readable :forums, :create => true
|
13
|
-
it_should_be_readable category, :forums, :create => true
|
14
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::ForumSubscription, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :forum_id => forum.id, :user_id => agent.id }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_deletable
|
10
|
-
it_should_be_readable forum, :subscriptions, :create => true
|
11
|
-
it_should_be_readable agent, :forum_subscriptions, :create => true
|
12
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::GroupMembership, :delete_after do
|
4
|
-
before :all do
|
5
|
-
VCR.use_cassette("delete_existing_group_memberships_create") do
|
6
|
-
agent.group_memberships.each(&:destroy)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def valid_attributes
|
11
|
-
{ :group_id => group.id, :user_id => agent.id }
|
12
|
-
end
|
13
|
-
|
14
|
-
it_should_be_creatable
|
15
|
-
it_should_be_deletable
|
16
|
-
it_should_be_readable :group_memberships
|
17
|
-
it_should_be_readable agent, :group_memberships, :create => true
|
18
|
-
end
|
data/spec/live/group_spec.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Group, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :name => "My Group" }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_updatable :name
|
10
|
-
it_should_be_deletable :find => [:deleted?, true]
|
11
|
-
it_should_be_readable :groups
|
12
|
-
it_should_be_readable :groups, :assignable
|
13
|
-
|
14
|
-
context "with a membership" do
|
15
|
-
before(:each) do
|
16
|
-
VCR.use_cassette("read_ZendeskAPI::User_groups_create") do
|
17
|
-
attrs = valid_attributes
|
18
|
-
attrs.merge!(@default_options) if @default_options
|
19
|
-
@object = described_class.create!(client, attrs)
|
20
|
-
@membership = agent.group_memberships.create(:group_id => @object.id, :user_id => agent.id)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
after(:each) do
|
25
|
-
VCR.use_cassette("read_ZendeskAPI::User_groups_delete") do
|
26
|
-
@object.destroy
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it_should_be_readable agent, :groups
|
31
|
-
end
|
32
|
-
end
|
data/spec/live/identity_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::User::Identity, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :type => "email", :value => "abcdef@example.com" }
|
6
|
-
end
|
7
|
-
|
8
|
-
under current_user do
|
9
|
-
it_should_be_creatable
|
10
|
-
it_should_be_updatable :verified, true
|
11
|
-
it_should_be_deletable
|
12
|
-
it_should_be_readable current_user, :identities, :create => true
|
13
|
-
end
|
14
|
-
end
|
data/spec/live/locale_spec.rb
DELETED
data/spec/live/macro_spec.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Macro, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :title => "my test macro", :actions => [{ :field => "status", :value => "solved" }] }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_readable :macros
|
9
|
-
it_should_be_readable :macros, :active
|
10
|
-
|
11
|
-
it_should_be_creatable
|
12
|
-
it_should_be_updatable :actions, [{ "field" => "priority", "value" => "low" }]
|
13
|
-
it_should_be_deletable
|
14
|
-
|
15
|
-
describe "application", :vcr do
|
16
|
-
subject { @object }
|
17
|
-
|
18
|
-
before :all do
|
19
|
-
VCR.use_cassette("#{described_class.to_s}_application_create") do
|
20
|
-
@object = described_class.create(client, valid_attributes.merge(default_options))
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
after :all do
|
25
|
-
VCR.use_cassette("#{described_class.to_s}_application_delete") do
|
26
|
-
@object.destroy
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "to a ticket" do
|
31
|
-
it "should return a hash" do
|
32
|
-
result = subject.apply(ticket)
|
33
|
-
expect(result).to be_instance_of(Hashie::Mash)
|
34
|
-
expect(result.ticket).to_not be_nil
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should be appliable" do
|
39
|
-
result = subject.apply
|
40
|
-
expect(result).to be_instance_of(Hashie::Mash)
|
41
|
-
expect(result.ticket).to_not be_nil
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::OrganizationField, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :type => "text", :title => "Age", :key => "age" }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_updatable :title, "key"
|
10
|
-
it_should_be_deletable
|
11
|
-
it_should_be_readable :organization_fields, :create => true
|
12
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::OrganizationMembership, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :organization_id => organization.id, :user_id => user.id }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_deletable
|
10
|
-
it_should_be_readable :organization_memberships
|
11
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Organization, :delete_after do
|
4
|
-
def valid_attributes
|
5
|
-
{ :name => "Awesome-O" }
|
6
|
-
end
|
7
|
-
|
8
|
-
it_should_be_creatable
|
9
|
-
it_should_be_updatable :name
|
10
|
-
it_should_be_deletable
|
11
|
-
it_should_be_readable :organizations, :create => true
|
12
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::PushNotificationDevice do
|
4
|
-
describe ".destroy_many" do
|
5
|
-
describe "Existing push notification devices" do
|
6
|
-
it "destroys the given push notification devices" do
|
7
|
-
VCR.use_cassette("push_notification_devices_destroy_many") do
|
8
|
-
ZendeskAPI::PushNotificationDevice.destroy_many(client, ["foo", "bar"])
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "Non-existing devices" do
|
14
|
-
it "silently ignores the devices" do
|
15
|
-
VCR.use_cassette("push_notification_devices_destroy_many") do
|
16
|
-
ZendeskAPI::PushNotificationDevice.destroy_many(client, ["baz"])
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/spec/live/request_spec.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Request do
|
4
|
-
def valid_attributes
|
5
|
-
{
|
6
|
-
:subject => "This is a question!",
|
7
|
-
:comment => { :value => "Haha, no." }
|
8
|
-
}
|
9
|
-
end
|
10
|
-
|
11
|
-
it_should_be_creatable
|
12
|
-
it_should_be_updatable :solved, true, { :comment => { :value => 'This is solved!' } }
|
13
|
-
it_should_be_readable :requests
|
14
|
-
it_should_be_readable user, :requests
|
15
|
-
|
16
|
-
it "can upload while creating" do
|
17
|
-
VCR.use_cassette("request_inline_uploads") do
|
18
|
-
request = ZendeskAPI::Request.new(client, valid_attributes)
|
19
|
-
request.comment.uploads << "spec/fixtures/Argentina.gif"
|
20
|
-
request.comment.uploads << File.new("spec/fixtures/Argentina.gif")
|
21
|
-
|
22
|
-
request.save!
|
23
|
-
expect(request.changes).to eq({}) # uploads were set before save
|
24
|
-
expect(request.comment.attributes[:uploads].map(&:class)).to eq([String, String]) # upload was sent as tokens
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it "can comment while creating" do
|
29
|
-
VCR.use_cassette("request_inline_comments") do
|
30
|
-
request = ZendeskAPI::Request.new(client, valid_attributes)
|
31
|
-
request.comment = ZendeskAPI::Request::Comment.new(client, :value => "My comment")
|
32
|
-
request.save!
|
33
|
-
|
34
|
-
expect(request.changes).to eq({}) # comment was set before save
|
35
|
-
expect(request.attributes[:comment]).to eq({"value" => "My comment"})
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/spec/live/setting_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'core/spec_helper'
|
2
|
-
|
3
|
-
describe ZendeskAPI::Setting do
|
4
|
-
it_should_be_readable :settings, :path => 'account/settings'
|
5
|
-
|
6
|
-
under (user = ZendeskAPI::User.new(client, :id => 'me')) do
|
7
|
-
it_should_be_readable user, :settings
|
8
|
-
|
9
|
-
describe 'updating', :vcr do
|
10
|
-
it 'should be updatable' do
|
11
|
-
settings = user.settings
|
12
|
-
lotus = settings.detect {|set| set.on == "lotus"}
|
13
|
-
|
14
|
-
original_setting = lotus.keyboard_shortcuts_enabled
|
15
|
-
lotus.keyboard_shortcuts_enabled = !original_setting
|
16
|
-
|
17
|
-
settings.save!
|
18
|
-
settings.fetch!(true)
|
19
|
-
|
20
|
-
lotus = settings.detect {|set| set.on == "lotus"}
|
21
|
-
expect(lotus.keyboard_shortcuts_enabled).to eq(!original_setting)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|