Class: Fedex::GroundManifest

Inherits:
Object
  • Object
show all
Defined in:
lib/fedex/ground_manifest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ GroundManifest

Initialize Fedex::GroundManifest Object


10
11
12
13
14
15
# File 'lib/fedex/ground_manifest.rb', line 10

def initialize(options = {})
  puts options
  @filename = options[:filename]
  @manifest_data = Base64.decode64(options[:manifest][:file])
  save
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename


6
7
8
# File 'lib/fedex/ground_manifest.rb', line 6

def filename
  @filename
end

#manifest_dataObject (readonly)

Returns the value of attribute manifest_data


6
7
8
# File 'lib/fedex/ground_manifest.rb', line 6

def manifest_data
  @manifest_data
end

Instance Method Details

#saveObject


17
18
19
20
21
22
23
# File 'lib/fedex/ground_manifest.rb', line 17

def save
  return if manifest_data.nil? || filename.nil?
  full_path = Pathname.new(filename)
  File.open(full_path, 'wb') do |f|
    f.write(manifest_data)
  end
end