oil_fetcher 0.1.0 → 1.0.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: 7fde0f5e105c424870dbc4eac5c603a807fb2f12
4
- data.tar.gz: 50e4cffed73796b2f916ceb573569e19a9002d67
3
+ metadata.gz: 53274b7a567c7669b3a4bc0e8dfc37dc52f7af6d
4
+ data.tar.gz: 62381e1fb881138aebd66f783f467d020f8c0e54
5
5
  SHA512:
6
- metadata.gz: b6374f30666a0a60d850765694d8e3f0ba7dec0eb2104e6d7ef8952ebbd313d4e60a52ac8d27d4a048794849a3afacce891c5718553e7d9f6457249727cb5032
7
- data.tar.gz: a10e42420f35ecce98a6df6fc6a9ed7c5f6a100a6adf161d45961f5be826ce4e351103187e2ba2b0678c1a4aaf28d06c29e131ca34a6dc959f6ae278638067ec
6
+ metadata.gz: 5a2b7bf87617d0d6334ba789249cc9a10c2e704d11ffbc5ad5a22ddbc9b7f74b7f366e79b061cff72383837e0e4ec4bd77c526f6d43175eea60706aa7db6801e
7
+ data.tar.gz: 89517c22dcda902a0ab40c4274499194086ec4f32eb5a25b31f60f8896ab15b87f5afc26e59499f8f18ad0900c30e14277141f1ce681f4f41e7f81742ba2902e
data/README.md CHANGED
@@ -28,6 +28,8 @@
28
28
  OilFetcher.configure |config| do
29
29
  config.uri = "www.example.com"
30
30
  config.logger = mylogger
31
+ config.proxy_host = 'proxy'
32
+ config.proxy_port = 8080
31
33
  end
32
34
 
33
35
  Ожидается, что по адресу `uri` будет json вида
@@ -1,6 +1,6 @@
1
1
  module OilFetcher
2
2
  class Configuration
3
- attr_accessor :uri, :logger
3
+ attr_accessor :uri, :logger, :proxy_host, :proxy_port
4
4
 
5
5
  def initialize
6
6
  @uri = "https://www.quandl.com/api/v1/datasets/CHRIS/ICE_B1.json?rows=1"
@@ -3,7 +3,11 @@ require 'json'
3
3
  module OilFetcher
4
4
  class Fetcher
5
5
  def call
6
- json = fetch_json OilFetcher.configuration.uri
6
+ json = fetch_json(
7
+ OilFetcher.configuration.uri,
8
+ OilFetcher.configuration.proxy_host,
9
+ OilFetcher.configuration.proxy_port
10
+ )
7
11
  return unless json
8
12
 
9
13
  Oil.new(extract_params(json))
@@ -11,9 +15,10 @@ module OilFetcher
11
15
 
12
16
  private
13
17
 
14
- def fetch_json(uri)
18
+ def fetch_json(uri, proxy_host, proxy_port)
15
19
  uri = URI(uri)
16
- file = Net::HTTP.get uri
20
+ http = Net::HTTP::Proxy(proxy_host, proxy_port)
21
+ file = http.get(uri)
17
22
  return unless file
18
23
 
19
24
  JSON.parse file
@@ -1,3 +1,3 @@
1
1
  module OilFetcher
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oil_fetcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yana Petrova
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler