dss_reuters 0.2.0 → 0.3.0
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 +4 -4
- data/README.md +6 -0
- data/lib/dss_reuters/version.rb +1 -1
- data/lib/dss_reuters.rb +27 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 172520c2eb6d624f8326f53254fc51dd5e4ffbea38408d41da85ccb8ff479f56
|
4
|
+
data.tar.gz: 2f3439fe8861db055c80beed96ee2fff992fb61e8bdaa2a4423cfbd41f611f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1545cce156190f8842deb44e814aa87297dba797cc4bc6dd8d660839be5ed2c9b9db31dbdfceabf20caa9bcc59db7bc1187804ec8ab15de44695381d0e097a1
|
7
|
+
data.tar.gz: 31fd40dad975698279e8a3fc0c51c9a30ce642dadab868bba35713aabc878b3efbff59a3b3655eeec6a9771d468ebb8e9f8a6c705376ac19203344fc4ee944ed
|
data/README.md
CHANGED
@@ -33,8 +33,14 @@ Usage flow goes like this :
|
|
33
33
|
api = DssReuters::Api.new
|
34
34
|
req = api.extract_with_isin "KE1000001402"
|
35
35
|
req.get_result
|
36
|
+
req.status # check if :completed. If :in_progress, check again
|
36
37
|
req.result # Check result and get again if necessary
|
37
38
|
|
39
|
+
Default request fires a Composite extraction request. You can customize your request like :
|
40
|
+
|
41
|
+
req = api.extract_with_isin "KE1000001402", ["Life High", "Life Low", "Year High", "Year Low"], :intraday_pricing
|
42
|
+
req = api.extract_with_isin "KE1000001402", ["Net Change - Close Price - 1 Day"], :technical_indicators
|
43
|
+
|
38
44
|
## Contributing
|
39
45
|
|
40
46
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dss_reuters. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/dss_reuters/version.rb
CHANGED
data/lib/dss_reuters.rb
CHANGED
@@ -60,14 +60,15 @@ module DssReuters
|
|
60
60
|
class OnDemandExtract
|
61
61
|
include HTTParty
|
62
62
|
base_uri Config::BASE_URI
|
63
|
-
attr_reader :result
|
63
|
+
attr_reader :result, :status
|
64
64
|
|
65
65
|
def camelize(str)
|
66
66
|
str.to_s.split('_').collect(&:capitalize).join
|
67
67
|
end
|
68
68
|
|
69
|
-
def initialize(session, fields, identifiers, type
|
69
|
+
def initialize(session, fields, identifiers, type)
|
70
70
|
@session = session
|
71
|
+
@status = :init
|
71
72
|
path = "/RestApi/v1/Extractions/ExtractWithNotes"
|
72
73
|
options = {
|
73
74
|
headers: {
|
@@ -90,19 +91,33 @@ module DssReuters
|
|
90
91
|
}.to_json
|
91
92
|
}
|
92
93
|
resp = self.class.post path, options
|
93
|
-
|
94
|
+
if check_status(resp)
|
95
|
+
@location = resp["location"]
|
96
|
+
end
|
97
|
+
pp resp
|
94
98
|
@session.logger.debug resp
|
95
99
|
end
|
96
100
|
|
101
|
+
def check_status(resp)
|
102
|
+
if resp["status"] == "InProgress"
|
103
|
+
@status = :in_progress
|
104
|
+
else
|
105
|
+
@status = :complete
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
97
109
|
def get_result
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
110
|
+
if @status == :in_progress
|
111
|
+
options = {
|
112
|
+
headers: {
|
113
|
+
"Prefer" => "respond-async; wait=5",
|
114
|
+
"Authorization" => "Token #{@session.token}"
|
115
|
+
}
|
102
116
|
}
|
103
|
-
|
104
|
-
|
105
|
-
|
117
|
+
@result = self.class.get @location, options
|
118
|
+
check_status @result
|
119
|
+
@session.logger.debug @result
|
120
|
+
end
|
106
121
|
end
|
107
122
|
end
|
108
123
|
|
@@ -115,7 +130,7 @@ module DssReuters
|
|
115
130
|
@user = User.new(@session)
|
116
131
|
end
|
117
132
|
|
118
|
-
def extract_with_isin(isin_code, fields=nil)
|
133
|
+
def extract_with_isin(isin_code, fields=nil, type=:composite)
|
119
134
|
fields ||= [
|
120
135
|
"Close Price",
|
121
136
|
"Contributor Code Description",
|
@@ -133,7 +148,7 @@ module DssReuters
|
|
133
148
|
"IdentifierType" => "Isin"
|
134
149
|
}
|
135
150
|
]
|
136
|
-
OnDemandExtract.new(@session, fields, identifiers)
|
151
|
+
OnDemandExtract.new(@session, fields, identifiers, type)
|
137
152
|
end
|
138
153
|
end
|
139
154
|
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.3.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-06-
|
11
|
+
date: 2018-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|