odata-model 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/odata/model/railtie.rb +10 -18
- data/lib/odata/model/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f56aecd8c5071ce9f3b9acf1eca239c80bcfa9d8
|
4
|
+
data.tar.gz: 216c750f323face4dd7313632dc6fed744c019d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7674f7f9dd1d8827ce6e3c3f23e9cf263d6ab15dc77634ae4dc13db2720b6101dc5f1e54443133c6d8ccdeb56903bbb397b2628f614cd452774abbc9f38a1a05
|
7
|
+
data.tar.gz: 19ecc7169b74298563c8824a5d789d12c53171d8a091a398ce5c631bf96af6bb719f42e0784a6585602beb2d514b401badb3e0f41b8674a9c4f38645eb878e1a
|
data/lib/odata/model/railtie.rb
CHANGED
@@ -5,32 +5,24 @@ module OData
|
|
5
5
|
class Railtie < ::Rails::Railtie
|
6
6
|
attr_accessor :configuration
|
7
7
|
|
8
|
-
config.odata = ActiveSupport::OrderedOptions.new
|
9
|
-
|
10
8
|
initializer('odata.load-config') do
|
11
|
-
|
12
|
-
process_configuration
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
9
|
+
config_file = Rails.root.join('config', 'odata.yml').read
|
16
10
|
|
17
|
-
def parse_configuration
|
18
|
-
config_file = Rails.root.join('config', 'mongoid.yml')
|
19
11
|
if config_file.file?
|
20
|
-
parsed_config = YAML.load(config_file
|
12
|
+
parsed_config = YAML.load(config_file)
|
21
13
|
self.configuration = parsed_config.with_indifferent_access
|
22
|
-
end
|
23
|
-
end
|
24
14
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
15
|
+
configuration[Rails.env].each do |service_name, service_details|
|
16
|
+
url = service_details[:url]
|
17
|
+
options = generate_options(service_name, service_details)
|
18
|
+
OData::Service.open(url, options)
|
19
|
+
validate_service_setup(service_name)
|
20
|
+
end
|
31
21
|
end
|
32
22
|
end
|
33
23
|
|
24
|
+
private
|
25
|
+
|
34
26
|
def generate_options(service_name, service_details)
|
35
27
|
options = { name: service_name }
|
36
28
|
if service_details[:username] && service_details[:password]
|
data/lib/odata/model/version.rb
CHANGED