Sha256: ff24786ee8c9bbdba1272dacb6579dc4c77ca6e48810eda5f2cea72f240fd4d6

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

require 'base64'
require 'pathname'

module FedexShip
  class GroundManifest
    attr_reader :manifest_data, :filename

    # Initialize FedexShip::GroundManifest Object
    # @param [Hash] options
    def initialize(options = {})
      puts options
      @filename = options[:filename]
      @manifest_data = Base64.decode64(options[:manifest][:file])
      save
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fedex_ship-0.1.0 lib/fedex_ship/ground_manifest.rb