zendesk_api 1.13.1 → 1.13.2

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zendesk_api/client.rb +1 -1
  3. data/lib/zendesk_api/middleware/response/parse_json.rb +0 -1
  4. data/lib/zendesk_api/version.rb +1 -1
  5. metadata +10 -205
  6. data/.gitignore +0 -15
  7. data/.rspec +0 -2
  8. data/.travis.yml +0 -10
  9. data/.yardopts +0 -10
  10. data/Gemfile +0 -14
  11. data/LICENSE +0 -176
  12. data/README.md +0 -425
  13. data/Rakefile +0 -52
  14. data/spec/core/association_spec.rb +0 -256
  15. data/spec/core/bulk_actions_spec.rb +0 -69
  16. data/spec/core/client_spec.rb +0 -280
  17. data/spec/core/collection_spec.rb +0 -901
  18. data/spec/core/configuration_spec.rb +0 -28
  19. data/spec/core/create_resource_spec.rb +0 -39
  20. data/spec/core/data_namespace_spec.rb +0 -15
  21. data/spec/core/data_resource_spec.rb +0 -239
  22. data/spec/core/inflection_spec.rb +0 -7
  23. data/spec/core/lru_cache_spec.rb +0 -26
  24. data/spec/core/middleware/request/encode_json_spec.rb +0 -73
  25. data/spec/core/middleware/request/etag_cache_spec.rb +0 -21
  26. data/spec/core/middleware/request/retry_spec.rb +0 -49
  27. data/spec/core/middleware/request/test.jpg +0 -0
  28. data/spec/core/middleware/request/upload_spec.rb +0 -164
  29. data/spec/core/middleware/response/callback_spec.rb +0 -17
  30. data/spec/core/middleware/response/deflate_spec.rb +0 -21
  31. data/spec/core/middleware/response/gzip_spec.rb +0 -25
  32. data/spec/core/middleware/response/parse_iso_dates_spec.rb +0 -44
  33. data/spec/core/middleware/response/parse_json_spec.rb +0 -53
  34. data/spec/core/middleware/response/raise_error_spec.rb +0 -128
  35. data/spec/core/middleware/response/sanitize_response_spec.rb +0 -19
  36. data/spec/core/read_resource_spec.rb +0 -97
  37. data/spec/core/resource_spec.rb +0 -541
  38. data/spec/core/resources/automation_spec.rb +0 -81
  39. data/spec/core/resources/macro_spec.rb +0 -27
  40. data/spec/core/resources/trigger_spec.rb +0 -67
  41. data/spec/core/resources/view_spec.rb +0 -97
  42. data/spec/core/search_spec.rb +0 -23
  43. data/spec/core/spec_helper.rb +0 -162
  44. data/spec/core/trackie_spec.rb +0 -129
  45. data/spec/fixtures/Argentina.gif +0 -0
  46. data/spec/fixtures/Argentina2.gif +0 -0
  47. data/spec/fixtures/credentials.yml.example +0 -3
  48. data/spec/fixtures/sample_app.zip +0 -0
  49. data/spec/fixtures/test_resources.rb +0 -22
  50. data/spec/fixtures/zendesk.rb +0 -109
  51. data/spec/live/Readme.md +0 -4
  52. data/spec/live/activity_spec.rb +0 -12
  53. data/spec/live/app_installation_spec.rb +0 -58
  54. data/spec/live/app_spec.rb +0 -58
  55. data/spec/live/audit_spec.rb +0 -15
  56. data/spec/live/automation_spec.rb +0 -23
  57. data/spec/live/bookmark_spec.rb +0 -11
  58. data/spec/live/brand_spec.rb +0 -14
  59. data/spec/live/category_spec.rb +0 -12
  60. data/spec/live/collection_spec.rb +0 -64
  61. data/spec/live/custom_role_spec.rb +0 -5
  62. data/spec/live/dynamic_content/item_spec.rb +0 -16
  63. data/spec/live/dynamic_content/variant_spec.rb +0 -19
  64. data/spec/live/forum_spec.rb +0 -14
  65. data/spec/live/forum_subscription_spec.rb +0 -12
  66. data/spec/live/group_membership_spec.rb +0 -18
  67. data/spec/live/group_spec.rb +0 -32
  68. data/spec/live/identity_spec.rb +0 -14
  69. data/spec/live/locale_spec.rb +0 -9
  70. data/spec/live/macro_spec.rb +0 -44
  71. data/spec/live/organization_field_spec.rb +0 -12
  72. data/spec/live/organization_membership_spec.rb +0 -11
  73. data/spec/live/organization_spec.rb +0 -12
  74. data/spec/live/push_notification_device_spec.rb +0 -21
  75. data/spec/live/request_spec.rb +0 -38
  76. data/spec/live/satisfaction_rating_spec.rb +0 -6
  77. data/spec/live/setting_spec.rb +0 -25
  78. data/spec/live/suspended_ticket_spec.rb +0 -8
  79. data/spec/live/tag_spec.rb +0 -58
  80. data/spec/live/target_spec.rb +0 -17
  81. data/spec/live/ticket_field_spec.rb +0 -12
  82. data/spec/live/ticket_form_spec.rb +0 -14
  83. data/spec/live/ticket_metrics_spec.rb +0 -6
  84. data/spec/live/ticket_spec.rb +0 -136
  85. data/spec/live/topic_comment_spec.rb +0 -52
  86. data/spec/live/topic_spec.rb +0 -46
  87. data/spec/live/topic_subscription_spec.rb +0 -12
  88. data/spec/live/topic_vote_spec.rb +0 -13
  89. data/spec/live/trigger_spec.rb +0 -23
  90. data/spec/live/upload_spec.rb +0 -10
  91. data/spec/live/user_field_spec.rb +0 -12
  92. data/spec/live/user_spec.rb +0 -71
  93. data/spec/live/user_view_spec.rb +0 -16
  94. data/spec/live/view_spec.rb +0 -22
  95. data/spec/live/voice/phone_number_spec.rb +0 -13
  96. data/spec/macros/resource_macros.rb +0 -169
  97. data/zendesk_api.gemspec +0 -38
