desk 0.3.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.mkd +305 -106
- data/TRANSITION.mkd +133 -0
- data/desk.gemspec +1 -1
- data/lib/desk.rb +1 -1
- data/lib/desk/api.rb +5 -1
- data/lib/desk/client.rb +184 -10
- data/lib/desk/client/article.rb +4 -83
- data/lib/desk/client/brand.rb +11 -0
- data/lib/desk/client/case.rb +59 -42
- data/lib/desk/client/company.rb +11 -0
- data/lib/desk/client/custom_field.rb +10 -0
- data/lib/desk/client/customer.rb +26 -124
- data/lib/desk/client/facebook_user.rb +11 -0
- data/lib/desk/client/filter.rb +11 -0
- data/lib/desk/client/group.rb +3 -29
- data/lib/desk/client/insight.rb +17 -0
- data/lib/desk/client/integration_url.rb +11 -0
- data/lib/desk/client/job.rb +11 -0
- data/lib/desk/client/label.rb +11 -0
- data/lib/desk/client/macro.rb +3 -133
- data/lib/desk/client/mailbox.rb +26 -0
- data/lib/desk/client/rule.rb +14 -0
- data/lib/desk/client/site_setting.rb +11 -0
- data/lib/desk/client/system_message.rb +16 -0
- data/lib/desk/client/topic.rb +4 -81
- data/lib/desk/client/twitter_account.rb +11 -0
- data/lib/desk/client/twitter_user.rb +11 -0
- data/lib/desk/client/user.rb +3 -30
- data/lib/desk/configuration.rb +1 -1
- data/lib/desk/connection.rb +2 -1
- data/lib/desk/deash.rb +100 -0
- data/lib/desk/request.rb +33 -20
- data/lib/desk/version.rb +1 -1
- data/lib/faraday/request/oauth.rb +6 -3
- data/lib/faraday/response/deashify.rb +23 -0
- data/spec/desk/client/article_spec.rb +62 -117
- data/spec/desk/client/brand_spec.rb +18 -0
- data/spec/desk/client/case_spec.rb +182 -66
- data/spec/desk/client/companies_spec.rb +26 -0
- data/spec/desk/client/custom_fields_spec.rb +18 -0
- data/spec/desk/client/customer_spec.rb +16 -145
- data/spec/desk/client/facebook_users_spec.rb +17 -0
- data/spec/desk/client/filter_spec.rb +28 -0
- data/spec/desk/client/group_spec.rb +32 -49
- data/spec/desk/client/inbound_mailboxes_spec.rb +70 -0
- data/spec/desk/client/integration_url_spec.rb +28 -0
- data/spec/desk/client/job_spec.rb +32 -0
- data/spec/desk/client/label_spec.rb +31 -0
- data/spec/desk/client/macro_spec.rb +22 -185
- data/spec/desk/client/rule_spec.rb +18 -0
- data/spec/desk/client/site_setting_spec.rb +18 -0
- data/spec/desk/client/system_message_spec.rb +42 -0
- data/spec/desk/client/topic_spec.rb +31 -112
- data/spec/desk/client/twitter_account_spec.rb +32 -0
- data/spec/desk/client/twitter_user_spec.rb +27 -0
- data/spec/desk/client/user_spec.rb +19 -42
- data/spec/desk_spec.rb +2 -2
- data/spec/faraday/response_spec.rb +3 -6
- data/spec/fixtures/article +50 -0
- data/spec/fixtures/article_create +50 -0
- data/spec/fixtures/article_translation +29 -0
- data/spec/fixtures/article_translation_create +29 -0
- data/spec/fixtures/article_translation_update +29 -0
- data/spec/fixtures/article_translations +81 -0
- data/spec/fixtures/article_update +50 -0
- data/spec/fixtures/articles +123 -0
- data/spec/fixtures/articles_search +124 -0
- data/spec/fixtures/brand +11 -0
- data/spec/fixtures/brands +45 -0
- data/spec/fixtures/case +44 -0
- data/spec/fixtures/case_attachment +19 -0
- data/spec/fixtures/case_attachment_create +19 -0
- data/spec/fixtures/case_attachments +61 -0
- data/spec/fixtures/case_create +51 -0
- data/spec/fixtures/case_message +26 -0
- data/spec/fixtures/case_note +21 -0
- data/spec/fixtures/case_note_create +26 -0
- data/spec/fixtures/case_notes +65 -0
- data/spec/fixtures/case_replies +75 -0
- data/spec/fixtures/case_reply +26 -0
- data/spec/fixtures/case_reply_create +26 -0
- data/spec/fixtures/case_reply_update +26 -0
- data/spec/fixtures/case_update +49 -0
- data/spec/fixtures/cases +111 -0
- data/spec/fixtures/cases_search +113 -0
- data/spec/fixtures/companies +75 -0
- data/spec/fixtures/companies_search +76 -0
- data/spec/fixtures/company +26 -0
- data/spec/fixtures/company_create +26 -0
- data/spec/fixtures/company_search +76 -0
- data/spec/fixtures/company_update +27 -0
- data/spec/fixtures/custom_field +15 -0
- data/spec/fixtures/custom_fields +58 -0
- data/spec/fixtures/customer +60 -0
- data/spec/fixtures/customer_create +54 -0
- data/spec/fixtures/customer_update +60 -0
- data/spec/fixtures/customers +143 -0
- data/spec/fixtures/customers_search +143 -0
- data/spec/fixtures/facebook_user +16 -0
- data/spec/fixtures/facebook_users +55 -0
- data/spec/fixtures/filter +16 -0
- data/spec/fixtures/filter_cases +111 -0
- data/spec/fixtures/filters +55 -0
- data/spec/fixtures/group +9 -0
- data/spec/fixtures/group_filters +55 -0
- data/spec/fixtures/group_users +63 -0
- data/spec/fixtures/groups +42 -0
- data/spec/fixtures/inbound_mailbox +32 -0
- data/spec/fixtures/inbound_mailboxes +87 -0
- data/spec/fixtures/integration_url +15 -0
- data/spec/fixtures/integration_url_create +15 -0
- data/spec/fixtures/integration_url_update +15 -0
- data/spec/fixtures/integration_urls +54 -0
- data/spec/fixtures/job +17 -0
- data/spec/fixtures/job_create +17 -0
- data/spec/fixtures/jobs +57 -0
- data/spec/fixtures/label +17 -0
- data/spec/fixtures/label_create +17 -0
- data/spec/fixtures/label_update +17 -0
- data/spec/fixtures/labels +57 -0
- data/spec/fixtures/macro +20 -0
- data/spec/fixtures/macro_action +17 -0
- data/spec/fixtures/macro_action_update +17 -0
- data/spec/fixtures/macro_actions +57 -0
- data/spec/fixtures/macro_create +20 -0
- data/spec/fixtures/macro_update +20 -0
- data/spec/fixtures/macros +63 -0
- data/spec/fixtures/rule +13 -0
- data/spec/fixtures/rules +49 -0
- data/spec/fixtures/site_setting +10 -0
- data/spec/fixtures/site_settings +43 -0
- data/spec/fixtures/system_message +4 -0
- data/spec/fixtures/topic +23 -0
- data/spec/fixtures/topic_create +23 -0
- data/spec/fixtures/topic_translation +12 -0
- data/spec/fixtures/topic_translation_create +12 -0
- data/spec/fixtures/topic_translation_update +12 -0
- data/spec/fixtures/topic_translations +47 -0
- data/spec/fixtures/topic_update +23 -0
- data/spec/fixtures/topics +69 -0
- data/spec/fixtures/twitter_account +14 -0
- data/spec/fixtures/twitter_account_tweet +20 -0
- data/spec/fixtures/twitter_account_tweet_create +20 -0
- data/spec/fixtures/twitter_account_tweets +63 -0
- data/spec/fixtures/twitter_accounts +51 -0
- data/spec/fixtures/twitter_user +18 -0
- data/spec/fixtures/twitter_user_create +18 -0
- data/spec/fixtures/twitter_users +59 -0
- data/spec/fixtures/user +20 -0
- data/spec/fixtures/user_preference +18 -0
- data/spec/fixtures/user_preference_update +14 -0
- data/spec/fixtures/user_preferences +223 -0
- data/spec/fixtures/users +63 -0
- data/spec/helper.rb +12 -0
- data/spec/shared_context.rb +16 -0
- data/spec/shared_examples.rb +312 -0
- metadata +247 -181
- data/lib/desk/client/interaction.rb +0 -75
- data/spec/desk/client/interaction_spec.rb +0 -191
- data/spec/fixtures/article.json +0 -50
- data/spec/fixtures/article_create.json +0 -54
- data/spec/fixtures/article_destroy.json +0 -3
- data/spec/fixtures/article_update.json +0 -54
- data/spec/fixtures/articles.json +0 -58
- data/spec/fixtures/case.json +0 -59
- data/spec/fixtures/case_update.json +0 -59
- data/spec/fixtures/cases.json +0 -182
- data/spec/fixtures/customer.json +0 -58
- data/spec/fixtures/customer_create.json +0 -56
- data/spec/fixtures/customer_create_email.json +0 -15
- data/spec/fixtures/customer_update.json +0 -47
- data/spec/fixtures/customer_update_email.json +0 -15
- data/spec/fixtures/customers.json +0 -98
- data/spec/fixtures/group.json +0 -8
- data/spec/fixtures/groups.json +0 -23
- data/spec/fixtures/interaction_create.json +0 -126
- data/spec/fixtures/interactions.json +0 -139
- data/spec/fixtures/macro.json +0 -8
- data/spec/fixtures/macro_action.json +0 -9
- data/spec/fixtures/macro_action_update.json +0 -12
- data/spec/fixtures/macro_actions.json +0 -69
- data/spec/fixtures/macro_create.json +0 -13
- data/spec/fixtures/macro_destroy.json +0 -3
- data/spec/fixtures/macro_update.json +0 -13
- data/spec/fixtures/macros.json +0 -24
- data/spec/fixtures/topic.json +0 -9
- data/spec/fixtures/topic_create.json +0 -14
- data/spec/fixtures/topic_destroy.json +0 -3
- data/spec/fixtures/topic_update.json +0 -14
- data/spec/fixtures/topics.json +0 -35
- data/spec/fixtures/user.json +0 -15
- data/spec/fixtures/users.json +0 -24
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Desk::Client do
|
4
|
+
context "Company" do
|
5
|
+
|
6
|
+
let(:endpoint) { "company" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "name" }
|
9
|
+
let(:check_value) { "Acme Inc" }
|
10
|
+
|
11
|
+
include_context "basic configuration"
|
12
|
+
|
13
|
+
it_behaves_like "a list endpoint"
|
14
|
+
|
15
|
+
it_behaves_like "a show endpoint"
|
16
|
+
|
17
|
+
it_behaves_like "a create endpoint", { :name => "Acme Inc" }
|
18
|
+
|
19
|
+
it_behaves_like "an update endpoint", { :name => "Acme Enterprises" } do
|
20
|
+
let(:check_value) { "Acme Enterprises" }
|
21
|
+
end
|
22
|
+
|
23
|
+
it_behaves_like "a search endpoint", { :q => "acme" }
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Desk::Client do
|
4
|
+
context "Custom Fields" do
|
5
|
+
|
6
|
+
let(:endpoint) { "custom_field" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "name" }
|
9
|
+
let(:check_value) { "frequent_buyer" }
|
10
|
+
|
11
|
+
include_context "basic configuration"
|
12
|
+
|
13
|
+
it_behaves_like "a list endpoint"
|
14
|
+
|
15
|
+
it_behaves_like "a show endpoint"
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -1,158 +1,29 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe Desk::Client do
|
4
|
-
|
5
|
-
context ".new(:format => '#{format}')" do
|
6
|
-
before do
|
7
|
-
@client = Desk::Client.new(:subdomain => "example", :format => format, :consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT', :oauth_token_secret => 'OS')
|
8
|
-
end
|
4
|
+
context "Customer" do
|
9
5
|
|
10
|
-
|
6
|
+
let(:endpoint) { "customer" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "first_name" }
|
9
|
+
let(:check_value) { "John" }
|
11
10
|
|
12
|
-
|
11
|
+
include_context "basic configuration"
|
13
12
|
|
14
|
-
|
15
|
-
stub_get("customers.#{format}").
|
16
|
-
to_return(:body => fixture("customers.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
|
17
|
-
end
|
13
|
+
it_behaves_like "a list endpoint"
|
18
14
|
|
19
|
-
|
20
|
-
@client.customers
|
21
|
-
a_get("customers.#{format}").
|
22
|
-
should have_been_made
|
23
|
-
end
|
15
|
+
it_behaves_like "a show endpoint"
|
24
16
|
|
25
|
-
|
26
|
-
|
17
|
+
it_behaves_like "a create endpoint", {
|
18
|
+
:first_name => "John",
|
19
|
+
:last_name => "Doe"
|
20
|
+
}
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe ".customer" do
|
36
|
-
|
37
|
-
context "lookup" do
|
38
|
-
|
39
|
-
before do
|
40
|
-
stub_get("customers/1.#{format}").
|
41
|
-
to_return(:body => fixture("customer.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should get the correct resource" do
|
45
|
-
@client.customer(1)
|
46
|
-
a_get("customers/1.#{format}").
|
47
|
-
should have_been_made
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should return up to 100 customers worth of extended information" do
|
51
|
-
customer = @client.customer(1)
|
52
|
-
|
53
|
-
customer.first_name.should == "Jeremy"
|
54
|
-
customer.addresses.first.address.city.should == "Commack"
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe ".create_customer" do
|
61
|
-
|
62
|
-
context "create" do
|
63
|
-
|
64
|
-
before do
|
65
|
-
stub_post("customers.#{format}").
|
66
|
-
to_return(:body => fixture("customer_create.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should get the correct resource" do
|
70
|
-
@client.create_customer(:name => "Chris Warren", :twitter => "cdwarren")
|
71
|
-
a_post("customers.#{format}").
|
72
|
-
should have_been_made
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should return the information about this user" do
|
76
|
-
customer = @client.create_customer(:name => "John Smith", :twitter => "cdwarren")
|
77
|
-
|
78
|
-
customer.first_name.should == "John"
|
79
|
-
customer.phones.first.phone.phone.should == "123-456-7890"
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe ".update_customer" do
|
86
|
-
|
87
|
-
context "update" do
|
88
|
-
|
89
|
-
before do
|
90
|
-
stub_put("customers/1.#{format}").
|
91
|
-
to_return(:body => fixture("customer_update.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
|
92
|
-
end
|
93
|
-
|
94
|
-
it "should get the correct resource" do
|
95
|
-
@client.update_customer(1, :name => "Chris Warren", :twitter => "cdwarren")
|
96
|
-
a_put("customers/1.#{format}").
|
97
|
-
should have_been_made
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should return the information about this user" do
|
101
|
-
customer = @client.update_customer(1, :name => "Joslyn Esser")
|
102
|
-
|
103
|
-
customer.first_name.should == "Joslyn"
|
104
|
-
end
|
105
|
-
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe ".create_customer_email" do
|
110
|
-
|
111
|
-
context "create" do
|
112
|
-
|
113
|
-
before do
|
114
|
-
stub_post("customers/1/emails.#{format}").
|
115
|
-
to_return(:body => fixture("customer_create_email.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
|
116
|
-
end
|
117
|
-
|
118
|
-
it "should get the correct resource" do
|
119
|
-
@client.create_customer_email(1, :email => "foo@example.com")
|
120
|
-
a_post("customers/1/emails.#{format}").
|
121
|
-
should have_been_made
|
122
|
-
end
|
123
|
-
|
124
|
-
it "should return the information about this user" do
|
125
|
-
email = @client.create_customer_email(1, :email => "api@example.com")
|
126
|
-
|
127
|
-
email.email.should == "api@example.com"
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe ".update_customer_email" do
|
134
|
-
|
135
|
-
context "update" do
|
136
|
-
|
137
|
-
before do
|
138
|
-
stub_put("customers/1/emails/2.#{format}").
|
139
|
-
to_return(:body => fixture("customer_update_email.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
|
140
|
-
end
|
141
|
-
|
142
|
-
it "should get the correct resource" do
|
143
|
-
@client.update_customer_email(1, 2, :email => "foo@example.com")
|
144
|
-
a_put("customers/1/emails/2.#{format}").
|
145
|
-
should have_been_made
|
146
|
-
end
|
147
|
-
|
148
|
-
it "should return the information about this user" do
|
149
|
-
email = @client.update_customer_email(1, 2, :email => "api@example.com")
|
22
|
+
it_behaves_like "an update endpoint", { :first_name => "Johnny" } do
|
23
|
+
let(:check_value) { "Johnny" }
|
24
|
+
end
|
150
25
|
|
151
|
-
|
152
|
-
end
|
26
|
+
it_behaves_like "a search endpoint", { :since_created_at => 1385074763 }
|
153
27
|
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
28
|
end
|
158
29
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Desk::Client do
|
4
|
+
context "Facebook User" do
|
5
|
+
|
6
|
+
let(:endpoint) { "facebook_user" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "profile_url" }
|
9
|
+
let(:check_value) { "https://www.facebook.com/zuck" }
|
10
|
+
|
11
|
+
include_context "basic configuration"
|
12
|
+
|
13
|
+
it_behaves_like "a list endpoint"
|
14
|
+
|
15
|
+
it_behaves_like "a show endpoint"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Desk::Client do
|
4
|
+
context "Filter" do
|
5
|
+
|
6
|
+
let(:endpoint) { "filter" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "name" }
|
9
|
+
let(:check_value) { "My Active Cases" }
|
10
|
+
|
11
|
+
include_context "basic configuration"
|
12
|
+
|
13
|
+
it_behaves_like "a list endpoint"
|
14
|
+
|
15
|
+
it_behaves_like "a show endpoint"
|
16
|
+
|
17
|
+
context "Case" do
|
18
|
+
|
19
|
+
let(:sub_endpoint) { "case" }
|
20
|
+
let(:sub_id) { 1 }
|
21
|
+
let(:check_key) { "subject" }
|
22
|
+
let(:check_value) { "Welcome" }
|
23
|
+
|
24
|
+
it_behaves_like "a sub list endpoint", false
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,54 +1,37 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe Desk::Client do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
stub_get("groups/1.#{format}").
|
36
|
-
to_return(:body => fixture("group.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should get the correct resource" do
|
40
|
-
@client.group(1)
|
41
|
-
a_get("groups/1.#{format}").
|
42
|
-
should have_been_made
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should return up to 100 cases worth of extended information" do
|
46
|
-
group = @client.group(1)
|
47
|
-
group.id.should == 1
|
48
|
-
group.name.should == "Sales"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
4
|
+
context "Group" do
|
5
|
+
|
6
|
+
let(:endpoint) { "group" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "name" }
|
9
|
+
let(:check_value) { "Support Ninjas" }
|
10
|
+
|
11
|
+
include_context "basic configuration"
|
12
|
+
|
13
|
+
it_behaves_like "a list endpoint"
|
14
|
+
|
15
|
+
it_behaves_like "a show endpoint"
|
16
|
+
|
17
|
+
context "Filter" do
|
18
|
+
|
19
|
+
let(:sub_endpoint) { "filter" }
|
20
|
+
let(:sub_id) { 1 }
|
21
|
+
let(:check_value) { "My Active Cases" }
|
22
|
+
|
23
|
+
it_behaves_like "a sub list endpoint", false
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
context "User" do
|
28
|
+
|
29
|
+
let(:sub_endpoint) { "user" }
|
30
|
+
let(:sub_id) { 1 }
|
31
|
+
let(:check_value) { "John Doe" }
|
32
|
+
|
33
|
+
it_behaves_like "a sub list endpoint", false
|
34
|
+
|
52
35
|
end
|
53
36
|
end
|
54
|
-
end
|
37
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Desk::Client do
|
4
|
+
context "Inbound Mailbox" do
|
5
|
+
|
6
|
+
let(:endpoint) { "inbound_mailbox" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "name" }
|
9
|
+
let(:check_value) { "Support Mailbox" }
|
10
|
+
|
11
|
+
include_context "basic configuration"
|
12
|
+
|
13
|
+
context "list all inbound mailboxes" do
|
14
|
+
|
15
|
+
include_context "plural endpoint"
|
16
|
+
|
17
|
+
subject { client.send("list_#{endpoints}") }
|
18
|
+
|
19
|
+
before do
|
20
|
+
stub_get("mailboxes/inbound").to_return(:body => fixture(endpoints))
|
21
|
+
end
|
22
|
+
|
23
|
+
it "gets the correct resource" do
|
24
|
+
subject
|
25
|
+
expect(a_get("mailboxes/inbound")).to have_been_made
|
26
|
+
end
|
27
|
+
|
28
|
+
it { expect(subject).to be_a Hashie::Deash }
|
29
|
+
|
30
|
+
it "has valid entries" do
|
31
|
+
expect(subject.first.id).to eq(id)
|
32
|
+
expect(subject.first.send(check_key)).to eq(check_value)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "allows raw access" do
|
36
|
+
expect(subject.raw.first).to be_a Array
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
context "retrieve a single inbound mailbox" do
|
42
|
+
|
43
|
+
include_context "plural endpoint"
|
44
|
+
|
45
|
+
subject { client.send("show_#{endpoint}", id) }
|
46
|
+
|
47
|
+
before do
|
48
|
+
stub_get("mailboxes/inbound/#{id}").to_return(:body => fixture(endpoint))
|
49
|
+
end
|
50
|
+
|
51
|
+
it "gets the correct resource" do
|
52
|
+
subject
|
53
|
+
expect(a_get("mailboxes/inbound/#{id}")).to have_been_made
|
54
|
+
end
|
55
|
+
|
56
|
+
it { expect(subject).to be_a Hashie::Deash }
|
57
|
+
|
58
|
+
it "has a valid entry" do
|
59
|
+
expect(subject.id).to eq(id)
|
60
|
+
expect(subject.send(check_key)).to eq(check_value)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "allows raw access" do
|
64
|
+
expect(subject.raw).to be_a Hashie::Deash
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Desk::Client do
|
4
|
+
context "Integration URL" do
|
5
|
+
|
6
|
+
let(:endpoint) { "integration_url" }
|
7
|
+
let(:id) { 1 }
|
8
|
+
let(:check_key) { "name" }
|
9
|
+
let(:check_value) { "Sample URL" }
|
10
|
+
|
11
|
+
include_context "basic configuration"
|
12
|
+
|
13
|
+
it_behaves_like "a list endpoint"
|
14
|
+
|
15
|
+
it_behaves_like "a show endpoint"
|
16
|
+
|
17
|
+
it_behaves_like "a create endpoint", {
|
18
|
+
:name => "Sample URL",
|
19
|
+
:description => "A sample Integration URL",
|
20
|
+
:markup => "http://www.example.com"
|
21
|
+
}
|
22
|
+
|
23
|
+
it_behaves_like "an update endpoint", { :enabled => false }
|
24
|
+
|
25
|
+
it_behaves_like "a delete endpoint"
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|