desk_api 0.6.0 → 0.6.1
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 +4 -4
- data/LICENSE.txt +27 -0
- data/README.md +97 -61
- data/lib/desk.rb +29 -1
- data/lib/desk_api.rb +57 -5
- data/lib/desk_api/client.rb +104 -47
- data/lib/desk_api/configuration.rb +201 -108
- data/lib/desk_api/default.rb +109 -52
- data/lib/desk_api/error.rb +90 -40
- data/lib/desk_api/error/bad_gateway.rb +29 -1
- data/lib/desk_api/error/bad_request.rb +29 -1
- data/lib/desk_api/error/client_error.rb +31 -2
- data/lib/desk_api/error/configuration_error.rb +29 -1
- data/lib/desk_api/error/conflict.rb +29 -1
- data/lib/desk_api/error/follow_redirect_error.rb +42 -0
- data/lib/desk_api/error/forbidden.rb +29 -1
- data/lib/desk_api/error/gateway_timeout.rb +29 -1
- data/lib/desk_api/error/internal_server_error.rb +29 -1
- data/lib/desk_api/error/method_not_allowed.rb +29 -1
- data/lib/desk_api/error/not_acceptable.rb +29 -1
- data/lib/desk_api/error/not_found.rb +29 -1
- data/lib/desk_api/error/parser_error.rb +29 -1
- data/lib/desk_api/error/server_error.rb +29 -1
- data/lib/desk_api/error/service_unavailable.rb +29 -1
- data/lib/desk_api/error/too_many_requests.rb +29 -1
- data/lib/desk_api/error/unauthorized.rb +29 -1
- data/lib/desk_api/error/unprocessable_entity.rb +29 -1
- data/lib/desk_api/error/unsupported_media_type.rb +29 -1
- data/lib/desk_api/rate_limit.rb +63 -21
- data/lib/desk_api/request/encode_json.rb +49 -7
- data/lib/desk_api/request/oauth.rb +62 -14
- data/lib/desk_api/request/retry.rb +108 -34
- data/lib/desk_api/resource.rb +402 -192
- data/lib/desk_api/response/follow_redirects.rb +99 -0
- data/lib/desk_api/response/parse_dates.rb +63 -21
- data/lib/desk_api/response/parse_json.rb +47 -5
- data/lib/desk_api/response/raise_error.rb +51 -10
- data/lib/desk_api/version.rb +30 -2
- data/spec/cassettes/DeskApi_Resource/_update/can_handle_action_params.yml +110 -104
- data/spec/cassettes/DeskApi_Resource/_update/can_handle_links.yml +426 -0
- data/spec/desk_api/client_spec.rb +28 -0
- data/spec/desk_api/configuration_spec.rb +28 -0
- data/spec/desk_api/default_spec.rb +28 -0
- data/spec/desk_api/error_spec.rb +29 -1
- data/spec/desk_api/rate_limit_spec.rb +28 -0
- data/spec/desk_api/request/encode_json_spec.rb +28 -0
- data/spec/desk_api/request/oauth_spec.rb +28 -0
- data/spec/desk_api/request/retry_spec.rb +29 -1
- data/spec/desk_api/resource_spec.rb +49 -12
- data/spec/desk_api/response/follow_redirects_spec.rb +95 -0
- data/spec/desk_api/response/parse_dates_spec.rb +28 -0
- data/spec/desk_api/response/parse_json_spec.rb +56 -9
- data/spec/desk_api/response/raise_error_spec.rb +28 -0
- data/spec/desk_api_spec.rb +28 -0
- data/spec/spec_helper.rb +28 -0
- metadata +84 -24
- data/LICENSE +0 -7
@@ -1,3 +1,31 @@
|
|
1
|
+
# Copyright (c) 2013-2014, Salesforce.com, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
# are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# * Redistributions of source code must retain the above copyright notice, this
|
8
|
+
# list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# * Neither the name of Salesforce.com nor the names of its contributors may be
|
15
|
+
# used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
|
1
29
|
require 'faraday'
|
2
30
|
|
3
31
|
require 'desk_api/default'
|
@@ -7,141 +35,206 @@ require 'desk_api/request/encode_json'
|
|
7
35
|
require 'desk_api/response/parse_dates'
|
8
36
|
require 'desk_api/response/parse_json'
|
9
37
|
require 'desk_api/response/raise_error'
|
38
|
+
require 'desk_api/response/follow_redirects'
|
10
39
|
require 'desk_api/error/configuration_error'
|
11
40
|
require 'desk_api/error/client_error'
|
12
41
|
require 'desk_api/error/server_error'
|
13
42
|
|
14
|
-
module DeskApi
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
]
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Faraday::Response.register_middleware desk_parse_dates: DeskApi::Response::ParseDates
|
41
|
-
Faraday::Response.register_middleware desk_parse_json: DeskApi::Response::ParseJson
|
42
|
-
Faraday::Response.register_middleware desk_raise_error: DeskApi::Response::RaiseError
|
43
|
-
else
|
44
|
-
Faraday.register_middleware :request, desk_encode_json: DeskApi::Request::EncodeJson
|
45
|
-
Faraday.register_middleware :request, desk_oauth: DeskApi::Request::OAuth
|
46
|
-
Faraday.register_middleware :request, desk_retry: DeskApi::Request::Retry
|
47
|
-
Faraday.register_middleware :response, desk_parse_dates: DeskApi::Response::ParseDates
|
48
|
-
Faraday.register_middleware :response, desk_parse_json: DeskApi::Response::ParseJson
|
49
|
-
Faraday.register_middleware :response, desk_raise_error: DeskApi::Response::RaiseError
|
43
|
+
module DeskApi
|
44
|
+
# {DeskApi::Configuration} allows to configure a {DeskApi::Client}.
|
45
|
+
# It exposes all available configuration options to the client and
|
46
|
+
# makes sure secrets are only readable by the client.
|
47
|
+
#
|
48
|
+
# @author Thomas Stachl <tstachl@salesforce.com>
|
49
|
+
# @copyright Copyright (c) 2013-2014 Salesforce.com
|
50
|
+
# @license BSD 3-Clause License
|
51
|
+
module Configuration
|
52
|
+
extend Forwardable
|
53
|
+
attr_writer :consumer_secret, :token, :token_secret, :password
|
54
|
+
attr_accessor :consumer_key, :username, :endpoint, :subdomain, \
|
55
|
+
:connection_options, :middleware
|
56
|
+
def_delegator :options, :hash
|
57
|
+
|
58
|
+
class << self
|
59
|
+
# Returns an array of possible configuration options.
|
60
|
+
#
|
61
|
+
# @return [Array]
|
62
|
+
def keys
|
63
|
+
@keys ||= [
|
64
|
+
:consumer_key, :consumer_secret, :token, :token_secret,
|
65
|
+
:username, :password,
|
66
|
+
:subdomain, :endpoint,
|
67
|
+
:connection_options
|
68
|
+
]
|
50
69
|
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# if subdomain is set make sure endpoint is correct
|
55
|
-
def endpoint
|
56
|
-
@endpoint ||= "https://#{@subdomain}.desk.com"
|
57
|
-
end
|
58
70
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
71
|
+
# Allows to register middleware for Faraday v0.8 and v0.9
|
72
|
+
#
|
73
|
+
# @param type [Symbol] either :request or :response
|
74
|
+
# @param sym [Symbol] the symbol to register the middleware as
|
75
|
+
# @param cls [Symbol] the class name of the middleware
|
76
|
+
def register_middleware(type, sym, cls)
|
77
|
+
cls = DeskApi.const_get(type.capitalize).const_get(cls)
|
78
|
+
if Faraday.respond_to?(:register_middleware)
|
79
|
+
Faraday.register_middleware type, sym => cls
|
80
|
+
else
|
81
|
+
Faraday.const_get(type.capitalize).register_middleware sym => cls
|
82
|
+
end
|
83
|
+
end
|
70
84
|
|
71
|
-
|
85
|
+
# Registers the middleware when the module is included.
|
86
|
+
def included(_base)
|
87
|
+
register_middleware :request, :desk_encode_json, :EncodeJson
|
88
|
+
register_middleware :request, :desk_oauth, :OAuth
|
89
|
+
register_middleware :request, :desk_retry, :Retry
|
90
|
+
register_middleware :response, :desk_parse_dates, :ParseDates
|
91
|
+
register_middleware :response, :desk_parse_json, :ParseJson
|
92
|
+
register_middleware :response, :desk_raise_error, :RaiseError
|
93
|
+
register_middleware :response, :desk_follow_redirects, :FollowRedirects
|
94
|
+
end
|
72
95
|
end
|
73
|
-
end
|
74
96
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
97
|
+
# Builds the endpoint using the subdomain if the endpoint isn't set
|
98
|
+
#
|
99
|
+
# @return [String]
|
100
|
+
def endpoint
|
101
|
+
@endpoint ||= "https://#{@subdomain}.desk.com"
|
102
|
+
end
|
81
103
|
|
82
|
-
|
83
|
-
|
84
|
-
|
104
|
+
# Returns the middleware proc to be used by Faraday
|
105
|
+
#
|
106
|
+
# @return [Proc]
|
107
|
+
def middleware
|
108
|
+
@middleware ||= proc do |builder|
|
109
|
+
builder.request(:desk_encode_json)
|
110
|
+
builder.request(*authorize_request)
|
111
|
+
builder.request(:desk_retry)
|
112
|
+
|
113
|
+
builder.response(:desk_parse_dates)
|
114
|
+
builder.response(:desk_follow_redirects)
|
115
|
+
builder.response(:desk_raise_error, DeskApi::Error::ClientError)
|
116
|
+
builder.response(:desk_raise_error, DeskApi::Error::ServerError)
|
117
|
+
builder.response(:desk_parse_json)
|
118
|
+
|
119
|
+
builder.adapter(Faraday.default_adapter)
|
120
|
+
end
|
85
121
|
end
|
86
|
-
self
|
87
|
-
end
|
88
|
-
alias setup reset!
|
89
122
|
|
90
|
-
|
91
|
-
|
92
|
-
|
123
|
+
# Allows to configure the client by yielding self.
|
124
|
+
#
|
125
|
+
# @yield [DeskApi::Client]
|
126
|
+
# @return [DeskApi::Client]
|
127
|
+
def configure
|
128
|
+
yield self
|
129
|
+
validate_credentials!
|
130
|
+
validate_endpoint!
|
131
|
+
self
|
132
|
+
end
|
93
133
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
134
|
+
# Resets the client to the default settings.
|
135
|
+
#
|
136
|
+
# @return [DeskApi::Client]
|
137
|
+
def reset!
|
138
|
+
DeskApi::Configuration.keys.each do |key|
|
139
|
+
send("#{key}=", DeskApi::Default.options[key])
|
140
|
+
end
|
141
|
+
self
|
142
|
+
end
|
143
|
+
alias_method :setup, :reset!
|
144
|
+
|
145
|
+
# Returns true if either all oauth values or all basic auth
|
146
|
+
# values are set.
|
147
|
+
#
|
148
|
+
# @return [Boolean]
|
149
|
+
def credentials?
|
150
|
+
oauth.values.all? || basic_auth.values.all?
|
151
|
+
end
|
99
152
|
|
100
|
-
|
101
|
-
{
|
102
|
-
consumer_key: @consumer_key,
|
103
|
-
consumer_secret: @consumer_secret,
|
104
|
-
token: @token,
|
105
|
-
token_secret: @token_secret
|
106
|
-
}
|
107
|
-
end
|
153
|
+
private
|
108
154
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
155
|
+
# Returns a hash of current configuration options.
|
156
|
+
#
|
157
|
+
# @return [Hash]
|
158
|
+
def options
|
159
|
+
Hash[
|
160
|
+
DeskApi::Configuration.keys.map do |key|
|
161
|
+
[key, instance_variable_get(:"@#{key}")]
|
162
|
+
end
|
163
|
+
]
|
164
|
+
end
|
115
165
|
|
116
|
-
|
117
|
-
|
118
|
-
|
166
|
+
# Returns the oauth configuration options.
|
167
|
+
#
|
168
|
+
# @return [Hash]
|
169
|
+
def oauth
|
170
|
+
{
|
171
|
+
consumer_key: @consumer_key,
|
172
|
+
consumer_secret: @consumer_secret,
|
173
|
+
token: @token,
|
174
|
+
token_secret: @token_secret
|
175
|
+
}
|
119
176
|
end
|
120
177
|
|
121
|
-
|
122
|
-
|
123
|
-
|
178
|
+
# Returns the basic auth configuration options.
|
179
|
+
#
|
180
|
+
# @return [Hash]
|
181
|
+
def basic_auth
|
182
|
+
{
|
183
|
+
username: @username,
|
184
|
+
password: @password
|
185
|
+
}
|
186
|
+
end
|
124
187
|
|
125
|
-
|
126
|
-
|
127
|
-
|
188
|
+
# Returns an array to authorize a request in the
|
189
|
+
# middleware proc.
|
190
|
+
#
|
191
|
+
# @return [Array]
|
192
|
+
def authorize_request
|
193
|
+
if basic_auth.values.all?
|
194
|
+
[:basic_auth, @username, @password]
|
195
|
+
else
|
196
|
+
[:desk_oauth, oauth]
|
128
197
|
end
|
129
198
|
end
|
130
199
|
|
131
|
-
if
|
132
|
-
|
133
|
-
|
200
|
+
# Raises an error if credentials are not set or of
|
201
|
+
# the wrong type.
|
202
|
+
#
|
203
|
+
# @raise [DeskApi::Error::ConfigurationError]
|
204
|
+
def validate_credentials!
|
205
|
+
fail(
|
206
|
+
DeskApi::Error::ConfigurationError, 'Invalid credentials: ' \
|
207
|
+
'Either username/password or OAuth credentials must be specified.'
|
208
|
+
) unless credentials?
|
209
|
+
|
210
|
+
validate_oauth! if oauth.values.all?
|
211
|
+
validate_basic_auth! if basic_auth.values.all?
|
212
|
+
end
|
134
213
|
|
135
|
-
|
136
|
-
|
214
|
+
# Raises an error if credentials are of the wrong type.
|
215
|
+
#
|
216
|
+
# @raise [DeskApi::Error::ConfigurationError]
|
217
|
+
%w(oauth basic_auth).each do |type|
|
218
|
+
define_method(:"validate_#{type}!") do
|
219
|
+
send(type.to_sym).each_pair do |credential, value|
|
220
|
+
next if value.nil?
|
221
|
+
|
222
|
+
fail(
|
223
|
+
DeskApi::Error::ConfigurationError, "Invalid #{credential} " \
|
224
|
+
"specified: must be a string or symbol."
|
225
|
+
) unless value.is_a?(String) || value.is_a?(Symbol)
|
137
226
|
end
|
138
227
|
end
|
139
228
|
end
|
140
|
-
end
|
141
229
|
|
142
|
-
|
143
|
-
|
144
|
-
|
230
|
+
# Raises an error if the endpoint is not a valid URL.
|
231
|
+
#
|
232
|
+
# @raises [DeskApi::Error::ConfigurationError]
|
233
|
+
def validate_endpoint!
|
234
|
+
fail(
|
235
|
+
DeskApi::Error::ConfigurationError,
|
236
|
+
"Invalid endpoint specified: `#{endpoint}` must be a valid url."
|
237
|
+
) unless endpoint =~ /^#{URI.regexp}$/
|
145
238
|
end
|
146
239
|
end
|
147
240
|
end
|
data/lib/desk_api/default.rb
CHANGED
@@ -1,63 +1,120 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
1
|
+
# Copyright (c) 2013-2014, Salesforce.com, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
#
|
4
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
# are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# * Redistributions of source code must retain the above copyright notice, this
|
8
|
+
# list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# * Neither the name of Salesforce.com nor the names of its contributors may be
|
15
|
+
# used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
18
28
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
29
|
+
module DeskApi
|
30
|
+
# {DeskApi::Default} contains the default configuration for each
|
31
|
+
# {DeskApi::Client}.
|
32
|
+
#
|
33
|
+
# @author Thomas Stachl <tstachl@salesforce.com>
|
34
|
+
# @copyright Copyright (c) 2013-2014 Salesforce.com
|
35
|
+
# @license BSD 3-Clause License
|
36
|
+
module Default
|
37
|
+
CONNECTION_OPTIONS = {
|
38
|
+
headers: {
|
39
|
+
accept: 'application/json',
|
40
|
+
user_agent: "desk.com Ruby Gem v#{DeskApi::VERSION}"
|
41
|
+
},
|
42
|
+
request: {
|
43
|
+
open_timeout: 5,
|
44
|
+
timeout: 10
|
45
|
+
}
|
46
|
+
} unless defined? DeskApi::Default::CONNECTION_OPTIONS
|
23
47
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
48
|
+
class << self
|
49
|
+
# A hash of all the options
|
50
|
+
#
|
51
|
+
# @return [Hash]
|
52
|
+
def options
|
53
|
+
Hash[DeskApi::Configuration.keys.map { |key| [key, send(key)] }]
|
54
|
+
end
|
28
55
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
56
|
+
# The username if environmental variable is set
|
57
|
+
#
|
58
|
+
# @return [String]
|
59
|
+
def username
|
60
|
+
ENV['DESK_USERNAME']
|
61
|
+
end
|
33
62
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
63
|
+
# The password if environmental variable is set
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
def password
|
67
|
+
ENV['DESK_PASSWORD']
|
68
|
+
end
|
38
69
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
70
|
+
# The consumer key if environmental variable is set
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
def consumer_key
|
74
|
+
ENV['DESK_CONSUMER_KEY']
|
75
|
+
end
|
43
76
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
77
|
+
# The consumer secret if environmental variable is set
|
78
|
+
#
|
79
|
+
# @return [String]
|
80
|
+
def consumer_secret
|
81
|
+
ENV['DESK_CONSUMER_SECRET']
|
82
|
+
end
|
48
83
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
84
|
+
# The access token if environmental variable is set
|
85
|
+
#
|
86
|
+
# @return [String]
|
87
|
+
def token
|
88
|
+
ENV['DESK_TOKEN']
|
89
|
+
end
|
53
90
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
91
|
+
# The access token secret if environmental variable is set
|
92
|
+
#
|
93
|
+
# @return [String]
|
94
|
+
def token_secret
|
95
|
+
ENV['DESK_TOKEN_SECRET']
|
96
|
+
end
|
97
|
+
|
98
|
+
# The subdomain if environmental variable is set
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
def subdomain
|
102
|
+
ENV['DESK_SUBDOMAIN']
|
103
|
+
end
|
104
|
+
|
105
|
+
# The endpoint if environmental variable is set
|
106
|
+
#
|
107
|
+
# @return [String]
|
108
|
+
def endpoint
|
109
|
+
ENV['DESK_ENDPOINT']
|
110
|
+
end
|
58
111
|
|
59
|
-
|
60
|
-
|
112
|
+
# The connection options hash
|
113
|
+
#
|
114
|
+
# @return [Hash]
|
115
|
+
def connection_options
|
116
|
+
CONNECTION_OPTIONS
|
117
|
+
end
|
61
118
|
end
|
62
119
|
end
|
63
|
-
end
|
120
|
+
end
|