Module: Identisure::MitId::Status

Defined in:
lib/identisure/mit_id.rb

Class Method Summary collapse

Class Method Details

.from_json(d) ⇒ Object



138
139
140
141
142
143
144
145
146
# File 'lib/identisure/mit_id.rb', line 138

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 mitid status: #{d['status'].inspect}")
  end
end