class LearnWeb::Client::Environment::Verification

Attributes

message[RW]
response[R]
status[RW]

Public Class Methods

new(response) click to toggle source
# File lib/learn_web/client/environment/verification.rb, line 8
def initialize(response)
  @response = response

  parse!
end

Public Instance Methods

success?() click to toggle source
# File lib/learn_web/client/environment/verification.rb, line 14
def success?
  status == 200
end

Private Instance Methods

parse!() click to toggle source
# File lib/learn_web/client/environment/verification.rb, line 20
def parse!
  self.status = response.status

  begin
    body = Oj.load(response.body, symbol_keys: true)
    self.message = body[:message]
  rescue
    self.message = 'Sorry, something went wrong. Please try again.'
  end
end