@@ -1,129 +0,0 @@
1
- require 'core/spec_helper'
2
-
3
- describe ZendeskAPI::Trackie do
4
- subject { ZendeskAPI::Trackie.new }
5
- before(:each) { subject.clear_changes }
6
-
7
- it "should not be changed" do
8
- expect(subject.changed?).to be(false)
9
- end
10
-
11
- context "adding keys" do
12
- before(:each) { subject[:key] = true }
13
-
14
- it "should include key in changes" do
15
- expect(subject.changes[:key]).to be(true)
16
- end
17
-
18
- specify "key should be changed" do
19
- expect(subject.changed?(:key)).to be(true)
20
- expect(subject.changed?).to be(true)
21
- end
22
- end
23
-
24
- context "deleting keys" do
25
- before(:each) do
26
- subject[:key] = true
27
- end
28
-
29
- it "returns key on deletion" do
30
- expect(subject.delete(:key)).to be(true)
31
- end
32
-
33
- context "after deletion" do
34
- before(:each) { subject.delete(:key) }
35
-
36
- it "keeps the changes" do
37
- expect(subject.changed?(:key)).to be(true)
38
- end
39
- end
40
- end
41
-
42
- context "adding identical keys" do
43
- before(:each) do
44
- subject[:key] = "foo"
45
- subject.clear_changes
46
-
47
- subject[:key] = "foo"
48
- end
49
-
50
- it "should not include key in changes" do
51
- expect(subject.changes[:key]).to be_falsey
52
- end
53
-
54
- specify "key should not be changed" do
55
- expect(subject.changed?(:key)).to be(false)
56
- expect(subject.changed?).to be(false)
57
- end
58
- end
59
-
60
- context "nested hashes" do
61
- before(:each) do
62
- subject[:key] = ZendeskAPI::Trackie.new
63
- subject.clear_changes
64
- subject[:key][:test] = true
65
- end
66
-
67
- it "should include changes from nested hash" do
68
- expect(subject.changes[:key][:test]).to be(true)
69
- end
70
-
71
- specify "subject should be changed" do
72
- expect(subject.changed?).to be(true)
73
- end
74
- end
75
-
76
- =begin TODO
77
- context "nested arrays" do
78
- before(:each) do
79
- subject[:key] = []
80
- subject.clear_changes
81
- subject[:key] << :test
82
- end
83
-
84
- it "should include changes from nested array" do
85
- expect(subject.changes[:key]).to eq([:test])
86
- end
87
-
88
- specify "subject should be changed" do
89
- expect(subject.changed?).to be(true)
90
- end
91
- end
92
- =end
93
-
94
- context "nested hashes in arrays" do
95
- before(:each) do
96
- subject[:key] = [ZendeskAPI::Trackie.new]
97
- subject.clear_changes
98
- subject[:key].first[:test] = true
99
- end
100
-
101
- it "should include changes from nested array" do
102
- expect(subject.changes[:key].first[:test]).to be(true)
103
- end
104
-
105
- specify "subject should be changed" do
106
- expect(subject.changed?).to be(true)
107
- end
108
-
109
- context "clearing" do
110
- before(:each) do
111
- subject.clear_changes
112
- end
113
-
114
- it "should not have any changes" do
115
- expect(subject.changes).to be_empty
116
- end
117
- end
118
- end
119
-
120
- describe "#size" do
121
- before do
122
- subject[:size] = 42
123
- end
124
-
125
- it "returns the value corresponding to the :size key" do
126
- expect(subject.size).to eq(42)
127
- end
128
- end
129
- end
Binary file
Binary file
@@ -1,3 +0,0 @@
1
- username: please.change
2
- password: me
3
- url: https://my.zendesk.com/api/v2
Binary file
@@ -1,22 +0,0 @@
1
- class ZendeskAPI::TestResource < ZendeskAPI::Resource
2
- def self.test(client)
3
- "hi"
4
- end
5
-
6
- class TestChild < ZendeskAPI::Resource
7
- end
8
- end
9
-
10
- class ZendeskAPI::BulkTestResource < ZendeskAPI::DataResource
11
- extend ZendeskAPI::CreateMany
12
- extend ZendeskAPI::DestroyMany
13
- extend ZendeskAPI::UpdateMany
14
- end
15
-
16
- class ZendeskAPI::NilResource < ZendeskAPI::Data; end
17
- class ZendeskAPI::NilDataResource < ZendeskAPI::DataResource; end
18
- class ZendeskAPI::SingularTestResource < ZendeskAPI::SingularResource; end
19
-
20
- # `client.greetings` should ignore this class, as it's not in the right namespace
21
- class Greeting; end
22
-
@@ -1,109 +0,0 @@
1
- module ZendeskAPI
2
- module Fixtures
3
- def user
4
- @user ||= find_or_create_user "end-user"
5
- end
6
-
7
- def current_user
8
- VCR.use_cassette('current_user') do
9
- @current_user ||= client.users.find(:id => 'me')
10
- end
11
- end
12
-
13
- def agent
14
- @agent ||= find_or_create_user "agent"
15
- end
16
-
17
- def find_or_create_user(role)
18
- VCR.use_cassette("valid_user_#{role}") do
19
- email = "zendesk-api-client-ruby-#{role}-#{client.config.username}"
20
-
21
- client.users.search(query: "email:#{email}").first ||
22
- client.users.create(
23
- :name => "Test Valid with role #{role}",
24
- :verified => true,
25
- :email => email,
26
- :role => role
27
- )
28
- end
29
- end
30
-
31
- def topic
32
- VCR.use_cassette('valid_topic') do
33
- @topic ||= forum.topics.first
34
- @topic ||= client.topics.create(
35
- :title => "Test Topic",
36
- :body => "This is the body of a topic.",
37
- :forum_id => forum.id
38
- )
39
- end
40
- end
41
-
42
- def forum
43
- VCR.use_cassette('valid_forum') do
44
- @forum ||= client.forums.detect {|f| f.topics.any? }
45
- @forum ||= client.forums.create(:name => "Test Forum", :access => "everybody")
46
- end
47
- end
48
-
49
- def category
50
- VCR.use_cassette('valid_category') do
51
- @category ||= client.categories.first
52
- @category ||= client.categories.create(:name => "Test Category")
53
- end
54
- end
55
-
56
- def ticket
57
- VCR.use_cassette('valid_ticket') do
58
- @ticket ||= client.tickets.detect {|t| t.status != 'closed'}
59
- @ticket ||= client.tickets.create(
60
- :subject => "Test Ticket",
61
- :description => "This is a test of the emergency alert system.",
62
- :requester_id => user.id
63
- )
64
- end
65
- end
66
-
67
- def suspended_ticket
68
- VCR.use_cassette('valid_suspended_ticket') do
69
- @suspended_ticket ||= client.suspended_tickets.first
70
- @suspended_ticket ||= begin
71
- client.anonymous_requests.create(
72
- :subject => "Test Ticket",
73
- :comment => { :value => "Help! I need somebody." },
74
- :requester => { :email => "zendesk-api-client-ruby-anonymous-#{client.config.username}", :name => 'Anonymous User' }
75
- )
76
- client.suspended_tickets(:reload => true).first
77
- end
78
- end
79
- end
80
-
81
- def group
82
- VCR.use_cassette('valid_group') do
83
- @ticket ||= client.groups.detect {|g| !g.default}
84
- @ticket ||= client.groups.create(:name => "Test Group")
85
- end
86
- end
87
-
88
- def organization
89
- VCR.use_cassette('valid_organization') do
90
- @organization ||= current_user.organization
91
- end
92
- end
93
-
94
- def brand
95
- VCR.use_cassette('valid_brand') do
96
- @brand ||= client.brands.detect do |brand|
97
- client.config.url.start_with?(brand.brand_url)
98
- end
99
- end
100
- end
101
-
102
- def dynamic_content_item
103
- VCR.use_cassette('valid_dynamic_content') do
104
- @item ||= client.dynamic_content.items.first
105
- @item ||= client.dynamic_content.items.create!(:name => 'Test Item', :content => 'Testing', :default_locale_id => 1)
106
- end
107
- end
108
- end
109
- end
@@ -1,4 +0,0 @@
1
- - Make an empty account (company name Z3N, email <something>@zendesk.com, so it can be filtered)
2
- - add credentials into spec/fixtures/credentials.yml
3
- - mark 1 ticket as solved, change end-users email to on your can receive, copy ticket url, login as end-user (do not just assume identity), rate it
4
- - create a new ticket and cc "zendesk-api-client-ruby-end-user-#{client.config.username}" (run tests once to create this user)
@@ -1,12 +0,0 @@
1
- require 'core/spec_helper'
2
-
3
- describe ZendeskAPI::Activity do
4
- before do
5
- VCR.use_cassette("ticket_activity") do
6
- ticket.comment = { :value => "test", :author_id => agent.id }
7
- ticket.save!
8
- end
9
- end
10
-
11
- it_should_be_readable :activities
12
- end
@@ -1,58 +0,0 @@
1
- require 'core/spec_helper'
2
-
3
- describe ZendeskAPI::AppInstallation do
4
- it "should work "do
5
- upload = VCR.use_cassette("app_installations_upload_create") do
6
- ZendeskAPI::App::Upload.new(client, :id => "spec/fixtures/sample_app.zip").tap(&:save!)
7
- end
8
-
9
- attributes = { :upload_id => upload.id, :name => "My App", :short_description => "Testing" }
10
-
11
- app = ZendeskAPI::App.new(client, attributes)
12
-
13
- VCR.use_cassette("app_installations_create") { app.save! }
14
-
15
- body = {}
16
-
17
- VCR.use_cassette("app_installations_create_job_status") do
18
- until %w{failed completed}.include?(body["status"])
19
- response = client.connection.get(app.response.headers["Location"])
20
- body = response.body
21
-
22
- sleep(3)
23
- end
24
- end
25
-
26
- if body["status"] == "failed"
27
- fail "Could not create app: #{body.inspect}"
28
- end
29
-
30
- app.id = body["app_id"]
31
-
32
- attributes = {
33
- :app_id => app.id,
34
- :settings => {
35
- :name => "My App"
36
- }
37
- }
38
-
39
- install = ZendeskAPI::AppInstallation.new(client, attributes)
40
-
41
- VCR.use_cassette("app_install_create") { install.save! }
42
-
43
- installations = client.app.installations
44
- VCR.use_cassette("app_install_fetch") { installations.fetch! }
45
- VCR.use_cassette("app_install_find") { client.app.installations.find!(:id => install.id) }
46
-
47
- expect(installations).to include(install)
48
-
49
- install.settings.name = "My New Name"
50
- VCR.use_cassette("app_install_update") { install.save! }
51
-
52
- expect(install.settings.title).to eq("My New Name")
53
-
54
- VCR.use_cassette("app_install_destroy") { install.destroy! }
55
-
56
- VCR.use_cassette("app_installations_destroy") { app.destroy! }
57
- end
58
- end
@@ -1,58 +0,0 @@
1
- require 'core/spec_helper'
2
-
3
- describe ZendeskAPI::App do
4
- it "should work" do
5
- upload = VCR.use_cassette("app_upload_create") do
6
- ZendeskAPI::App::Upload.new(client, :id => "spec/fixtures/sample_app.zip").tap(&:save!)
7
- end
8
-
9
- attributes = { :upload_id => upload.id, :name => "My App", :short_description => "Testing" }
10
-
11
- app = ZendeskAPI::App.new(client, attributes)
12
-
13
- VCR.use_cassette("app_create") { app.save! }
14
-
15
- body = check_job(app)
16
-
17
- app.id = body["app_id"]
18
- app.author_name = "Mr. Sprinkles"
19
- app.author_email = "sprinkle@example.com"
20
-
21
- VCR.use_cassette("app_save") { app.save! }
22
-
23
- expect(app.author_name).to eq("Mr. Sprinkles")
24
-
25
- VCR.use_cassette("app_find") { client.apps.find!(:id => app.id) }
26
- VCR.use_cassette("app_destroy") { app.destroy! }
27
- end
28
-
29
- it "should be able to handle the simplest creation api call" do
30
- VCR.use_cassette("app_simple_create") do
31
- app = ZendeskAPI::App.create!(client, { :name => "Testing App Creation", :upload => "spec/fixtures/sample_app.zip" })
32
-
33
- body = check_job(app)
34
-
35
- app.id = body["app_id"]
36
- VCR.use_cassette("app_destroy") { app.destroy! }
37
- end
38
- end
39
-
40
- def check_job(app)
41
- body = {}
42
-
43
- VCR.use_cassette("app_create_job_status") do
44
- until %w{failed completed}.include?(body["status"])
45
- response = client.connection.get(app.response.headers["Location"])
46
- body = response.body
47
-
48
- sleep(3)
49
- end
50
- end
51
-
52
- if body["status"] == "failed"
53
- fail "Could not create app: #{body.inspect}"
54
- end
55
-
56
- body
57
- end
58
- end
@@ -1,15 +0,0 @@
1
- require 'core/spec_helper'
2
-
3
- describe ZendeskAPI::Ticket::Audit do
4
- it_should_be_readable ticket, :audits
5
-
6
- describe ZendeskAPI::Ticket::Audit::Event, :vcr do
7
- it "should side-load events" do
8
- audit = ticket.audits(include: :users).first
9
- event = audit.events.first
10
-
11
- expect(event).to be_instance_of(ZendeskAPI::Ticket::Audit::Event)
12
- expect(event.author).to be_instance_of(ZendeskAPI::User)
13
- end
14
- end
15
- end
@@ -1,23 +0,0 @@
1
- require 'core/spec_helper'
2
-
3
- describe ZendeskAPI::Automation, :delete_after do
4
- def valid_attributes
5
- {
6
- :title => "my test automation",
7
- :conditions => {
8
- :all => [{ :field => "status", :operator => "is", :value => "open" }]
9
- },
10
- :actions => [{ :field => "status", :value => "solved" }]
11
- }
12
- end
13
-
14
- it_should_be_readable :automations
15
- it_should_be_readable :automations, :active
16
-
17
- it_should_be_creatable
18
- it_should_be_updatable :conditions, {
19
- "any" => [],
20
- "all" => [{ "field" => "status", "operator" => "is", "value" => "pending" }]
21
- }
22
- it_should_be_deletable
23
- end