class LearnWeb::Client::Fork::Request

Attributes

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

Public Class Methods

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

  parse!
end

Private Instance Methods

parse!() click to toggle source
# File lib/learn_web/client/fork/request.rb, line 16
def parse!
  self.status = response.status

  begin
    body = Oj.load(response.body, symbol_keys: true)
    self.message = body[:message]

    if self.message && self.message.match(/verified your email/)
      abort self.message
    end
  rescue
    self.message = 'Sorry, something went wrong. Please try again.'
  end
end