Class: Lipseys::User
- Inherits:
-
SoapClient
- Object
- Base
- SoapClient
- Lipseys::User
- Defined in:
- lib/lipseys/user.rb
Constant Summary collapse
- API_URL =
'https://www.lipseys.com/API/validate.asmx?WSDL'
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
-
#initialize(options = {}) ⇒ User
constructor
A new instance of User.
- #validate ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ User
Returns a new instance of User.
6 7 8 9 |
# File 'lib/lipseys/user.rb', line 6 def initialize( = {}) requires!(, :username, :password) = end |
Instance Method Details
#authenticated? ⇒ Boolean
11 12 13 |
# File 'lib/lipseys/user.rb', line 11 def authenticated? validate[:success] end |
#validate ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lipseys/user.rb', line 15 def validate body = { Credentials: { EmailAddress: [:username], Password: [:password] } } response = soap_client(API_URL).call(:validate_dealer, message: body) result = response.body[:validate_dealer_response][:validate_dealer_result] { success: (result[:success] == 'Y'), description: result[:return_desc], } rescue Savon::Error => e { success: false, description: e.to_s } end |