class LearnWeb::Client::ValidateRepo::Slug
Attributes
data[RW]
dot_learn[RW]
lab[RW]
later_lesson[RW]
lesson_id[RW]
repo_name[RW]
repo_slug[RW]
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/learn_web/client/validate_repo/slug.rb, line 11 def initialize(response) @response = response parse! end
Private Instance Methods
parse!()
click to toggle source
# File lib/learn_web/client/validate_repo/slug.rb, line 19 def parse! case response.status when 200 self.data = Oj.load(response.body, symbol_keys: true) populate_attributes! when 401 puts "It seems your OAuth token is incorrect. Please re-run config with: learn reset" exit when 422 begin self.data = Oj.load(response.body, symbol_keys: true) if data[:message].match(/Cannot find lesson/) puts "Hmm...#{data[:message]}. Please check your input and try again." exit else puts "Sorry, something went wrong. Please try again." exit end rescue puts "Sorry, something went wrong. Please try again." exit end when 500 puts "Sorry, something went wrong. Please try again." exit else puts "Sorry, something went wrong. Please try again." exit end end