oanda_api_v20 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/CHANGELOG.md +4 -0
- data/lib/oanda_api_v20/pricing.rb +17 -15
- data/lib/oanda_api_v20/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 145cfc6151144fbd433437480a84ade5979e0925
|
4
|
+
data.tar.gz: be705bc8e001aa7130fb737bb4d293398d00cc14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01e1f96777e51ff3313c7d842a0fce4eb9730b4f127a7af5794a7292f516fd67c10fb9df437df9a9becca6afd4fb8607e7ce3afcff0acb7315be9ac8f374fc57
|
7
|
+
data.tar.gz: ef476fb280a946cf30f8624c4482655ee1fb8fb54bc8bf6117d38fdd6461daba1a77759a791aab7b69ca5035a98f733df0a9d35e8286f67242669c61997d781c
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 2.1.1
|
4
|
+
#### 2019-10-05
|
5
|
+
* Fix to pricing_stream method. This fixes the currency pair rate being reused over and over no matter the value read in the HTTP chunk. Big thanks to @joseluis-fw & @salrepe.
|
6
|
+
|
3
7
|
## 2.1.0
|
4
8
|
#### 2019-02-01
|
5
9
|
* New pricing_stream endpoint. Big thanks to @joseluis-fw.
|
@@ -8,26 +8,28 @@ module OandaApiV20
|
|
8
8
|
|
9
9
|
# GET /v3/accounts/:account_id/pricing/stream
|
10
10
|
def pricing_stream(options, &block)
|
11
|
-
buffer =
|
11
|
+
buffer = String.new
|
12
12
|
|
13
13
|
Client.send(http_verb, "#{base_uri}/accounts/#{account_id}/pricing/stream", headers: headers, query: options, stream_body: true) do |fragment|
|
14
|
-
|
15
|
-
next if fragment.empty?
|
16
|
-
|
14
|
+
if !fragment.empty?
|
17
15
|
buffer << fragment
|
18
|
-
|
19
|
-
|
20
|
-
buffer.string.split("\n").each do |message|
|
21
|
-
cleaned_message = message.strip
|
22
|
-
next if cleaned_message.empty?
|
23
|
-
yield JSON.parse(cleaned_message)
|
24
|
-
end
|
25
|
-
rescue JSON::ParseError => e
|
26
|
-
raise OandaApiV20::ParseError, "#{e.message} in '#{fragment}'"
|
27
|
-
ensure
|
28
|
-
buffer.flush
|
16
|
+
parse(buffer, fragment, &block) if fragment.match(/\n\Z/)
|
29
17
|
end
|
30
18
|
end
|
31
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def parse(buffer, fragment, &block)
|
24
|
+
buffer.split("\n").each do |message|
|
25
|
+
cleaned_message = message.strip
|
26
|
+
next if cleaned_message.empty?
|
27
|
+
yield JSON.parse(cleaned_message)
|
28
|
+
end
|
29
|
+
rescue JSON::ParserError => e
|
30
|
+
raise OandaApiV20::ParseError, "#{e.message} in '#{fragment}'"
|
31
|
+
ensure
|
32
|
+
buffer.clear
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oanda_api_v20
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kobus Joubert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|