bill_hicks 2.0.13 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bill_hicks.rb +1 -0
- data/lib/bill_hicks/brand_converter.rb +2 -2
- data/lib/bill_hicks/ftp.rb +23 -0
- data/lib/bill_hicks/response_file.rb +12 -17
- data/lib/bill_hicks/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f7483ccbb583a16feb2a6d9cba92df5e3aefcf1
|
4
|
+
data.tar.gz: 5942dfb526c3a38343f585a767fac6e010235a40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 516d4f62202175330666d29fc18a55d56529814e0566d4332b09ed3a15d2dab53ce8968ff22c59d716f85c3435887c7cda1cdd9882038fd37bf4f66188b160d8
|
7
|
+
data.tar.gz: 68404e5d4eb90cdc3b403a332db49c72ac5e9333c31a6ce5f61d41b9fbacbcac0b3352f852bd5748b5310f99cdd33315ef7ea8d4f063f565d4bcde33416551ff
|
data/lib/bill_hicks.rb
CHANGED
@@ -100,8 +100,8 @@ module BillHicks
|
|
100
100
|
{ prefix: 'BEN', company: 'Crosman' },
|
101
101
|
{ prefix: 'CROS', company: 'Crosman' },
|
102
102
|
{ prefix: 'NT', company: 'Non Typical (Cuddeback)' },
|
103
|
-
{ prefix: 'BERG', company: '
|
104
|
-
{ prefix: 'BGA', company: '
|
103
|
+
{ prefix: 'BERG', company: 'CVA' },
|
104
|
+
{ prefix: 'BGA', company: 'CVA' },
|
105
105
|
{ prefix: 'CVA', company: 'CVA' },
|
106
106
|
{ prefix: 'QUA', company: 'CVA' },
|
107
107
|
{ prefix: 'CZ', company: 'Cz Usa' },
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BillHicks
|
2
|
+
class FTP
|
3
|
+
|
4
|
+
attr_reader :connection
|
5
|
+
|
6
|
+
def initialize(credentials)
|
7
|
+
@connection ||= Net::FTP.new(BillHicks.config.ftp_host)
|
8
|
+
@connection.passive = true
|
9
|
+
self.login(credentials[:username], credentials[:password])
|
10
|
+
end
|
11
|
+
|
12
|
+
def login(username, password)
|
13
|
+
@connection.login(username, password)
|
14
|
+
rescue Net::FTPPermError
|
15
|
+
raise BillHicks::NotAuthenticated
|
16
|
+
end
|
17
|
+
|
18
|
+
def close
|
19
|
+
@connection.close
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -7,23 +7,20 @@ module BillHicks
|
|
7
7
|
# @option options [String] :username *required*
|
8
8
|
# @option options [String] :password *required*
|
9
9
|
# @option options [String] :filename *required*
|
10
|
-
def initialize(options = {})
|
10
|
+
def initialize(ftp, options = {})
|
11
11
|
requires!(options, :username, :password, :filename)
|
12
12
|
|
13
|
-
@credentials
|
14
|
-
@filename
|
13
|
+
@credentials = options.select { |k, v| [:username, :password].include?(k) }
|
14
|
+
@filename = options[:filename]
|
15
|
+
@ftp = ftp
|
15
16
|
end
|
16
17
|
|
17
18
|
# Return list of '855 Purchase Order Acknowledgement' files
|
18
19
|
# @option options [String] :username *required*
|
19
20
|
# @option options [String] :password *required*
|
20
|
-
def self.all(
|
21
|
-
|
22
|
-
|
23
|
-
Base.connect(options) do |ftp|
|
24
|
-
ftp.chdir(BillHicks.config.full_response_dir)
|
25
|
-
ftp.nlst("*.txt")
|
26
|
-
end
|
21
|
+
def self.all(ftp)
|
22
|
+
ftp.chdir(BillHicks.config.full_response_dir)
|
23
|
+
ftp.nlst("*.txt")
|
27
24
|
end
|
28
25
|
|
29
26
|
# Is the file a '855 Purchase Order Acknowledgement'?
|
@@ -39,12 +36,11 @@ module BillHicks
|
|
39
36
|
# Use '#gettextfile' to read file contents as a string
|
40
37
|
def content
|
41
38
|
return @content if @content
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
39
|
+
|
40
|
+
@ftp.chdir(BillHicks.config.full_response_dir)
|
41
|
+
@content = @ftp.gettextfile(@filename, nil)
|
42
|
+
|
43
|
+
@content
|
48
44
|
end
|
49
45
|
|
50
46
|
# Convert to easily readable key-value pairs
|
@@ -74,5 +70,4 @@ module BillHicks
|
|
74
70
|
end
|
75
71
|
|
76
72
|
end
|
77
|
-
|
78
73
|
end
|
data/lib/bill_hicks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bill_hicks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dale Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smarter_csv
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/bill_hicks/brand_converter.rb
|
91
91
|
- lib/bill_hicks/catalog.rb
|
92
92
|
- lib/bill_hicks/category.rb
|
93
|
+
- lib/bill_hicks/ftp.rb
|
93
94
|
- lib/bill_hicks/inventory.rb
|
94
95
|
- lib/bill_hicks/order.rb
|
95
96
|
- lib/bill_hicks/response_file.rb
|
@@ -115,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
116
|
version: '0'
|
116
117
|
requirements: []
|
117
118
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.5.1
|
119
120
|
signing_key:
|
120
121
|
specification_version: 4
|
121
122
|
summary: Ruby library for Bill Hicks ERP system
|