sports_south 2.0.11 → 2.0.12

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: 02e03a0edcddab55967816b373a4cbe01fd3eabb
4
- data.tar.gz: 75deced94d2527e51851217e5861969150305fae
3
+ metadata.gz: 76d7f8239e1969c1af0587fba3b4904fdba5a295
4
+ data.tar.gz: f28d2e33c094237e727349cc0ced16d13088f5ae
5
5
  SHA512:
6
- metadata.gz: f2c91b3f793bc5142a28ea20758236a73c5a2bcac03736852a847c818df4cd819475ae2dbfa04c434459ffd4ac6aaa7fc99d8d9a75e8ffb105c25520a2340dce
7
- data.tar.gz: 621adff2ae4d9c0dc7f751764e16672661eac5d60ae95756ea1da40ed8c90ad07426a7ad94c857f5299a239d2cc0d088c8b9fb7bfde0edd0543455afc8f34d8d
6
+ metadata.gz: 7dc5801c07e57a770201ffb5f4c5f82e6ce9fca6ebe18e98807aa43cbe492ea14c6398f95366900363b8a190458933656a69a47f7c144ab347fb3ce29378e0a8
7
+ data.tar.gz: 4adc2d27a3fa6e1063896b9af48f57697a4b4d6a7c132a39ea694893f63a1e5e3d32180d5154d39318a16baa8d24480ab7941abe185ecb19ddd0d433e14766a4
@@ -95,7 +95,13 @@ module SportsSouth
95
95
  def map_hash(node, full_product = false)
96
96
  category = @categories.find { |category| category[:category_id] == content_for(node, 'CATID') }
97
97
  brand = @brands.find { |brand| brand[:brand_id] == content_for(node, 'ITBRDNO') }
98
- caliber = content_for(node, 'ITATR3').present? ? content_for(node, 'ITATR3') : nil
98
+ features = self.map_features(category.except(:category_id, :department_id, :department_description, :description), node)
99
+
100
+ if features[:caliber].present?
101
+ caliber = features[:caliber]
102
+ elsif features[:gauge].present?
103
+ caliber = features[:gauge]
104
+ end
99
105
 
100
106
  if full_product
101
107
  long_description = self.get_description(content_for(node, 'ITEMNO'))
@@ -118,12 +124,37 @@ module SportsSouth
118
124
  caliber: caliber,
119
125
  map_price: content_for(node, 'MFPRC'),
120
126
  brand: brand.present? ? brand[:name] : nil,
121
- features: {
122
- length: content_for(node, 'LENGTH'),
123
- height: content_for(node, 'HEIGHT'),
124
- width: content_for(node, 'WIDTH')
125
- }
127
+ features: features
128
+ }
129
+ end
130
+
131
+ def map_features(attributes, node)
132
+ features = {
133
+ attributes[:attribute_1] => content_for(node, 'ITATR1'),
134
+ attributes[:attribute_2] => content_for(node, 'ITATR2'),
135
+ attributes[:attribute_3] => content_for(node, 'ITATR3'),
136
+ attributes[:attribute_4] => content_for(node, 'ITATR4'),
137
+ attributes[:attribute_5] => content_for(node, 'ITATR5'),
138
+ attributes[:attribute_6] => content_for(node, 'ITATR6'),
139
+ attributes[:attribute_7] => content_for(node, 'ITATR7'),
140
+ attributes[:attribute_8] => content_for(node, 'ITATR8'),
141
+ attributes[:attribute_9] => content_for(node, 'ITATR9'),
142
+ attributes[:attribute_10] => content_for(node, 'ITATR10'),
143
+ attributes[:attribute_11] => content_for(node, 'ITATR11'),
144
+ attributes[:attribute_12] => content_for(node, 'ITATR12'),
145
+ attributes[:attribute_13] => content_for(node, 'ITATR13'),
146
+ attributes[:attribute_14] => content_for(node, 'ITATR14'),
147
+ attributes[:attribute_15] => content_for(node, 'ITATR15'),
148
+ attributes[:attribute_16] => content_for(node, 'ITATR16'),
149
+ attributes[:attribute_17] => content_for(node, 'ITATR17'),
150
+ attributes[:attribute_18] => content_for(node, 'ITATR18'),
151
+ attributes[:attribute_19] => content_for(node, 'ITATR19'),
152
+ attributes[:attribute_20] => content_for(node, 'ITATR20')
126
153
  }
154
+
155
+ features.delete_if { |k, v| v.to_s.blank? }
156
+ features.transform_keys! { |k| k.gsub(/\s+/, '_').downcase }
157
+ features.symbolize_keys!
127
158
  end
128
159
 
129
160
  end
@@ -1,3 +1,3 @@
1
1
  module SportsSouth
2
- VERSION = '2.0.11'
2
+ VERSION = '2.0.12'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sports_south
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.11
4
+ version: 2.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2017-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri