zanders 2.2.7 → 2.3.0

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
2
  SHA1:
3
- metadata.gz: 52badb9c2d6d13273145657ecc927f678209e5ae
4
- data.tar.gz: ca5f963d2b3f3d33eb214233098c0b5b977bada6
3
+ metadata.gz: f1e40bf9409d6d02ef10b37ea4775601ceb7c2cd
4
+ data.tar.gz: f71f3e3d12781a6f2857a10527e9a2e318fc51e5
5
5
  SHA512:
6
- metadata.gz: d026e542453a3c286c2f26b19f3edd09fce597ca579c9f7b3339ad76dec0e918bcef3bdcaf2409654099fb69eb91ffe51c7b2ae15484dc917cdc70531f785f02
7
- data.tar.gz: 61f7555598fad289f2a80e5961734fdfcbfe57cd412116fd7c1cb6f8da3b8c70a6a829b60c7dbc330e68eb90f9c774bc790ecdacc0c6f4735e9a4c9a1aac393e
6
+ metadata.gz: 5d9e843dca9c57e9b6d750154f5d42d169c8518cefdc1a982f705948833dccb660cb4e92f64d09a15c9f67fe0ab1de22a70b4e91b05e54da0b16045cb99d4f5d
7
+ data.tar.gz: a81640e4b9b752fa676ede380d5b963ded5cee5393cf6b1ced0cb1c6f5b7b3f9fb5adb826387ef042e3606015af63d0c404ee78157bc83d33fb1360c5bfd5674
@@ -6,10 +6,6 @@ module Zanders
6
6
  def initialize(options = {})
7
7
  requires!(options, :username, :password)
8
8
  @options = options
9
-
10
- if options[:full_product].present?
11
- self.load_descriptions
12
- end
13
9
  end
14
10
 
15
11
  def self.all(chunk_size = 15, options = {}, &block)
@@ -18,22 +14,11 @@ module Zanders
18
14
  end
19
15
 
20
16
  def all(chunk_size, &block)
21
- chunker = Zanders::Chunker.new(chunk_size)
22
17
  tempfile = get_file(CATALOG_FILENAME)
23
18
  xml_doc = Nokogiri::XML(tempfile.open)
24
19
 
25
20
  xml_doc.xpath("//ZandersDataOut").each do |item|
26
- if chunker.is_full?
27
- yield(chunker.chunk)
28
-
29
- chunker.reset!
30
- else
31
- chunker.add(map_hash(item, @options[:full_product].present?))
32
- end
33
- end
34
-
35
- if chunker.chunk.count > 0
36
- yield(chunker.chunk)
21
+ map_hash(item)
37
22
  end
38
23
 
39
24
  tempfile.unlink
@@ -41,13 +26,9 @@ module Zanders
41
26
 
42
27
  protected
43
28
 
44
- def map_hash(node, full_product = false)
29
+ def map_hash(node)
45
30
  features = self.map_features(node)
46
31
 
47
- if full_product
48
- long_description = self.get_description(content_for(node, 'ITEMNO'))
49
- end
50
-
51
32
  # product_type = case content_for(node, 'ITEMPRODUCTTYPE')
52
33
  # when 'PD', 'PR'
53
34
  # :ammunition
@@ -30,22 +30,11 @@ module Zanders
30
30
  end
31
31
 
32
32
  def all(chunk_size, &block)
33
- chunker = Zanders::Chunker.new(chunk_size)
34
33
  tempfile = get_file(INVENTORY_FILENAME)
35
34
  xml_doc = Nokogiri::XML(tempfile.open)
36
35
 
37
36
  xml_doc.xpath('//ZandersDataOut').each do |item|
38
- if chunker.is_full?
39
- yield(chunker.chunk)
40
-
41
- chunker.reset!
42
- else
43
- chunker.add(map_hash(item))
44
- end
45
- end
46
-
47
- if chunker.chunk.count > 0
48
- yield(chunker.chunk)
37
+ map_hash(item)
49
38
  end
50
39
 
51
40
  tempfile.unlink
@@ -1,3 +1,3 @@
1
1
  module Zanders
2
- VERSION = "2.2.7".freeze
2
+ VERSION = "2.3.0".freeze
3
3
  end
data/lib/zanders.rb CHANGED
@@ -5,7 +5,6 @@ require 'savon'
5
5
 
6
6
  require 'zanders/base'
7
7
  require 'zanders/soap_client'
8
- require 'zanders/chunker'
9
8
 
10
9
  require 'zanders/user'
11
10
  require 'zanders/address'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zanders
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.7
4
+ version: 2.3.0
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-06-27 00:00:00.000000000 Z
11
+ date: 2018-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -131,7 +131,6 @@ files:
131
131
  - lib/zanders/address.rb
132
132
  - lib/zanders/base.rb
133
133
  - lib/zanders/catalog.rb
134
- - lib/zanders/chunker.rb
135
134
  - lib/zanders/inventory.rb
136
135
  - lib/zanders/item.rb
137
136
  - lib/zanders/order.rb
@@ -159,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
158
  version: '0'
160
159
  requirements: []
161
160
  rubyforge_project:
162
- rubygems_version: 2.6.12
161
+ rubygems_version: 2.5.1
163
162
  signing_key:
164
163
  specification_version: 4
165
164
  summary: Ruby library for Zanders
@@ -1,34 +0,0 @@
1
- module Zanders
2
- class Chunker
3
-
4
- attr_accessor :chunk, :total_count, :current_count, :size
5
-
6
- def initialize(size, total_count = nil)
7
- @size = size
8
- @chunk = Array.new
9
- @current_count = 0
10
- @total_count = total_count
11
- end
12
-
13
- def add(row)
14
- self.reset! if is_full?
15
-
16
- @chunk.push(row)
17
-
18
- @current_count += 1
19
- end
20
-
21
- def reset!
22
- @chunk.clear
23
- end
24
-
25
- def is_full?
26
- @chunk.count == @size
27
- end
28
-
29
- def is_complete?
30
- @total_count == @current_count
31
- end
32
-
33
- end
34
- end