Class: GunAccessorySupply::Tracking
- Defined in:
- lib/gun_accessory_supply/tracking.rb
Class Method Summary collapse
Instance Method Summary collapse
- #file_data(filename) ⇒ Object
- #file_names(po_numbers = []) ⇒ Object
-
#initialize(options = {}) ⇒ Tracking
constructor
A new instance of Tracking.
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ Tracking
4 5 6 7 8 |
# File 'lib/gun_accessory_supply/tracking.rb', line 4 def initialize( = {}) requires!(, :username, :password) = end |
Class Method Details
.file_data(options = {}, filename) ⇒ Object
16 17 18 19 20 |
# File 'lib/gun_accessory_supply/tracking.rb', line 16 def self.file_data( = {}, filename) requires!(, :username, :password) new().file_data(filename) end |
.file_names(options = {}, po_numbers = []) ⇒ Object
10 11 12 13 14 |
# File 'lib/gun_accessory_supply/tracking.rb', line 10 def self.file_names( = {}, po_numbers = []) requires!(, :username, :password) new().file_names(po_numbers) end |
Instance Method Details
#file_data(filename) ⇒ Object
34 35 36 |
# File 'lib/gun_accessory_supply/tracking.rb', line 34 def file_data(filename) CXML::Parser.new.parse(get_file(filename, 'out').read) end |
#file_names(po_numbers = []) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gun_accessory_supply/tracking.rb', line 22 def file_names(po_numbers = []) filename_regexes = if po_numbers.empty? [/#{GunAccessorySupply.config.tracking_filename_prefix}.*.xml/] else po_numbers.map do |po_number| /#{GunAccessorySupply.config.tracking_filename_prefix}.*#{po_number}.xml/ end end get_full_filenames(filename_regexes, 'out') end |