davidsons 1.0.1 → 1.0.3
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 +5 -5
- data/.circleci/config.yml +41 -0
- data/.gitignore +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/lib/davidsons.rb +4 -3
- data/lib/davidsons/base.rb +7 -2
- data/lib/davidsons/catalog.rb +10 -12
- data/lib/davidsons/inventory.rb +1 -1
- data/lib/davidsons/order.rb +9 -8
- data/lib/davidsons/user.rb +3 -1
- data/lib/davidsons/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9bf429f746003d6265c0b884318f237f1ed19bc1667008112531e56d66adb9a8
|
4
|
+
data.tar.gz: bf631b8a5f09378731ce6473e1a0beb8fb5b1e9e0d3de7f49e8f0692a0330e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b04b1a42bc0bf21365523d7fad7552e021c0ae91214d8c3e842a81b70c2172c3d12a13195e6dc969f78fe36625a91de454cf08ea770cf2fba13d436c47d9d318
|
7
|
+
data.tar.gz: f4d7a8f6050ecb28ab0c1c0b9ee115ddf047bbea44732c30c0a532f8cc26dc9f5e2d29f1762d99e1b507f4ab3ea452288070c38027130cf9941256a6f9e02feb
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
jobs:
|
7
|
+
build:
|
8
|
+
docker:
|
9
|
+
# specify the version you desire here
|
10
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
11
|
+
|
12
|
+
working_directory: ~/repo
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
|
17
|
+
# Download and cache dependencies
|
18
|
+
- restore_cache:
|
19
|
+
keys:
|
20
|
+
- v1-dependencies-{{ checksum "davidsons.gemspec" }}
|
21
|
+
# fallback to using the latest cache if no exact match is found
|
22
|
+
- v1-dependencies-
|
23
|
+
|
24
|
+
- run:
|
25
|
+
name: install dependencies
|
26
|
+
command: |
|
27
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
28
|
+
|
29
|
+
- save_cache:
|
30
|
+
paths:
|
31
|
+
- ./vendor/bundle
|
32
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
33
|
+
|
34
|
+
# run tests!
|
35
|
+
- run:
|
36
|
+
name: run tests
|
37
|
+
command: |
|
38
|
+
mkdir /tmp/test-results
|
39
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
40
|
+
|
41
|
+
bundle exec rspec --format documentation $TEST_FILES
|
data/.gitignore
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
davidsons
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.6
|
data/lib/davidsons.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "davidsons/version"
|
2
2
|
|
3
3
|
require 'net/ftp'
|
4
|
+
require 'smarter_csv'
|
4
5
|
|
5
6
|
require 'davidsons/base'
|
6
7
|
require 'davidsons/user'
|
@@ -25,15 +26,15 @@ module Davidsons
|
|
25
26
|
end
|
26
27
|
|
27
28
|
class Configuration
|
28
|
-
attr_accessor :
|
29
|
+
attr_accessor :debug_mode
|
29
30
|
attr_accessor :ftp_host
|
30
31
|
attr_accessor :proxy_url
|
31
32
|
attr_accessor :xmlns
|
32
33
|
|
33
|
-
alias
|
34
|
+
alias debug_mode? debug_mode
|
34
35
|
|
35
36
|
def initialize
|
36
|
-
@
|
37
|
+
@debug_mode ||= false
|
37
38
|
@ftp_host ||= "ftp.davidsonsinventory.com"
|
38
39
|
@proxy_url ||= "http://172.31.69.148:8888"
|
39
40
|
@xmlns ||= "https://dealernetwork.davidsonsinc.com/"
|
data/lib/davidsons/base.rb
CHANGED
@@ -6,11 +6,16 @@ module Davidsons
|
|
6
6
|
|
7
7
|
Net::FTP.open(Davidsons.config.ftp_host, options[:username], options[:password]) do |ftp|
|
8
8
|
ftp.passive = true
|
9
|
+
ftp.debug_mode = Davidsons.config.debug_mode?
|
9
10
|
|
10
11
|
yield ftp
|
11
12
|
end
|
12
|
-
rescue Net::FTPPermError
|
13
|
-
|
13
|
+
rescue Net::FTPPermError => e
|
14
|
+
if e.to_s.start_with?('530')
|
15
|
+
raise Davidsons::NotAuthenticated
|
16
|
+
else
|
17
|
+
raise e
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
21
|
protected
|
data/lib/davidsons/catalog.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Davidsons
|
2
2
|
class Catalog < Base
|
3
3
|
|
4
|
-
CATALOG_FILENAME
|
5
|
-
CHUNK_SIZE
|
4
|
+
CATALOG_FILENAME = "davidsons_inventory.csv".freeze
|
5
|
+
CHUNK_SIZE = 100
|
6
6
|
|
7
7
|
def initialize(options = {})
|
8
8
|
requires!(options, :username, :password)
|
@@ -35,16 +35,14 @@ module Davidsons
|
|
35
35
|
chunk.each do |item|
|
36
36
|
item.except!(:retail_price, :capacity, :sale_price, :sale_ends)
|
37
37
|
|
38
|
-
item[:mfg_number] = item[:item_identifier]
|
39
38
|
item[:msrp].tr!('$', '')
|
40
39
|
item[:price].tr!('$', '')
|
41
40
|
item[:upc].tr!('#', '')
|
42
|
-
item[:quantity] = item[:quantity].to_i
|
43
41
|
|
42
|
+
item[:mfg_number] = item[:item_identifier]
|
43
|
+
item[:quantity] = item[:quantity].to_i
|
44
44
|
item[:features] = map_features(item)
|
45
45
|
|
46
|
-
item.except!(:finish, :barrel_length, :overall_length, :model_series, :sights, :stock)
|
47
|
-
|
48
46
|
yield(item)
|
49
47
|
end
|
50
48
|
end
|
@@ -54,12 +52,12 @@ module Davidsons
|
|
54
52
|
|
55
53
|
def map_features(item)
|
56
54
|
{
|
57
|
-
finish: item
|
58
|
-
barrel_length: item
|
59
|
-
overall_length: item
|
60
|
-
model_series: item
|
61
|
-
sights: item
|
62
|
-
stock: item
|
55
|
+
finish: item.delete(:finish),
|
56
|
+
barrel_length: item.delete(:barrel_length),
|
57
|
+
overall_length: item.delete(:overall_length),
|
58
|
+
model_series: item.delete(:model_series),
|
59
|
+
sights: item.delete(:sights),
|
60
|
+
stock: item.delete(:stock),
|
63
61
|
}
|
64
62
|
end
|
65
63
|
|
data/lib/davidsons/inventory.rb
CHANGED
@@ -64,7 +64,7 @@ module Davidsons
|
|
64
64
|
chunk.each do |item|
|
65
65
|
item.except!(:upc_code)
|
66
66
|
|
67
|
-
item[:quantity]
|
67
|
+
item[:quantity] = item[:quantity_nc].to_i + item[:quantity_az].to_i
|
68
68
|
|
69
69
|
item.except!(:quantity_nc, :quantity_az)
|
70
70
|
|
data/lib/davidsons/order.rb
CHANGED
@@ -4,8 +4,8 @@ require 'pp'
|
|
4
4
|
module Davidsons
|
5
5
|
class Order < Base
|
6
6
|
|
7
|
-
TEST_URL
|
8
|
-
API_URL
|
7
|
+
TEST_URL = 'https://dealernetwork.davidsonsinc.com/testapi/orderservice.asmx?WSDL'
|
8
|
+
API_URL = 'https://dealernetwork.davidsonsinc.com/api/orderservice.asmx?WSDL'
|
9
9
|
|
10
10
|
attr :client
|
11
11
|
|
@@ -14,10 +14,11 @@ module Davidsons
|
|
14
14
|
|
15
15
|
@options = options
|
16
16
|
|
17
|
-
settings =
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
settings = {
|
18
|
+
wsdl: @options[:test] ? TEST_URL : API_URL,
|
19
|
+
env_namespace: 'soap',
|
20
|
+
proxy: Davidsons.config.proxy_url
|
21
|
+
}
|
21
22
|
|
22
23
|
if @options[:test]
|
23
24
|
settings[:log] = true
|
@@ -50,8 +51,8 @@ module Davidsons
|
|
50
51
|
|
51
52
|
def get_order_tracking(order_number)
|
52
53
|
request = @client.call(:get_order_tracking, attributes: { xmlns: Davidsons.config.xmlns }, message: { ':request': {
|
53
|
-
'Token'
|
54
|
-
'OrderNo'
|
54
|
+
'Token' => @options[:token],
|
55
|
+
'OrderNo' => order_number
|
55
56
|
}})
|
56
57
|
|
57
58
|
tracking_info = request.body[:get_order_tracking_response][:get_order_tracking_result]
|
data/lib/davidsons/user.rb
CHANGED
data/lib/davidsons/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: davidsons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Knight
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -101,8 +101,11 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".circleci/config.yml"
|
104
105
|
- ".gitignore"
|
105
106
|
- ".rspec"
|
107
|
+
- ".ruby-gemset"
|
108
|
+
- ".ruby-version"
|
106
109
|
- ".travis.yml"
|
107
110
|
- Gemfile
|
108
111
|
- LICENSE.txt
|
@@ -138,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
141
|
version: '0'
|
139
142
|
requirements: []
|
140
143
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.7.7
|
142
145
|
signing_key:
|
143
146
|
specification_version: 4
|
144
147
|
summary: Ruby library for Davidson's
|