Class: Zanders::User

Inherits:
SoapClient show all
Defined in:
lib/zanders/user.rb

Constant Summary

Constants inherited from SoapClient

SoapClient::NAMESPACES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

connect

Constructor Details

#initialize(options = {}) ⇒ User

Returns a new instance of User.



6
7
8
9
10
11
# File 'lib/zanders/user.rb', line 6

def initialize(options = {})
  requires!(options, :username, :password)

  @username = options[:username]
  @password = options[:password]
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/zanders/user.rb', line 4

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



4
5
6
# File 'lib/zanders/user.rb', line 4

def username
  @username
end

Instance Method Details

#authenticated?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
# File 'lib/zanders/user.rb', line 13

def authenticated?
  response = soap_client(ITEM_API_URL).call(:login_check, message: build_request_data)
  response = response.body[:login_check_response][:return][:item]

  response.first[:value] == "0"
end