class LearnWeb::Client::SshKeys::Add

Attributes

data[RW]
response[R]

Public Class Methods

new(response) click to toggle source
# File lib/learn_web/client/ssh_keys/add.rb, line 10
def initialize(response)
  @response = response
end

Public Instance Methods

parse!() click to toggle source
# File lib/learn_web/client/ssh_keys/add.rb, line 14
def parse!
  if response.status == 200
    self.data = Oj.load(response.body, symbol_keys: true)

    populate_attributes!
    self
  else
    case response.status
    when 304
      puts "This key is already in use."
    when 422
      puts "Something went wrong. Please try again."
    else
      puts "Something went wrong. Please try again."
    end
    :error
  end
end