spark_api 1.4.26 → 1.4.27
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 +8 -8
- data/VERSION +1 -1
- data/lib/spark_api/cli.rb +6 -1
- data/lib/spark_api/cli/api_auth.rb +2 -1
- data/lib/spark_api/cli/oauth2.rb +1 -0
- data/lib/spark_api/configuration.rb +3 -1
- data/lib/spark_api/request.rb +2 -1
- data/spec/unit/spark_api/configuration_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDBhNjI3MmEwMWY5YTI4MzUwMzE1NDc0ZDI2NTQwNjBiNjUzNGJiNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODAzOWQwMTFhYzM2ZTIwN2VmYTY4NmMyMTdhZjA1ZWRiN2JkOTg1MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2I2NzU3OThjMzhkMzRlNDNlODAwZThjZjk4NjBmZTE2YTlhMWJiNmM2Nzg1
|
10
|
+
ZDA2NzQzY2MyYzc3MzhkNzQ3NDI4Y2NiY2Y2OGEzZWRiZGVkNmFjYjc4ZWVm
|
11
|
+
MGIzZmEzMjcwYzc2YmJmZGMzZmZjN2NkMmVhMDM1MTQ4MTAwN2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2FlMThkOGNlMWYwMzc3Y2UwNWQ0MjkwOWFlMGEzMGZhMmQ0MzZlYTg4ZmE3
|
14
|
+
ZjcyMGQzYWVkMDNiZjRkOTAxOTg5MjcwZDY1M2ZkNzM1ODFmN2MyMWYxY2I5
|
15
|
+
NzRkMGFiYmZlMmFjZTM0ZjBjMTk4MDNmZmYwNTRlYWE1ZjUyYTQ=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.27
|
data/lib/spark_api/cli.rb
CHANGED
@@ -32,6 +32,7 @@ module SparkApi
|
|
32
32
|
# OTHER
|
33
33
|
:debug=> "DEBUG",
|
34
34
|
:middleware => "SPARK_MIDDLEWARE",
|
35
|
+
:dictionary_version => "DICTIONARY_VERSION",
|
35
36
|
:console => "SPARK_API_CONSOLE" # not a public option, meant to distinguish bin/spark_api and script/console
|
36
37
|
}
|
37
38
|
|
@@ -71,7 +72,8 @@ module SparkApi
|
|
71
72
|
:api_user => ENV[OPTIONS_ENV[:api_user]],
|
72
73
|
:ssl_verify => ENV.fetch(OPTIONS_ENV[:ssl_verify], true),
|
73
74
|
:console => ENV[OPTIONS_ENV[:console]],
|
74
|
-
:middleware => ENV[OPTIONS_ENV[:middleware]]
|
75
|
+
:middleware => ENV[OPTIONS_ENV[:middleware]],
|
76
|
+
:dictionary_version => ENV[OPTIONS_ENV[:dictionary_version]]
|
75
77
|
}
|
76
78
|
cli_options = {}
|
77
79
|
file_options = {}
|
@@ -133,6 +135,9 @@ module SparkApi
|
|
133
135
|
opts.on("--middleware SPARK_MIDDLEWARE",
|
134
136
|
"spark_api for accessing spark, reso_api for accessing reso adapter",
|
135
137
|
"Default: spark_api") { |arg| cli_options[:middleware] = arg }
|
138
|
+
opts.on("--dictionary_version DICTIONARY_VERSION",
|
139
|
+
"spark_api for accessing spark, reso_api for accessing reso adapter",
|
140
|
+
"Default: spark_api") { |arg| cli_options[:dictionary_version] = arg }
|
136
141
|
|
137
142
|
# General
|
138
143
|
opts.on("-f", "--file FILE",
|
@@ -6,5 +6,6 @@ SparkApi.configure do |config|
|
|
6
6
|
config.api_user = ENV["API_USER"] if ENV["API_USER"]
|
7
7
|
config.endpoint = ENV["API_ENDPOINT"] if ENV["API_ENDPOINT"]
|
8
8
|
config.ssl_verify = ENV["SSL_VERIFY"].downcase != 'false' if ENV["SSL_VERIFY"]
|
9
|
-
config.middleware = ENV["SPARK_MIDDLEWARE"]
|
9
|
+
config.middleware = ENV["SPARK_MIDDLEWARE"] if ENV["SPARK_MIDDLEWARE"]
|
10
|
+
config.dictionary_version = ENV["DICTIONARY_VERSION"] if ENV["DICTIONARY_VERSION"]
|
10
11
|
end
|
data/lib/spark_api/cli/oauth2.rb
CHANGED
@@ -20,6 +20,7 @@ SparkApi.configure do |config|
|
|
20
20
|
config.endpoint = ENV["API_ENDPOINT"] if ENV["API_ENDPOINT"]
|
21
21
|
config.ssl_verify = ENV["SSL_VERIFY"].downcase != 'false' if ENV["SSL_VERIFY"]
|
22
22
|
config.middleware = ENV["SPARK_MIDDLEWARE"] if ENV["SPARK_MIDDLEWARE"]
|
23
|
+
config.dictionary_version = ENV["DICTIONARY_VERSION"] if ENV["DICTIONARY_VERSION"]
|
23
24
|
end
|
24
25
|
|
25
26
|
# Enables saving and loading serialized oauth2 sessions for the system user.
|
@@ -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, :timeout, :middleware, :request_id_chain].freeze
|
14
|
+
:auth_endpoint, :callback, :compress, :timeout, :middleware, :dictionary_version, :request_id_chain].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,
|
@@ -44,6 +44,7 @@ module SparkApi
|
|
44
44
|
DEFAULT_COMPRESS = false
|
45
45
|
DEFAULT_TIMEOUT = 5 # seconds
|
46
46
|
DEFAULT_MIDDLEWARE = 'spark_api'
|
47
|
+
DEFAULT_DICTIONARY_VERSION = nil
|
47
48
|
DEFAULT_REQUEST_ID_CHAIN = nil
|
48
49
|
|
49
50
|
X_SPARK_API_USER_AGENT = "X-SparkApi-User-Agent"
|
@@ -79,6 +80,7 @@ module SparkApi
|
|
79
80
|
self.compress = DEFAULT_COMPRESS
|
80
81
|
self.timeout = DEFAULT_TIMEOUT
|
81
82
|
self.middleware = DEFAULT_MIDDLEWARE
|
83
|
+
self.dictionary_version = DEFAULT_DICTIONARY_VERSION
|
82
84
|
self.request_id_chain = DEFAULT_REQUEST_ID_CHAIN
|
83
85
|
self
|
84
86
|
end
|
data/lib/spark_api/request.rb
CHANGED
@@ -66,7 +66,8 @@ module SparkApi
|
|
66
66
|
request_opts = {}
|
67
67
|
request_opts.merge!(options)
|
68
68
|
request_path = if middleware && middleware.to_sym == :reso_api
|
69
|
-
"
|
69
|
+
dd_version = "Dictionary/#{dictionary_version}/" unless dictionary_version.nil?
|
70
|
+
"/Reso/#{dd_version}OData#{path}"
|
70
71
|
else
|
71
72
|
"/#{version}#{path}"
|
72
73
|
end
|
@@ -14,6 +14,7 @@ describe SparkApi::Client, "Client config" do
|
|
14
14
|
SparkApi.api_key.should match("my_api_key")
|
15
15
|
SparkApi.timeout.should eq(5)
|
16
16
|
SparkApi.request_id_chain.should be_nil
|
17
|
+
SparkApi.middleware.should eq('spark_api')
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -238,5 +239,26 @@ describe SparkApi::Client, "Client config" do
|
|
238
239
|
end
|
239
240
|
end
|
240
241
|
|
242
|
+
describe "RESO configuration" do
|
243
|
+
it "should return a properly configured client" do
|
244
|
+
client = SparkApi::Client.new(:api_key => "key_of_cody",
|
245
|
+
:api_secret => "TopSecret",
|
246
|
+
:api_user => "1234",
|
247
|
+
:endpoint => "http://api.coolio.dev.fbsdata.com",
|
248
|
+
:timeout => 15,
|
249
|
+
:request_id_chain => 'foobar',
|
250
|
+
:middleware => 'reso_api',
|
251
|
+
:dictionary_version => '1.6')
|
252
|
+
|
253
|
+
client.api_key.should match("key_of_cody")
|
254
|
+
client.api_secret.should match("TopSecret")
|
255
|
+
client.api_user.should match("1234")
|
256
|
+
client.endpoint.should match("http://api.coolio.dev.fbsdata.com")
|
257
|
+
client.timeout.should eq(15)
|
258
|
+
client.request_id_chain.should eq('foobar')
|
259
|
+
client.middleware.should eq('reso_api')
|
260
|
+
client.dictionary_version.should eq('1.6')
|
261
|
+
end
|
262
|
+
end
|
241
263
|
end
|
242
264
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spark_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Hornseth
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-12-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|