oanda_api_v20 1.3.0 → 1.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db69dca6a7b2e6a90014655db03bb55e458091a5
4
- data.tar.gz: f5944a97ae751f3034b22334ac985b55b7e4ce3a
3
+ metadata.gz: 5cc17a87a05a5669e9e354172d5ce22e499a55ad
4
+ data.tar.gz: 46e88f60cbf5afc6b1a68d1879606f314705dc0c
5
5
  SHA512:
6
- metadata.gz: e84bc7248328b97b98b969891ab161fb7ae6ff1f81240e8ae842174f951b74817b2162d76b9b9092a8dcf266951993a9a3551bd8574bd93493943d48f6c99eb3
7
- data.tar.gz: dffcb489f40265cbe32114447074b9cef1d15c72e268138239dd7dd42c8ee8cafc6ffb38c7deddd8edc2a60618cd4a0cefdf0c675a819d7005da9265c8529b75
6
+ metadata.gz: 9a0a165e36940c48f27d404e0410653b31a93f310167500262a50dc27863a7958608d64273c6053b85391397af791e8d2d1a3041e24713f63b6a27e4c44a3d5a
7
+ data.tar.gz: c73dbae14c7268667aefea57b112b18274ff4447c46bf8fde9f4225d089f047a2bf1632a00fec4b2dd764f49034874e0ea825e2d27b60256a88f89fac21102bd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.4.0
4
+ #### 2017-06-04
5
+ * Ability for API requests to go through a proxy.
6
+
7
+ ## 1.3.0
8
+ #### 2017-03-16
9
+ * Updated the account method to allow query options to be passed along.
10
+
3
11
  ## 1.2.0
4
12
  #### 2016-12-03
5
13
  * Added the instruments method to retrieve candlestick data.
data/README.md CHANGED
@@ -33,6 +33,10 @@ If you would like to trade with your test account:
33
33
 
34
34
  client = OandaApiV20.new(access_token: 'my_access_token', practice: true)
35
35
 
36
+ If you need your requests to go through a proxy:
37
+
38
+ client = OandaApiV20.new(access_token: 'my_access_token', proxy_url: 'https://user:pass@proxy.com:80')
39
+
36
40
  ## Examples
37
41
 
38
42
  ### Accounts
@@ -9,7 +9,7 @@ module OandaApiV20
9
9
  practice: 'https://api-fxpractice.oanda.com/v3'
10
10
  }
11
11
 
12
- attr_accessor :access_token
12
+ attr_accessor :access_token, :proxy_url
13
13
  attr_reader :base_uri, :headers
14
14
 
15
15
  def initialize(options = {})
@@ -26,6 +26,10 @@ module OandaApiV20
26
26
  @headers['X-Accept-Datetime-Format'] = 'RFC3339'
27
27
  @headers['Content-Type'] = 'application/json'
28
28
 
29
+ if proxy_url && uri = URI(proxy_url)
30
+ Client.http_proxy(uri.hostname, uri.port, uri.user, uri.password)
31
+ end
32
+
29
33
  persistent_connection_adapter_options = {
30
34
  name: 'oanda_api_v20',
31
35
  keep_alive: 30,
@@ -1,3 +1,3 @@
1
1
  module OandaApiV20
2
- VERSION = '1.3.0'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -7,6 +7,11 @@ describe OandaApiV20::Client do
7
7
  expect(c.access_token).to eq('my_access_token')
8
8
  end
9
9
 
10
+ it 'sets the proxy_url attribute when supplied' do
11
+ c = OandaApiV20::Client.new(proxy_url: 'https://user:pass@proxy.com:80')
12
+ expect(c.proxy_url).to eq('https://user:pass@proxy.com:80')
13
+ end
14
+
10
15
  it 'sets the base_uri to practice when the practice option was supplied and set to true' do
11
16
  c = OandaApiV20::Client.new(practice: true)
12
17
  expect(c.base_uri).to eq('https://api-fxpractice.oanda.com/v3')
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: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kobus Joubert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-16 00:00:00.000000000 Z
11
+ date: 2017-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty