davidsons 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0840c1274babcf9eb57a4ef24f84931ee3693e7a
4
- data.tar.gz: 053ab73ab4258594104732a3e943111202da2383
2
+ SHA256:
3
+ metadata.gz: 9bf429f746003d6265c0b884318f237f1ed19bc1667008112531e56d66adb9a8
4
+ data.tar.gz: bf631b8a5f09378731ce6473e1a0beb8fb5b1e9e0d3de7f49e8f0692a0330e11
5
5
  SHA512:
6
- metadata.gz: 445dd946ba77bf28ae1e6bb7b78f7033ad1aa3aeedc1ec5c42d9788be5790aa93bf3aa076d6879c2fd50baf12052d674887f83155550d1859afa9d82317c81cc
7
- data.tar.gz: d0ab4bec018a56e335753e9951da13ef6516066d592ee7ad16faa1f47240d074a40db1a8b62907fc6fc37308f91fd1a0c68ea9934207ee34db7b91f653ab485c
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
@@ -10,3 +10,4 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ script/*
@@ -0,0 +1 @@
1
+ davidsons
@@ -0,0 +1 @@
1
+ 2.3.6
@@ -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 :debug
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 debug? debug
34
+ alias debug_mode? debug_mode
34
35
 
35
36
  def initialize
36
- @debug ||= false
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/"
@@ -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
- raise Davidsons::NotAuthenticated
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
@@ -1,8 +1,8 @@
1
1
  module Davidsons
2
2
  class Catalog < Base
3
3
 
4
- CATALOG_FILENAME = "davidsons_inventory.csv".freeze
5
- CHUNK_SIZE = 100
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[:finish],
58
- barrel_length: item[:barrel_length],
59
- overall_length: item[:overall_length],
60
- model_series: item[:model_series],
61
- sights: item[:sights],
62
- stock: item[:stock]
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
 
@@ -64,7 +64,7 @@ module Davidsons
64
64
  chunk.each do |item|
65
65
  item.except!(:upc_code)
66
66
 
67
- item[:quantity] = item[:quantity_nc].to_i + item[:quantity_az].to_i
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
 
@@ -4,8 +4,8 @@ require 'pp'
4
4
  module Davidsons
5
5
  class Order < Base
6
6
 
7
- TEST_URL = 'https://dealernetwork.davidsonsinc.com/testapi/orderservice.asmx?WSDL'
8
- API_URL = 'https://dealernetwork.davidsonsinc.com/api/orderservice.asmx?WSDL'
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 = Hash.new
18
- settings[:wsdl] = @options[:test] ? TEST_URL : API_URL
19
- settings[:env_namespace] = 'soap'
20
- settings[:proxy] = Davidsons.config.proxy_url
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' => @options[:token],
54
- 'OrderNo' => order_number
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]
@@ -10,7 +10,9 @@ module Davidsons
10
10
  def authenticated?
11
11
  connect(@options) { |ftp| ftp.pwd }
12
12
  true
13
- rescue Davidsons::NotAuthenticated
13
+ rescue Davidsons::NotAuthenticated => e
14
+ puts "Davidsons::User#authenticated? => false"
15
+ puts e
14
16
  false
15
17
  end
16
18
 
@@ -1,3 +1,3 @@
1
1
  module Davidsons
2
- VERSION = "1.0.1"
2
+ VERSION = '1.0.3'.freeze
3
3
  end
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.1
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-03 00:00:00.000000000 Z
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.5.1
144
+ rubygems_version: 2.7.7
142
145
  signing_key:
143
146
  specification_version: 4
144
147
  summary: Ruby library for Davidson's