Module: Nis::Util

Defined in:
lib/nis/util.rb,
lib/nis/util/assignable.rb

Defined Under Namespace

Modules: Assignable

Constant Summary collapse

NEM_EPOCH =
Time.utc(2015, 3, 29, 0, 6, 25, 0)

Class Method Summary collapse

Class Method Details

.error_handling(hash) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'lib/nis/util.rb', line 8

def self.error_handling(hash)
  error_klass = case hash[:error]
                when 'Not Found' then Nis::NotFoundError
                when 'Bad Request' then Nis::BadRequestError
                when 'Internal Server Error' then Nis::InternalServerError
                else Nis::Error
  end
  error_klass.new(hash[:message])
end

.timestampObject


4
5
6
# File 'lib/nis/util.rb', line 4

def self.timestamp
  (Time.now - NEM_EPOCH).to_i
end