reuters 0.8.3 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +3 -3
- data/lib/reuters/response.rb +9 -4
- data/lib/reuters/version.rb +1 -1
- data/spec/reuters/response_spec.rb +22 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Zjk0NzBkNTExZjE2MjgzNDY4NzBhN2UxODdlN2VjNmY4NTk2YjIxMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDVlM2NmZGEwOWU3ZDE5OTg0MjRlNWQ4MDNjZmIzODlkY2RiZTU5OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTMxMTg2ZDEwMDNlNjgzMWM3YTY1ZWUyYzJhMGM4NzY1MTNiOTBmNGU5ZGI1
|
10
|
+
MjAyNGFjMDA3YzdmNzRiNjg0OTMxNWQzYjAxMzI2OGQxMDJmNjM3M2Q2N2Qz
|
11
|
+
MTI0ODQ2NTA0MmI4OTE5N2M4ZWFjZGNhYzcyN2E2Mjg1MzBjYzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDE0YjFhNGQ4NWRlY2EwYzQ3ZGZkNzlkM2FjNmM0OTA2YmVjMzRkNzE1NWE0
|
14
|
+
MTMzYmMyNmJiMTdlOTRjZTI2N2Y5YzU1ODI4YjhmNTc2NDJhNjRjM2NlOGRi
|
15
|
+
N2EzN2MzMTJiYWUwMGE0MmNjM2U0NTk1OGQwMWRlMWRhODQ0OTE=
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Thomson Reuters API Client
|
2
2
|
|
3
|
-
[![Coverage Status](https://coveralls.io/repos/Stockflare/reuters/badge.png?branch=master)](https://coveralls.io/r/Stockflare/reuters?branch=master) [![Build Status](https://travis-ci.org/Stockflare/reuters.svg?branch=master)](https://travis-ci.org/Stockflare/reuters) [![Dependency Status](https://gemnasium.com/Stockflare/reuters.svg)](https://gemnasium.com/Stockflare/reuters) [![Code Climate](https://codeclimate.com/github/Stockflare/reuters.png)](https://codeclimate.com/github/Stockflare/reuters)
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/Stockflare/reuters/badge.png?branch=master)](https://coveralls.io/r/Stockflare/reuters?branch=master) [![Build Status](https://travis-ci.org/Stockflare/reuters.svg?branch=master)](https://travis-ci.org/Stockflare/reuters) [![Dependency Status](https://gemnasium.com/Stockflare/reuters.svg)](https://gemnasium.com/Stockflare/reuters) [![Code Climate](https://codeclimate.com/github/Stockflare/reuters.png)](https://codeclimate.com/github/Stockflare/reuters) [![Gem Version](https://badge.fury.io/rb/reuters.png)](http://badge.fury.io/rb/reuters)
|
4
4
|
|
5
5
|
|
6
6
|
Uses the [Reuter's TRKD API](http://thomsonreuters.com/knowledge-direct/) to grab financial data for stocks, such as quotes, estimates and snapshots.
|
@@ -202,8 +202,8 @@ Different Response classes parse data slightly differently depending on how it i
|
|
202
202
|
|
203
203
|
## Contributing
|
204
204
|
|
205
|
-
The Reuters API is vast and has lots of calls that each vary in complexity and usage. At the moment, we only have limited development time, so have only developed the calls that we use.
|
205
|
+
The Reuters API is vast and has lots of calls that each vary in complexity and usage. At the moment, we only have limited development time, so have only developed the calls that we use.
|
206
206
|
|
207
|
-
If you would like to develop an API Call, open an issue and please feel free to ask for assistance with building it.
|
207
|
+
If you would like to develop an API Call, open an issue and please feel free to ask for assistance with building it.
|
208
208
|
|
209
209
|
If you find a bug, have a feature request or even want to contribute an enhancement or fix, please follow the contributing guidelines included in the repository.
|
data/lib/reuters/response.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Reuters
|
2
2
|
# This class parses Savon response bodies into more practical
|
3
3
|
# accessible objects, by using a recursive strategy for parsing
|
4
|
-
# the content.
|
4
|
+
# the content.
|
5
5
|
#
|
6
6
|
# @note All attributes for XML elements can be accessed via the
|
7
7
|
# attributes accessor.
|
@@ -20,8 +20,13 @@ module Reuters
|
|
20
20
|
|
21
21
|
def method_missing(name)
|
22
22
|
if key?(name)
|
23
|
-
|
24
|
-
|
23
|
+
val = self[name]
|
24
|
+
case val
|
25
|
+
when String then val
|
26
|
+
when Array
|
27
|
+
val.collect do |v|
|
28
|
+
self.class.new v
|
29
|
+
end
|
25
30
|
else
|
26
31
|
self.class.new val
|
27
32
|
end
|
@@ -29,4 +34,4 @@ module Reuters
|
|
29
34
|
end
|
30
35
|
|
31
36
|
end
|
32
|
-
end
|
37
|
+
end
|
data/lib/reuters/version.rb
CHANGED
@@ -9,13 +9,17 @@ describe Reuters::Response do
|
|
9
9
|
name: {
|
10
10
|
full_name: "ABC Solutions Ltd.",
|
11
11
|
short_name: "ABC Ltd."
|
12
|
-
}
|
12
|
+
},
|
13
|
+
list: [
|
14
|
+
{ fruit: "apple" },
|
15
|
+
{ fruit: "banana" }
|
16
|
+
]
|
13
17
|
},
|
14
18
|
:@type => "ORD"
|
15
19
|
}
|
16
20
|
}
|
17
21
|
|
18
|
-
before do
|
22
|
+
before do
|
19
23
|
@response = Reuters::Response.new(test_hash)
|
20
24
|
end
|
21
25
|
|
@@ -23,6 +27,22 @@ describe Reuters::Response do
|
|
23
27
|
|
24
28
|
it { should respond_to(:attributes) }
|
25
29
|
|
30
|
+
describe "when a value is an array" do
|
31
|
+
|
32
|
+
it "should return an array" do
|
33
|
+
expect(@response.info.list).to be_a Array
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should contain an array of Response objects" do
|
37
|
+
expect(@response.info.list.first).to be_an_instance_of Reuters::Response
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should access nested array response objects" do
|
41
|
+
expect(@response.info.list.first.fruit).to eq "apple"
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
26
46
|
describe "a nested response object" do
|
27
47
|
|
28
48
|
it "should return a nested response object" do
|