dss_reuters 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/dss_reuters/version.rb +1 -1
- data/lib/dss_reuters.rb +40 -16
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 47ea67d3a2c9a5cd34848988152d6723f3629e17
|
4
|
+
data.tar.gz: cdae6f36c34c7c5949db00328412beb8c197e012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba684c9c0ba7b251123de6125240c93f998342b4905ec8d73a3e96e0b7a3d971ec17391f50184888cb4d62616a50bb585ed66c5d9e560eb55e0b008e605a49a5
|
7
|
+
data.tar.gz: 827492b204258cb8ffda3b89ffc93494c422431b58989ef3ba51884cc064940959f6418c316dd4f05354fb8f6bc82527fd8eb5c554a3100b7837f1953445b5a0
|
data/lib/dss_reuters/version.rb
CHANGED
data/lib/dss_reuters.rb
CHANGED
@@ -6,9 +6,9 @@ require "dss_reuters/version"
|
|
6
6
|
module DssReuters
|
7
7
|
class Config
|
8
8
|
BASE_URI = "https://hosted.datascopeapi.reuters.com"
|
9
|
-
DSS_USERNAME = ENV.fetch('DSS_USERNAME')
|
10
|
-
DSS_PASSWORD = ENV.fetch('DSS_PASSWORD')
|
11
9
|
LOG_LEVEL = ENV['DSS_LOG_LEVEL'] || 'INFO'
|
10
|
+
DSS_USERNAME = ENV['DSS_USERNAME']
|
11
|
+
DSS_PASSWORD = ENV['DSS_PASSWORD']
|
12
12
|
end
|
13
13
|
|
14
14
|
class Session
|
@@ -17,6 +17,14 @@ module DssReuters
|
|
17
17
|
|
18
18
|
attr_reader :context, :token, :logger
|
19
19
|
|
20
|
+
def configured?
|
21
|
+
!Config::DSS_USERNAME.nil? and !Config::DSS_PASSWORD.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
def not_configured_error
|
25
|
+
@logger.error "dss_reuters gem not configured. you will not be able to fetch data from dss reuters API"
|
26
|
+
end
|
27
|
+
|
20
28
|
def initialize
|
21
29
|
@logger = ::Logger.new(STDOUT)
|
22
30
|
@logger.level = Config::LOG_LEVEL
|
@@ -33,10 +41,14 @@ module DssReuters
|
|
33
41
|
}
|
34
42
|
}.to_json
|
35
43
|
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
44
|
+
if configured?
|
45
|
+
resp = self.class.post login_path, options
|
46
|
+
@token = resp["value"]
|
47
|
+
@context = resp["@odata.context"]
|
48
|
+
@logger.debug resp
|
49
|
+
else
|
50
|
+
not_configured_error
|
51
|
+
end
|
40
52
|
end
|
41
53
|
end
|
42
54
|
|
@@ -53,8 +65,12 @@ module DssReuters
|
|
53
65
|
"Authorization" => "Token #{@session.token}"
|
54
66
|
}
|
55
67
|
}
|
56
|
-
|
57
|
-
|
68
|
+
if session.configured?
|
69
|
+
resp = self.class.get path, options
|
70
|
+
@session.logger.debug resp
|
71
|
+
else
|
72
|
+
session.not_configured_error
|
73
|
+
end
|
58
74
|
end
|
59
75
|
end
|
60
76
|
|
@@ -101,11 +117,15 @@ module DssReuters
|
|
101
117
|
}
|
102
118
|
}.to_json
|
103
119
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
120
|
+
if session.configured?
|
121
|
+
resp = self.class.post path, options
|
122
|
+
if check_status(resp)
|
123
|
+
@location = resp["location"]
|
124
|
+
end
|
125
|
+
@session.logger.debug resp
|
126
|
+
else
|
127
|
+
session.not_configured_error
|
107
128
|
end
|
108
|
-
@session.logger.debug resp
|
109
129
|
end
|
110
130
|
end
|
111
131
|
|
@@ -125,10 +145,14 @@ module DssReuters
|
|
125
145
|
"Authorization" => "Token #{@session.token}"
|
126
146
|
}
|
127
147
|
}
|
128
|
-
@
|
129
|
-
|
130
|
-
|
131
|
-
|
148
|
+
if @session.configured?
|
149
|
+
@result = self.class.get @location, options
|
150
|
+
check_status @result
|
151
|
+
@session.logger.debug @result
|
152
|
+
@status
|
153
|
+
else
|
154
|
+
@session.not_configured_error
|
155
|
+
end
|
132
156
|
end
|
133
157
|
end
|
134
158
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dss_reuters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arda Karaduman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
121
|
+
rubygems_version: 2.6.11
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: This is a simple gem to extract data from DSS Reuters
|