little_finger 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/little_finger/parsers/tax_sales_file.rb +2 -0
- data/lib/little_finger/server_file.rb +8 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDE4ODBjMDBjYmM1ZjE4YzBjM2U4NjlhZDE2OWUwZDFjZmVlYjcxZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjE2MzZkNzJkYjM0MGY5MzA3ZDE5ZThkZjc2MTcwNWJkMTc3ZmZmOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTAzYTQ4ZjY5YzM3NGZlMDk0ZWUwMmNhODIxYWExOGE4MzY0YThjMjQ5Njdj
|
10
|
+
YWUxYTZiOGIzZGE2MTI1NmQ1MmFjYWYwMmI2OTkyNWQyNGUxMjA1MzU5Mzdj
|
11
|
+
OWM4ZWE0NWM3OGQzMWE2NmMzNThhYjEzOTIyNTBkZWY5YjExMzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWY3MzY3MmRjMzgxMDc5MDQ5Y2QwMGY1ZGZjYmU2MTNkOTY2MTJlZmQ1YjAz
|
14
|
+
MDkzNzhhYTUxOTE0MGY2MjAyYWE5YjJkZTY2NGIyZDA5ZTYxMTIyYTJhZWQ4
|
15
|
+
OTcwMjczZmE5NDE3YjZjNTNlYTJkYzI0MzMyYTM5ZDk4ZWE2MWY=
|
@@ -21,6 +21,8 @@ module LittleFinger
|
|
21
21
|
entry = [zip_code,effective_date, rate, description, state, city]
|
22
22
|
raise StandardError.new("Avatax file format is incorrect: #{entry}") if entry.any?{|elem| elem.nil?}
|
23
23
|
key = (zip_code + city).strip
|
24
|
+
effective_date = "2015/01/01" if effective_date == "0000/00/00"
|
25
|
+
|
24
26
|
tax_data[key] = { zip: zip_code, city: city, state: state, tax_rate: BigDecimal.new(rate), effective_at: DateTime.strptime(effective_date, "%Y/%m/%d") }
|
25
27
|
end
|
26
28
|
tax_data
|
@@ -6,13 +6,15 @@ class LittleFinger::ServerFile
|
|
6
6
|
attr_reader :folder_name
|
7
7
|
attr_reader :ftp_site
|
8
8
|
|
9
|
-
|
9
|
+
# Retrieves zipped files from the avatax servers
|
10
|
+
# @param file_name [String] Name of file to retrieve
|
11
|
+
def self.fetch(file_name)
|
10
12
|
settings = LittleFinger::Configuration.configuration[:avatax][:ftp]
|
11
|
-
obj = LittleFinger::ServerFile.new(settings[:username], settings[:password], settings[:ftp_site])
|
13
|
+
obj = LittleFinger::ServerFile.new(settings[:username], settings[:password], settings[:ftp_site], file_name)
|
12
14
|
obj.fetch
|
13
15
|
end
|
14
16
|
|
15
|
-
def initialize(username, password, ftp_site)
|
17
|
+
def initialize(username, password, ftp_site, file_name)
|
16
18
|
@username = username
|
17
19
|
@password = password
|
18
20
|
@ftp_site = ftp_site
|
@@ -21,14 +23,13 @@ class LittleFinger::ServerFile
|
|
21
23
|
@folder_name = ""
|
22
24
|
@folder_name = portions[1] if portions.count > 1
|
23
25
|
@ftp_iface = nil
|
26
|
+
@file_name = file_name
|
24
27
|
end
|
25
28
|
|
26
29
|
def fetch()
|
27
30
|
connect
|
28
|
-
|
29
|
-
|
30
|
-
# parse(unzipped_files.first)
|
31
|
-
unzip(filename)
|
31
|
+
zip_file = retrieve_file(@file_name)
|
32
|
+
unzip(zip_file)
|
32
33
|
end
|
33
34
|
|
34
35
|
def connect
|