Sha256: 3880634988a76f046a0c924f48950bfd50d70f9e727321cd59b573a5f2e32745
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
module LearnWeb class Client module User class Me attr_accessor :response, :id, :first_name, :last_name, :full_name, :username, :email, :github_gravatar, :github_uid, :data, :silent_output include LearnWeb::AttributePopulatable def initialize(response, silent_output: false) @response = response @silent_output = silent_output parse! end def parse! if response.status == 200 self.data = Oj.load(response.body, symbol_keys: true) populate_attributes! elsif silent_output == false case response.status when 401 puts "It seems your OAuth token is incorrect. Please re-run config with: learn reset" exit when 500 puts "Something went wrong. Please try again." exit else puts "Something went wrong. Please try again." exit end end self end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems