spark_api 1.3.9 → 1.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/spark_api/configuration.rb +3 -1
- data/lib/spark_api/connection.rb +1 -0
- data/spec/unit/spark_api/configuration_spec.rb +19 -4
- metadata +6 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.10
|
@@ -11,7 +11,7 @@ module SparkApi
|
|
11
11
|
# valid configuration options
|
12
12
|
VALID_OPTION_KEYS = [:api_key, :api_secret, :api_user, :endpoint,
|
13
13
|
:user_agent, :version, :ssl, :ssl_verify, :oauth2_provider, :authentication_mode,
|
14
|
-
:auth_endpoint, :callback, :compress].freeze
|
14
|
+
:auth_endpoint, :callback, :compress, :timeout].freeze
|
15
15
|
OAUTH2_KEYS = [:authorization_uri, :access_uri, :client_id, :client_secret,
|
16
16
|
# Requirements for authorization_code grant type
|
17
17
|
:redirect_uri,
|
@@ -41,6 +41,7 @@ module SparkApi
|
|
41
41
|
DEFAULT_SSL_VERIFY = true
|
42
42
|
DEFAULT_OAUTH2 = nil
|
43
43
|
DEFAULT_COMPRESS = false
|
44
|
+
DEFAULT_TIMEOUT = 5 # seconds
|
44
45
|
|
45
46
|
X_SPARK_API_USER_AGENT = "X-SparkApi-User-Agent"
|
46
47
|
|
@@ -73,6 +74,7 @@ module SparkApi
|
|
73
74
|
self.ssl_verify = DEFAULT_SSL_VERIFY
|
74
75
|
self.version = DEFAULT_VERSION
|
75
76
|
self.compress = DEFAULT_COMPRESS
|
77
|
+
self.timeout = DEFAULT_TIMEOUT
|
76
78
|
self
|
77
79
|
end
|
78
80
|
end
|
data/lib/spark_api/connection.rb
CHANGED
@@ -12,6 +12,7 @@ describe SparkApi::Client, "Client config" do
|
|
12
12
|
SparkApi.user_agent.should match(/Spark API Ruby Gem .*/)
|
13
13
|
SparkApi.api_key = "my_api_key"
|
14
14
|
SparkApi.api_key.should match("my_api_key")
|
15
|
+
SparkApi.timeout.should eq(5)
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -21,7 +22,8 @@ describe SparkApi::Client, "Client config" do
|
|
21
22
|
:api_secret => "TopSecret",
|
22
23
|
:api_user => "1234",
|
23
24
|
:auth_endpoint => "https://login.wade.dev.fbsdata.com",
|
24
|
-
:endpoint => "http://api.wade.dev.fbsdata.com"
|
25
|
+
:endpoint => "http://api.wade.dev.fbsdata.com",
|
26
|
+
:timeout => 15)
|
25
27
|
|
26
28
|
client.api_key.should match("key_of_wade")
|
27
29
|
client.api_secret.should match("TopSecret")
|
@@ -29,6 +31,7 @@ describe SparkApi::Client, "Client config" do
|
|
29
31
|
client.auth_endpoint.should match("https://login.wade.dev.fbsdata.com")
|
30
32
|
client.endpoint.should match("http://api.wade.dev.fbsdata.com")
|
31
33
|
client.version.should match("v1")
|
34
|
+
client.timeout.should eq(15)
|
32
35
|
end
|
33
36
|
|
34
37
|
it "should allow unverified ssl certificates when verification is off" do
|
@@ -90,6 +93,7 @@ describe SparkApi::Client, "Client config" do
|
|
90
93
|
config.version = "veleventy"
|
91
94
|
config.endpoint = "test.api.sparkapi.com"
|
92
95
|
config.user_agent = "my useragent"
|
96
|
+
config.timeout = 15
|
93
97
|
end
|
94
98
|
|
95
99
|
SparkApi.api_key.should match("my_key")
|
@@ -99,6 +103,7 @@ describe SparkApi::Client, "Client config" do
|
|
99
103
|
SparkApi.endpoint.should match("test.api.sparkapi.com")
|
100
104
|
SparkApi.user_agent.should match("my useragent")
|
101
105
|
SparkApi.oauth2_enabled?().should be_false
|
106
|
+
SparkApi.timeout.should eq(15)
|
102
107
|
end
|
103
108
|
|
104
109
|
it "should correctly set up the client for oauth2" do
|
@@ -180,16 +185,26 @@ describe SparkApi::Client, "Client config" do
|
|
180
185
|
end
|
181
186
|
|
182
187
|
it "should not set gzip header by default" do
|
183
|
-
c = SparkApi::Client.new(:endpoint => "https://sparkapi.com")
|
188
|
+
c = SparkApi::Client.new(:endpoint => "https://sparkapi.com")
|
184
189
|
c.connection.headers["Accept-Encoding"].should be_nil
|
185
190
|
end
|
186
191
|
|
187
192
|
it "should set gzip header if compress option is set" do
|
188
|
-
c = SparkApi::Client.new(:endpoint => "https://api.sparkapi.com",
|
193
|
+
c = SparkApi::Client.new(:endpoint => "https://api.sparkapi.com",
|
189
194
|
:compress => true)
|
190
195
|
c.connection.headers["Accept-Encoding"].should eq("gzip, deflate")
|
191
196
|
end
|
192
|
-
|
197
|
+
|
198
|
+
it "should set default timeout of 5 seconds" do
|
199
|
+
c = SparkApi::Client.new(:endpoint => "https://sparkapi.com")
|
200
|
+
c.connection.options[:timeout].should eq(5)
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should set alternate timeout if specified" do
|
204
|
+
c = SparkApi::Client.new(:endpoint => "https://sparkapi.com",
|
205
|
+
:timeout => 15)
|
206
|
+
c.connection.options[:timeout].should eq(15)
|
207
|
+
end
|
193
208
|
end
|
194
209
|
|
195
210
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spark_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 10
|
10
|
+
version: 1.3.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brandon Hornseth
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2013-07-
|
19
|
+
date: 2013-07-26 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
type: :runtime
|
@@ -528,8 +528,8 @@ files:
|
|
528
528
|
- spec/unit/spark_api/multi_client_spec.rb
|
529
529
|
- spec/spec_helper.rb
|
530
530
|
homepage: https://github.com/sparkapi/spark_api
|
531
|
-
licenses:
|
532
|
-
|
531
|
+
licenses:
|
532
|
+
- Apache 2.0
|
533
533
|
post_install_message:
|
534
534
|
rdoc_options: []
|
535
535
|
|