Sha256: 9cf55a2903caf990cb15a30a2f96071f1660bbea18aa685e8847e17df57dd256

Contents?: true

Size: 789 Bytes

Versions: 4

Compression:

Stored size: 789 Bytes

Contents

module LearnWeb
  class Client
    module SshKeys
      class Add
        attr_reader :response
        attr_accessor :data

        include LearnWeb::AttributePopulatable

        def initialize(response)
          @response = response
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
learn-web-1.5.5 lib/learn_web/client/ssh_keys/add.rb
learn-web-1.5.4 lib/learn_web/client/ssh_keys/add.rb
learn-web-1.5.3 lib/learn_web/client/ssh_keys/add.rb
learn-web-1.5.2 lib/learn_web/client/ssh_keys/add.rb