lipseys 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e946cb4641affbc3dd203035758d75351df7a523
4
- data.tar.gz: 53e94b7de6c9228fe57396ef8508906d22b6ded0
3
+ metadata.gz: d5d5a48bba48849118345bc5003c5e977e1a2134
4
+ data.tar.gz: 314670efa9e926b32119710c2ca09654ba54b789
5
5
  SHA512:
6
- metadata.gz: 9c24217a16c9f9fc7b704b48d6a97843327614c27de08aadc3f49db1d01bd6d89bdf6aad319213b9c74c29365ec90c38bc4c133682d9ec9a6d6d8645aa96fb9c
7
- data.tar.gz: 44c5106f99040af2cce15f5239945175cad34cddd8e24ef288b9305e7a8b4edf2ed8a536c64f49d4ca89a0cedc98bacfca18a49b453b641fa04b8f5a0f702aec
6
+ metadata.gz: 5ca79581dd4a12db3b625302fe2fbb542f3069a96523fe5afcfac12d233a661c67f40c994aefeea38af317ef7b4dcf84be7796d497ef1afafafe6e3a4f35b54a
7
+ data.tar.gz: 94e383501b78bd0149bde36736555b9d31100f84a456759166328a0e3c8931ad32ef69248d93f536f023ed3fcaae869a9db7a8e60e89d3e47c9025b1b2eabe73
@@ -5,8 +5,8 @@ module Lipseys
5
5
 
6
6
  protected
7
7
 
8
- def soap_client
9
- @soap_client ||= Savon.client(wsdl: API_URL, convert_request_keys_to: :none)
8
+ def soap_client(api_url = API_URL)
9
+ @soap_client ||= Savon.client(wsdl: api_url, convert_request_keys_to: :none)
10
10
  end
11
11
 
12
12
  end
data/lib/lipseys/user.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module Lipseys
2
- class User < Base
2
+ class User < SoapClient
3
+
4
+ API_URL = 'https://www.lipseys.com/API/validate.asmx?WSDL'
3
5
 
4
6
  def initialize(options = {})
5
7
  requires!(options, :email, :password)
@@ -7,11 +9,21 @@ module Lipseys
7
9
  end
8
10
 
9
11
  def authenticated?
10
- # As an auth check, just try to get invoices with a bogus order number.
11
- Lipseys::Invoice.all(@options.merge(order_number: 'abc'))
12
- true
13
- rescue Lipseys::NotAuthenticated
14
- false
12
+ validate[:success]
13
+ end
14
+
15
+ def validate
16
+ body = { Credentials: { EmailAddress: @options[:email], Password: @options[:password] } }
17
+ response = soap_client(API_URL).call(:validate_dealer, message: body)
18
+
19
+ result = response.body[:validate_dealer_response][:validate_dealer_result]
20
+
21
+ {
22
+ success: (result[:success] == 'Y'),
23
+ description: result[:return_desc],
24
+ }
25
+ rescue Savon::Error => e
26
+ { success: false, description: e.to_s }
15
27
  end
16
28
 
17
29
  end
@@ -1,3 +1,3 @@
1
1
  module Lipseys
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lipseys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri