Class: IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::LoginModel
- Inherits:
-
BasicActiveModel
- Object
- BasicActiveModel
- IdnSdkRuby::Com::Nbos::Capi::Modules::Identity::V0::LoginModel
- Defined in:
- lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
-
#messageCode ⇒ Object
Returns the value of attribute messageCode.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #add_errors(json_response) ⇒ Object
- #add_messages(json_response) ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize(name = nil, code = nil) ⇒ LoginModel
constructor
A new instance of LoginModel.
- #to_json(*options) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name = nil, code = nil) ⇒ LoginModel
Returns a new instance of LoginModel.
12 13 14 15 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 12 def initialize(name = nil, code = nil) @username = name @password = code end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
10 11 12 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 10 def @message end |
#messageCode ⇒ Object
Returns the value of attribute messageCode.
10 11 12 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 10 def @messageCode end |
#password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 10 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
10 11 12 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 10 def username @username end |
Instance Method Details
#add_errors(json_response) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 17 def add_errors(json_response) json_response["errors"].each do |e| property_name = e['propertyName'] msg = e['message'] self.errors[property_name] << msg end end |
#add_messages(json_response) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 25 def (json_response) if json_response["message"].present? @message = json_response["message"] elsif json_response["error"].present? @message = json_response["error"] end end |
#as_json(options = {}) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 34 def as_json(={}) { username: @username, password: @password, messageCode: @messageCode, message: @message } end |
#to_json(*options) ⇒ Object
43 44 45 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 43 def to_json(*) as_json(*).to_json(*) end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/idn_sdk_ruby/com/nbos/capi/modules/identity/v0/login_model.rb', line 47 def to_s to_json end |