class LearnWeb::Client::PullRequest::Response

Attributes

data[R]
message[RW]
status[RW]

Public Class Methods

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

  parse!
end

Private Instance Methods

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

  begin
    body = Oj.load(data.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