Module: Identisure::Freja::Status

Defined in:
lib/identisure/freja.rb

Class Method Summary collapse

Class Method Details

.from_json(d) ⇒ Object



156
157
158
159
160
161
162
163
164
# File 'lib/identisure/freja.rb', line 156

def self.from_json(d)
  case d['status']
  when 'PENDING'   then Pending.from_json(d)
  when 'COMPLETED' then Completed.from_json(d)
  when 'FAILED'    then Failed.from_json(d)
  when String      then Unknown.new(status: d['status'])
  else raise IdentisureError.new(0, "Invalid freja status: #{d['status'].inspect}")
  end
end