gun_accessory_supply 0.0.2 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2fe7a5553b787d43d52c0cadb9a6425e68926dc40894227df1fe411e91cc6be
4
- data.tar.gz: 60a38f322d1c5f652b7af6b2c86032664f26efac060fc82171c8f8bb996db43d
3
+ metadata.gz: adf4003e7ce333052c677e91eb6e09a72c38e158b9331d684b08aaffd3d9a867
4
+ data.tar.gz: d1108146ba8e8a17e9a1afa4d9e6620f5bab0703b285e415d122a5cbff8eb060
5
5
  SHA512:
6
- metadata.gz: ba7715b9801c91b4caa21025161fa95a8e5af5e15bfce83937ca77fe848ff4376aed8f56cfc26765049224cc7e1d4e99de1c98ae2075ed922256fbaff64cae4c
7
- data.tar.gz: 432ee3fe3f9b3cb713a542e32d37b17346aee29a5368cc96920b63e6add91d97086fe9f73905d55acc8ba024d10f076306622c78dc8cfa1d5f14c1ec13fc2cf1
6
+ metadata.gz: ab3795c87f78a0fdda4e9bde251e140078043b8bd49fb93eec5c3943a18524085baaa190b3dbdd63c65a28a05edeed7958f056e6bca3141f17e711a8da235f4d
7
+ data.tar.gz: 5ae910db9102ee76f8fec9978c8107e148a8a4e29d7367d67364bcf5def128a6372487ce7271bf8e1f68fa8110f9237062d0be0078cf22832b50428054c56959
@@ -31,7 +31,7 @@ module GunAccessorySupply
31
31
  item = {
32
32
  item_identifier: row[@headers.index('Item ID')].try(:strip),
33
33
  quantity: row[@headers.index('Available Qty')].to_i,
34
- price: row[@headers.index('MSRP')].try(:strip),
34
+ price: row[@headers.index('Dealer Cost')].try(:strip),
35
35
  }
36
36
 
37
37
  items << item
@@ -32,7 +32,7 @@ module GunAccessorySupply
32
32
  # * :special_instructions [String] optional
33
33
  def add_recipient(hash = {})
34
34
  requires!(hash, :dealer_name, :shipping)
35
- requires!(hash[:shipping], :name, :address, :city, :state, :zip, :email, :phone)
35
+ requires!(hash[:shipping], :name, :address, :city, :state, :zip, :email)
36
36
 
37
37
  @recipient = hash
38
38
  end
@@ -45,13 +45,16 @@ module GunAccessorySupply
45
45
  # * :price [String]
46
46
  def add_item(item = {})
47
47
  requires!(item, :identifier, :upc, :qty)
48
+
48
49
  @items << item
49
50
  end
50
51
 
51
52
  def filename
52
- return @filename if defined?(@filename)
53
- timestamp = Time.now.strftime('%Y%m%d%T').gsub(':', '')
54
- @filename = "GUN-ACCESSORY-SUPPLY-#{@po_number}-#{timestamp}.xml"
53
+ @filename ||= begin
54
+ timestamp = Time.now.strftime('%Y%m%d%T').gsub(':', '')
55
+
56
+ "GUN-ACCESSORY-SUPPLY-#{@po_number}-#{timestamp}.xml"
57
+ end
55
58
  end
56
59
 
57
60
  def submit!
@@ -60,7 +63,6 @@ module GunAccessorySupply
60
63
 
61
64
  def to_xml
62
65
  output = ""
63
-
64
66
  xml = Builder::XmlMarkup.new(target: output, indent: 2)
65
67
 
66
68
  xml.instruct!(:xml)
@@ -68,23 +70,23 @@ module GunAccessorySupply
68
70
  xml.cXML(timestamp: Time.now) do
69
71
  xml.Header do
70
72
  xml.From do
71
- xml.Credential(domain: @xml_domain) do
72
- xml.Identity @xml_domain
73
- xml.SharedSecret @xml_secret
73
+ xml.Credential(domain: GunAccessorySupply.config.xml_domain) do
74
+ xml.Identity GunAccessorySupply.config.xml_domain
75
+ xml.SharedSecret GunAccessorySupply.config.xml_secret
74
76
  xml.OrderID @po_number
75
77
  end
76
78
  end
77
79
  xml.To do
78
- xml.Credential(domain: @xml_domain) do
79
- xml.Identity @xml_domain
80
- xml.SharedSecret @xml_secret
80
+ xml.Credential(domain: GunAccessorySupply.config.xml_domain) do
81
+ xml.Identity GunAccessorySupply.config.xml_domain
82
+ xml.SharedSecret GunAccessorySupply.config.xml_secret
81
83
  xml.OrderID @po_number
82
84
  end
83
85
  end
84
86
  xml.Sender do
85
- xml.Credential(domain: @xml_domain) do
86
- xml.Identity @xml_domain
87
- xml.SharedSecret @xml_secret
87
+ xml.Credential(domain: GunAccessorySupply.config.xml_domain) do
88
+ xml.Identity GunAccessorySupply.config.xml_domain
89
+ xml.SharedSecret GunAccessorySupply.config.xml_secret
88
90
  xml.OrderID @po_number
89
91
  end
90
92
  end
@@ -94,7 +96,7 @@ module GunAccessorySupply
94
96
  xml.OrderRequest do
95
97
  xml.OrderRequestHeader(orderDate: Time.now, type: 'new') do
96
98
  xml.ShipTo do
97
- xml.Address do
99
+ xml.Address(addressID: @ship_to_id) do
98
100
  xml.Name @recipient[:dealer_name]
99
101
  xml.Email @recipient[:shipping][:email]
100
102
  xml.PostalAddress do
@@ -108,7 +110,7 @@ module GunAccessorySupply
108
110
  end
109
111
  end
110
112
  xml.BillTo do
111
- xml.Address(addressID: @ship_to_id) do
113
+ xml.Address do
112
114
  xml.Name @recipient[:dealer_name]
113
115
  xml.Email @recipient[:shipping][:email]
114
116
  xml.PostalAddress do
@@ -1,3 +1,3 @@
1
1
  module GunAccessorySupply
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.5'.freeze
3
3
  end
@@ -1,11 +1,8 @@
1
1
  require 'gun_accessory_supply/version'
2
-
3
2
  require 'csv'
4
3
  require 'net/sftp'
5
4
  require 'tempfile'
6
-
7
5
  require 'active_support/all'
8
-
9
6
  require 'gun_accessory_supply/base'
10
7
  require 'gun_accessory_supply/catalog'
11
8
  require 'gun_accessory_supply/category'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gun_accessory_supply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Beninate
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-23 00:00:00.000000000 Z
11
+ date: 2022-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport