gun_accessory_supply 0.0.1 → 0.0.2
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2fe7a5553b787d43d52c0cadb9a6425e68926dc40894227df1fe411e91cc6be
|
|
4
|
+
data.tar.gz: 60a38f322d1c5f652b7af6b2c86032664f26efac060fc82171c8f8bb996db43d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba7715b9801c91b4caa21025161fa95a8e5af5e15bfce83937ca77fe848ff4376aed8f56cfc26765049224cc7e1d4e99de1c98ae2075ed922256fbaff64cae4c
|
|
7
|
+
data.tar.gz: 432ee3fe3f9b3cb713a542e32d37b17346aee29a5368cc96920b63e6add91d97086fe9f73905d55acc8ba024d10f076306622c78dc8cfa1d5f14c1ec13fc2cf1
|
|
@@ -3,8 +3,13 @@ module GunAccessorySupply
|
|
|
3
3
|
|
|
4
4
|
def self.connect(options = {})
|
|
5
5
|
requires!(options, :username, :password)
|
|
6
|
-
|
|
7
|
-
Net::SFTP.start(
|
|
6
|
+
|
|
7
|
+
Net::SFTP.start(
|
|
8
|
+
GunAccessorySupply.config.proxy_host || GunAccessorySupply.config.sftp_host,
|
|
9
|
+
options[:username],
|
|
10
|
+
password: options[:password],
|
|
11
|
+
port: GunAccessorySupply.config.proxy_port || GunAccessorySupply.config.sftp_port
|
|
12
|
+
) do |sftp|
|
|
8
13
|
yield(sftp)
|
|
9
14
|
end
|
|
10
15
|
end
|
|
@@ -47,12 +52,12 @@ module GunAccessorySupply
|
|
|
47
52
|
node.content.try(:strip)
|
|
48
53
|
end
|
|
49
54
|
end
|
|
50
|
-
|
|
55
|
+
|
|
51
56
|
def get_file(filename, file_directory=nil)
|
|
52
57
|
connect(@options) do |sftp|
|
|
53
58
|
begin
|
|
54
59
|
tempfile = Tempfile.new
|
|
55
|
-
|
|
60
|
+
|
|
56
61
|
sftp.download!(File.join(file_directory, filename), tempfile.path)
|
|
57
62
|
|
|
58
63
|
return tempfile
|
|
@@ -67,7 +72,7 @@ module GunAccessorySupply
|
|
|
67
72
|
sftp.dir.foreach(file_directory) { |entry| filenames << entry.name }
|
|
68
73
|
filename = filenames.select{ |n| n.include?(file_prefix) }.sort.last
|
|
69
74
|
|
|
70
|
-
tempfile = self.get_file(filename, file_directory)
|
|
75
|
+
tempfile = self.get_file(filename, file_directory)
|
|
71
76
|
return tempfile
|
|
72
77
|
end
|
|
73
78
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module GunAccessorySupply
|
|
2
2
|
class Catalog < Base
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
def initialize(options = {})
|
|
5
5
|
requires!(options, :username, :password)
|
|
6
6
|
@options = options
|
|
@@ -12,12 +12,12 @@ module GunAccessorySupply
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def all
|
|
15
|
-
tempfile = get_most_recent_file(GunAccessorySupply.config.
|
|
15
|
+
tempfile = get_most_recent_file(GunAccessorySupply.config.inventory_filename_prefix, 'out')
|
|
16
16
|
items = []
|
|
17
17
|
|
|
18
18
|
File.open(tempfile).each_with_index do |row, i|
|
|
19
19
|
row = parse_row(row)
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
if i==0
|
|
22
22
|
@headers = row
|
|
23
23
|
next
|
|
@@ -30,7 +30,7 @@ module GunAccessorySupply
|
|
|
30
30
|
upc: row[@headers.index('UPC')].try(:strip),
|
|
31
31
|
name: row[@headers.index('Item Description')].try(:strip),
|
|
32
32
|
quantity: row[@headers.index("Available Qty")].to_i,
|
|
33
|
-
price: row[@headers.index('
|
|
33
|
+
price: row[@headers.index('Dealer Cost')].try(:strip),
|
|
34
34
|
msrp: row[@headers.index('MSRP')].try(:strip),
|
|
35
35
|
map_price: row[@headers.index('MAP Price')].try(:strip),
|
|
36
36
|
brand: row[@headers.index('Manufacturer')].try(:strip),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module GunAccessorySupply
|
|
2
2
|
class Inventory < Base
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
def initialize(options = {})
|
|
5
5
|
requires!(options, :username, :password)
|
|
6
6
|
@options = options
|
|
@@ -17,12 +17,12 @@ module GunAccessorySupply
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def all
|
|
20
|
-
tempfile = get_most_recent_file(GunAccessorySupply.config.
|
|
20
|
+
tempfile = get_most_recent_file(GunAccessorySupply.config.inventory_filename_prefix, 'out')
|
|
21
21
|
items = []
|
|
22
22
|
|
|
23
23
|
File.open(tempfile).each_with_index do |row, i|
|
|
24
24
|
row = parse_row(row)
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
if i==0
|
|
27
27
|
@headers = row
|
|
28
28
|
next
|
|
@@ -44,12 +44,12 @@ module GunAccessorySupply
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def quantity
|
|
47
|
-
tempfile = get_most_recent_file(GunAccessorySupply.config.
|
|
47
|
+
tempfile = get_most_recent_file(GunAccessorySupply.config.inventory_filename_prefix, 'out')
|
|
48
48
|
items = []
|
|
49
49
|
|
|
50
50
|
File.open(tempfile).each_with_index do |row, i|
|
|
51
51
|
row = parse_row(row)
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
if i==0
|
|
54
54
|
@headers = row
|
|
55
55
|
next
|
data/lib/gun_accessory_supply.rb
CHANGED
|
@@ -32,19 +32,19 @@ module GunAccessorySupply
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
class Configuration
|
|
35
|
-
attr_accessor
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
attr_accessor *%i(
|
|
36
|
+
sftp_host
|
|
37
|
+
sftp_port
|
|
38
|
+
inventory_filename_prefix
|
|
39
|
+
xml_domain
|
|
40
|
+
xml_secret
|
|
41
|
+
proxy_host
|
|
42
|
+
proxy_port
|
|
43
|
+
)
|
|
42
44
|
|
|
43
45
|
def initialize
|
|
44
|
-
@
|
|
45
|
-
@
|
|
46
|
-
@ftp_port ||= "2222"
|
|
47
|
-
@top_level_dir ||= "/out"
|
|
46
|
+
@sftp_host ||= "50.233.131.250"
|
|
47
|
+
@sftp_port ||= "2222"
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gun_accessory_supply
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tony Beninate
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-08-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|