vantiv_sftp_reports 0.1.1 → 0.2.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 +2 -0
- data/lib/vantiv_sftp_reports/config.rb +9 -1
- data/lib/vantiv_sftp_reports/fetch.rb +10 -1
- data/lib/vantiv_sftp_reports/version.rb +2 -2
- 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: 30b7b962df4821236808725c7edd7b20de296f86
|
4
|
+
data.tar.gz: fce029fb211981649dac1d99c594e006a5167790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efa0a424c38ca41e471816e3ba1b449b9bc5ca91a580233f98553258d4c2708bc97aa97cb9397079b53ee1329cb848db02d479346bac3f1ad37f2f973767ca9a
|
7
|
+
data.tar.gz: 4a852496e06f9035cfd73ca676328d8944827c8a303905f3fc96534c4c50e61f393e7e0ede8bb20f64928276347a4556ebf8ac1a73634d037c6e0a607626ae47
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ VantivSFTPReports.configure(
|
|
31
31
|
password:, # Your SFTP username
|
32
32
|
path:, # Directory where reports are stored, defaults to 'reports'
|
33
33
|
port:, # SFTP port, defaults to '22'
|
34
|
+
proxy_url:, # A proxy host to use for the SSH session, useful if you need to fetch reports from a server not directly whitelisted in your Vantiv account setup
|
34
35
|
username: # Your SFTP username
|
35
36
|
)
|
36
37
|
```
|
@@ -46,6 +47,7 @@ Prefix any configuration option with `vantiv_sftp_` and it will be automatically
|
|
46
47
|
* `ENV['vantiv_sftp_password']`
|
47
48
|
* `ENV['vantiv_sftp_path']`
|
48
49
|
* `ENV['vantiv_sftp_port']`
|
50
|
+
* `ENV['vantiv_sftp_proxy_url']`
|
49
51
|
* `ENV['vantiv_sftp_username']`
|
50
52
|
|
51
53
|
## Usage
|
@@ -24,7 +24,15 @@ module VantivSFTPReports
|
|
24
24
|
self.class.new(@opts.merge(opts))
|
25
25
|
end
|
26
26
|
|
27
|
-
%i[
|
27
|
+
%i[
|
28
|
+
host
|
29
|
+
organization_id
|
30
|
+
password
|
31
|
+
path
|
32
|
+
port
|
33
|
+
proxy_url
|
34
|
+
username
|
35
|
+
].each { |o| define_method(o) { @opts[o] } }
|
28
36
|
|
29
37
|
private
|
30
38
|
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'csv'
|
4
4
|
require 'vantiv_sftp_reports/config'
|
5
|
+
require 'net/ssh/proxy/http'
|
5
6
|
|
6
7
|
module VantivSFTPReports
|
7
8
|
class Fetch
|
@@ -46,13 +47,21 @@ module VantivSFTPReports
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def session
|
49
|
-
|
50
|
+
sftp_opts = config.sftp_opts
|
51
|
+
sftp_opts.merge!(proxy: proxy).delete(:proxy_url) if sftp_opts[:proxy_url]
|
52
|
+
Net::SFTP.start(config.host, config.username, sftp_opts) { |sftp| yield(sftp) }
|
50
53
|
end
|
51
54
|
|
52
55
|
%i[organization_id path].each { |m| define_method(m) { config.__send__(m) } }
|
53
56
|
|
54
57
|
private
|
55
58
|
|
59
|
+
def proxy
|
60
|
+
return nil unless config.proxy_url
|
61
|
+
uri = URI(config.proxy_url)
|
62
|
+
Net::SSH::Proxy::HTTP.new(uri.host, uri.port)
|
63
|
+
end
|
64
|
+
|
56
65
|
def date_str(obj)
|
57
66
|
obj.respond_to?(:strftime) ? obj.strftime('%Y%m%d') : obj.to_s
|
58
67
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vantiv_sftp_reports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-sftp
|