Class: LearnWeb::Client::SshKeys::Add
- Inherits:
-
Object
- Object
- LearnWeb::Client::SshKeys::Add
- Includes:
- AttributePopulatable
- Defined in:
- lib/learn_web/client/ssh_keys/add.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ Add
constructor
A new instance of Add.
- #parse! ⇒ Object
Methods included from AttributePopulatable
Constructor Details
#initialize(response) ⇒ Add
Returns a new instance of Add.
10 11 12 |
# File 'lib/learn_web/client/ssh_keys/add.rb', line 10 def initialize(response) @response = response end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/learn_web/client/ssh_keys/add.rb', line 6 def data @data end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/learn_web/client/ssh_keys/add.rb', line 5 def response @response end |
Instance Method Details
#parse! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |