Module: GLSAgent

Defined in:
lib/gls_agent.rb,
lib/gls_agent/dotfile.rb,
lib/gls_agent/version.rb

Defined Under Namespace

Modules: Dotfile Classes: GLSEndpointError, ParcelJob

Constant Summary collapse

VERSION =
"0.4.3".freeze

Class Method Summary collapse

Class Method Details

.job_from_csv(string) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/gls_agent.rb', line 11

def self.job_from_csv string
  fields = string.split(',')
  if fields.length != 8
    fail 'job_from_csv needs 8 fields'
    return nil
  end
  ParcelJob.new(*fields)
end

.job_from_hash(hash) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/gls_agent.rb', line 20

def self.job_from_hash hash
  ParcelJob.new(hash[:date],
                hash[:name],
                hash[:company],
                hash[:street],
                hash[:streetno],
                hash[:zip],
                hash[:city],
                hash[:weight])
end