desk 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/desk.gemspec +1 -1
- data/lib/desk/configuration.rb +112 -0
- data/lib/desk/deash.rb +9 -1
- data/lib/desk/version.rb +1 -1
- data/spec/desk/api_spec.rb +37 -0
- metadata +7 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a9aa7d85fd6f664f33aa22ca041d54c50d13a13
|
4
|
+
data.tar.gz: d75f64fc8370b1e6535fc9db8284c4f5c6633c2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5a548d4329f1d30b69396a94b230f2e7bba42a75f483ab00a344eaebe23b3a6afbd3a270e3e00cfef3a907c4031724a9dacd81d008e4485ac2437078c833ce2
|
7
|
+
data.tar.gz: a6bff0a201abff9eccca566d88657d70f8145d7551eb3253b002918b37163a7b665cf7e3043618c7519a2bec177e2e5f4e70be20fc94cafe78d3e63622adc6e9
|
data/desk.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.add_development_dependency('webmock', '~> 1.6')
|
13
13
|
s.add_development_dependency('yard', '~> 0.6')
|
14
14
|
s.add_runtime_dependency('json', '~> 1.7') if RUBY_VERSION < '1.9'
|
15
|
-
s.add_runtime_dependency 'hashie', '
|
15
|
+
s.add_runtime_dependency 'hashie', '3.4.1'
|
16
16
|
s.add_runtime_dependency('faraday', '~> 0.9.0')
|
17
17
|
s.add_runtime_dependency('faraday_middleware', '~> 0.9.0')
|
18
18
|
s.add_runtime_dependency('jruby-openssl', '~> 0.7.2') if RUBY_PLATFORM == 'java'
|
data/lib/desk/configuration.rb
CHANGED
@@ -93,6 +93,118 @@ module Desk
|
|
93
93
|
Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]
|
94
94
|
end
|
95
95
|
|
96
|
+
def adapter
|
97
|
+
Thread.current[:adapter] ||= DEFAULT_ADAPTER
|
98
|
+
end
|
99
|
+
|
100
|
+
def adapter=(val)
|
101
|
+
Thread.current[:adapter] = val
|
102
|
+
end
|
103
|
+
|
104
|
+
def consumer_key
|
105
|
+
Thread.current[:consumer_key] ||= DEFAULT_CONSUMER_KEY
|
106
|
+
end
|
107
|
+
|
108
|
+
def consumer_key=(val)
|
109
|
+
Thread.current[:consumer_key] = val
|
110
|
+
end
|
111
|
+
|
112
|
+
def consumer_secret
|
113
|
+
Thread.current[:consumer_secret] ||= DEFAULT_CONSUMER_SECRET
|
114
|
+
end
|
115
|
+
|
116
|
+
def consumer_secret=(val)
|
117
|
+
Thread.current[:consumer_secret] = val
|
118
|
+
end
|
119
|
+
|
120
|
+
def format
|
121
|
+
Thread.current[:format] ||= DEFAULT_FORMAT
|
122
|
+
end
|
123
|
+
|
124
|
+
def format=(val)
|
125
|
+
Thread.current[:format] = val
|
126
|
+
end
|
127
|
+
|
128
|
+
def logger
|
129
|
+
Thread.current[:logger] ||= DEFAULT_LOGGER
|
130
|
+
end
|
131
|
+
|
132
|
+
def logger=(val)
|
133
|
+
Thread.current[:logger] = val
|
134
|
+
end
|
135
|
+
|
136
|
+
def max_requests
|
137
|
+
Thread.current[:max_requests] ||= DEFAULT_MAX_REQUESTS
|
138
|
+
end
|
139
|
+
|
140
|
+
def max_requests=(val)
|
141
|
+
Thread.current[:max_requests] = val
|
142
|
+
end
|
143
|
+
|
144
|
+
def oauth_token
|
145
|
+
Thread.current[:oauth_token] ||= DEFAULT_OAUTH_TOKEN
|
146
|
+
end
|
147
|
+
|
148
|
+
def oauth_token=(val)
|
149
|
+
Thread.current[:oauth_token] = val
|
150
|
+
end
|
151
|
+
|
152
|
+
def oauth_token_secret
|
153
|
+
Thread.current[:oauth_token_secret] ||= DEFAULT_OAUTH_TOKEN_SECRET
|
154
|
+
end
|
155
|
+
|
156
|
+
def oauth_token_secret=(val)
|
157
|
+
Thread.current[:oauth_token_secret] = val
|
158
|
+
end
|
159
|
+
|
160
|
+
def proxy
|
161
|
+
Thread.current[:proxy] ||= DEFAULT_PROXY
|
162
|
+
end
|
163
|
+
|
164
|
+
def proxy=(val)
|
165
|
+
Thread.current[:proxy] = val
|
166
|
+
end
|
167
|
+
|
168
|
+
def subdomain
|
169
|
+
Thread.current[:subdomain] ||= DEFAULT_SUBDOMAIN
|
170
|
+
end
|
171
|
+
|
172
|
+
def subdomain=(val)
|
173
|
+
Thread.current[:subdomain] = val
|
174
|
+
end
|
175
|
+
|
176
|
+
def support_email
|
177
|
+
Thread.current[:support_email] ||= DEFAULT_SUPPORT_EMAIL
|
178
|
+
end
|
179
|
+
|
180
|
+
def support_email=(val)
|
181
|
+
Thread.current[:support_email] = val
|
182
|
+
end
|
183
|
+
|
184
|
+
def use_max_requests
|
185
|
+
Thread.current[:use_max_requests] ||= DEFAULT_USE_MAX_REQUESTS
|
186
|
+
end
|
187
|
+
|
188
|
+
def use_max_requests=(val)
|
189
|
+
Thread.current[:use_max_requests] = val
|
190
|
+
end
|
191
|
+
|
192
|
+
def user_agent
|
193
|
+
Thread.current[:user_agent] ||= DEFAULT_USER_AGENT
|
194
|
+
end
|
195
|
+
|
196
|
+
def user_agent=(val)
|
197
|
+
Thread.current[:user_agent] = val
|
198
|
+
end
|
199
|
+
|
200
|
+
def version
|
201
|
+
Thread.current[:version] ||= DEFAULT_VERSION
|
202
|
+
end
|
203
|
+
|
204
|
+
def version=(val)
|
205
|
+
Thread.current[:version] = val
|
206
|
+
end
|
207
|
+
|
96
208
|
# Reset all configuration options to defaults
|
97
209
|
def reset
|
98
210
|
self.adapter = DEFAULT_ADAPTER
|
data/lib/desk/deash.rb
CHANGED
@@ -17,7 +17,7 @@ module Hashie
|
|
17
17
|
end
|
18
18
|
|
19
19
|
class Deash < Mash
|
20
|
-
# Object#type is deprecated
|
20
|
+
# Object#type is deprecated
|
21
21
|
Mash.send :undef_method, :type
|
22
22
|
|
23
23
|
def count
|
@@ -54,6 +54,14 @@ module Hashie
|
|
54
54
|
return super
|
55
55
|
end
|
56
56
|
|
57
|
+
def dynamic_cached_method(meth, value)
|
58
|
+
(class << self; self; end).class_eval do
|
59
|
+
define_method meth do
|
60
|
+
instance_variable_set("@#{meth}", value)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
57
65
|
def id(parent_id = false)
|
58
66
|
id = nil
|
59
67
|
if includes_key_chain?("raw._links.self.href") ||
|
data/lib/desk/version.rb
CHANGED
data/spec/desk/api_spec.rb
CHANGED
@@ -45,6 +45,23 @@ describe Desk::API do
|
|
45
45
|
:version => "amazing",
|
46
46
|
:logger => double('logger')
|
47
47
|
}
|
48
|
+
|
49
|
+
@alternative_configuration = {
|
50
|
+
:consumer_key => 'Louie',
|
51
|
+
:consumer_secret => 'CounterStrike',
|
52
|
+
:oauth_token => 'plOT',
|
53
|
+
:oauth_token_secret => 'OperatingSystem',
|
54
|
+
:adapter => :sueohpyt,
|
55
|
+
:format => :json,
|
56
|
+
:max_requests => 5,
|
57
|
+
:proxy => 'http://tsuk:public@proxy.example.com:8080',
|
58
|
+
:subdomain => 'stresscoder',
|
59
|
+
:support_email => 'problem@stresscoder.com',
|
60
|
+
:use_max_requests => false,
|
61
|
+
:user_agent => 'Generic User Agent',
|
62
|
+
:version => "boring",
|
63
|
+
:logger => double('logger')
|
64
|
+
}
|
48
65
|
end
|
49
66
|
|
50
67
|
context "during initialization"
|
@@ -67,6 +84,26 @@ describe Desk::API do
|
|
67
84
|
api.send(key).should == @configuration[key]
|
68
85
|
end
|
69
86
|
end
|
87
|
+
|
88
|
+
it 'should keep different configurations for each thread' do
|
89
|
+
Thread.new do
|
90
|
+
api = Desk::API.new
|
91
|
+
@configuration.each do |key, value|
|
92
|
+
api.send("#{key}=", value)
|
93
|
+
end
|
94
|
+
|
95
|
+
Thread.new do
|
96
|
+
alt_api = Desk::API.new
|
97
|
+
@alternative_configuration.each do |key, value|
|
98
|
+
alt_api.send("#{key}=", value)
|
99
|
+
end
|
100
|
+
end.join
|
101
|
+
|
102
|
+
@configuration.each do |key, value|
|
103
|
+
api.send(key).should eq(value)
|
104
|
+
end
|
105
|
+
end.join
|
106
|
+
end
|
70
107
|
end
|
71
108
|
end
|
72
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: desk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Warren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -132,22 +132,16 @@ dependencies:
|
|
132
132
|
name: hashie
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '3.3'
|
138
|
-
- - ">="
|
135
|
+
- - '='
|
139
136
|
- !ruby/object:Gem::Version
|
140
|
-
version: 3.
|
137
|
+
version: 3.4.1
|
141
138
|
type: :runtime
|
142
139
|
prerelease: false
|
143
140
|
version_requirements: !ruby/object:Gem::Requirement
|
144
141
|
requirements:
|
145
|
-
- -
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
version: '3.3'
|
148
|
-
- - ">="
|
142
|
+
- - '='
|
149
143
|
- !ruby/object:Gem::Version
|
150
|
-
version: 3.
|
144
|
+
version: 3.4.1
|
151
145
|
- !ruby/object:Gem::Dependency
|
152
146
|
name: faraday
|
153
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -429,7 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
429
423
|
version: 1.3.6
|
430
424
|
requirements: []
|
431
425
|
rubyforge_project: desk
|
432
|
-
rubygems_version: 2.4.
|
426
|
+
rubygems_version: 2.4.6
|
433
427
|
signing_key:
|
434
428
|
specification_version: 4
|
435
429
|
summary: Ruby wrapper for the Desk.com API
|
@@ -557,4 +551,3 @@ test_files:
|
|
557
551
|
- spec/helper.rb
|
558
552
|
- spec/shared_context.rb
|
559
553
|
- spec/shared_examples.rb
|
560
|
-
has_rdoc:
|