Sha256: 2bb70afa8c9a7d3265aace4bb139e19edeb66d5abd47eeb8f96e30ef915c5dec

Contents?: true

Size: 648 Bytes

Versions: 9

Compression:

Stored size: 648 Bytes

Contents

module LearnWeb
  class Client
    module Environment
      class Verification
        attr_reader   :response
        attr_accessor :message, :status

        def initialize(response)
          @response = response

          parse!
        end

        def success?
          status == 200
        end

        private

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
learn-web-1.5.5 lib/learn_web/client/environment/verification.rb
learn-web-1.5.4 lib/learn_web/client/environment/verification.rb
learn-web-1.5.3 lib/learn_web/client/environment/verification.rb
learn-web-1.5.2 lib/learn_web/client/environment/verification.rb
learn-web-1.5.1 lib/learn_web/client/environment/verification.rb
learn-web-1.5.0 lib/learn_web/client/environment/verification.rb
learn-web-1.4.2 lib/learn_web/client/environment/verification.rb
learn-web-1.4.1 lib/learn_web/client/environment/verification.rb
learn-web-1.4.0 lib/learn_web/client/environment/verification.rb