sports_south 2.0.4 → 2.0.5

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: 34ff8eafee6d8b855e8d46a14297dfaa086ab27f
4
- data.tar.gz: b7abf90f19cc28af2916df3a345fde61534ea122
3
+ metadata.gz: a0d451f96db9f6f83dd0d248bd788e902ddda353
4
+ data.tar.gz: 30a988d68f410adfb86d244da5a57eb8eeb03ca5
5
5
  SHA512:
6
- metadata.gz: c152cb8465053591736a65d37f5a8e9dde43536bba758c91b704df3525595b6f4752f7ccd82987c0e450592508962a557181d5da7d017b26442448fa02060e30
7
- data.tar.gz: 8a09d81975ece026091695cd0bd64299c8d21162eebec928985af22e1ea436d72a2a9f6be474f4683f434d6a871df297c31c0195fc83e0fb3d91f51a5e5e01ce
6
+ metadata.gz: 8d050d0cd1a44cbfca387ced90f386f5bf272b8ec9f3d8ebed77ecdd53892d75a91a62542e03315fb5d776da59c3e424c4771f573f0db5463276b2fa1f545de0
7
+ data.tar.gz: 3e8363784078bdd1932f14d0b5636c0b2b43e31f5af147b13c1404b52ce03efc1949441cbfc54fd87528b5b8d5e344827a63f24f0d012c306e134442d415bd2b
@@ -44,6 +44,12 @@ module SportsSouth
44
44
  new(options).all(chunk_size, &block)
45
45
  end
46
46
 
47
+ def self.get_description(item_number, options = {})
48
+ requires!(options, :username, :password)
49
+
50
+ new(options, :username, :password)
51
+ end
52
+
47
53
  def all(chunk_size, &block)
48
54
  chunker = SportsSouth::Chunker.new(chunk_size)
49
55
  http, request = get_http_and_request(API_URL, '/DailyItemUpdate')
@@ -71,11 +77,25 @@ module SportsSouth
71
77
  end
72
78
  end
73
79
 
80
+ def get_description(item_number)
81
+ http, request = get_http_and_request(API_URL, '/GetText')
82
+
83
+ request.set_form_data(form_params(@options).merge({
84
+ ItemNumber: item_number
85
+ }))
86
+
87
+ response = http.request(request)
88
+ xml_doc = Nokogiri::XML(sanitize_response(response))
89
+
90
+ content_for(xml_doc, 'CATALOGTEXT')
91
+ end
92
+
74
93
  protected
75
94
 
76
95
  def map_hash(node)
77
96
  category = @categories.find { |category| category[:category_id] == content_for(node, 'CATID') }
78
97
  brand = @brands.find { |brand| brand[:brand_id] == content_for(node, 'ITBRDNO') }
98
+ long_description = self.get_description(content_for(node, 'ITEMNO'))
79
99
 
80
100
  {
81
101
  upc: content_for(node, 'ITUPC'),
@@ -83,14 +103,14 @@ module SportsSouth
83
103
  quantity: content_for(node, 'QTYOH').to_i,
84
104
  price: content_for(node, 'CPRC'),
85
105
  short_description: content_for(node, 'SHDESC'),
86
- long_description: content_for(node, 'IDESC'),
106
+ long_description: long_description,
87
107
  category: category[:department_description],
88
- sub_category: category[:description],
108
+ subcategory: category[:description],
89
109
  product_type: ITEM_TYPES[content_for(node, 'ITYPE')],
90
110
  mfg_number: content_for(node, 'IMFGNO'),
91
111
  weight: content_for(node, 'WTPBX'),
92
112
  map_price: content_for(node, 'MFPRC'),
93
- brand: brand[:name],
113
+ brand: brand.present? ? brand[:name] : nil,
94
114
  features: {
95
115
  length: content_for(node, 'LENGTH'),
96
116
  height: content_for(node, 'HEIGHT'),
@@ -1,3 +1,3 @@
1
1
  module SportsSouth
2
- VERSION = '2.0.4'
2
+ VERSION = '2.0.5'
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.4
4
+ version: 2.0.5
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-09-28 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri