Sha256: d6d365273a44f533eb192928c8fc12f7e4738a5bbce4567c4bfc8cf13ab2c287

Contents?: true

Size: 703 Bytes

Versions: 7

Compression:

Stored size: 703 Bytes

Contents

module LearnWeb
  class Client
    module PullRequest
      class Response
        attr_accessor :message, :status
        attr_reader   :data

        def initialize(response_data)
          @data = response_data

          parse!
        end

        private

        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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
learn-web-1.5.5 lib/learn_web/client/pull_request/response.rb
learn-web-1.5.4 lib/learn_web/client/pull_request/response.rb
learn-web-1.5.3 lib/learn_web/client/pull_request/response.rb
learn-web-1.5.2 lib/learn_web/client/pull_request/response.rb
learn-web-1.5.1 lib/learn_web/client/pull_request/response.rb
learn-web-1.5.0 lib/learn_web/client/pull_request/response.rb
learn-web-1.4.2 lib/learn_web/client/pull_request/response.rb