kashflow_soap 0.0.0 → 0.0.1

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.
Files changed (2) hide show
  1. data/lib/kashflow_soap.rb +20 -2
  2. metadata +1 -1
data/lib/kashflow_soap.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "exceptions.rb"
2
+
1
3
  class KashflowSoap
2
4
 
3
5
  def initialize username, password, options
@@ -26,7 +28,13 @@ class KashflowSoap
26
28
  response = response.body["#{m}_response".to_sym]
27
29
  result = response["#{m}_result".to_sym]
28
30
  status = response[:status]
29
- result if status != "NO"
31
+ status_detail = response[:status_detail]
32
+
33
+ if status == "NO" && status_detail == "Incorrect username or password"
34
+ raise KashflowAuthenticationError
35
+ else
36
+ result
37
+ end
30
38
  end
31
39
 
32
40
  def insert_customer customer
@@ -41,17 +49,27 @@ class KashflowSoap
41
49
  call :get_customer_by_id, {CustomerID: id.to_s}
42
50
  end
43
51
 
52
+ def get_nominal_codes
53
+ call :get_nominal_codes
54
+ end
55
+
44
56
  def insert_invoice invoice
45
57
  result = call :insert_invoice, {Inv: invoice}
46
58
  if result
47
59
  invoice[:InvoiceNumber] = result
48
60
  invoice
61
+ else
62
+ raise StandardError
49
63
  end
50
64
  end
51
65
 
52
66
  def get_invoice id
53
67
  invoice = call :get_invoice, {InvoiceNumber: id.to_s}
54
- invoice if invoice[:invoice_dbid] != "0"
68
+ if invoice && invoice[:invoice_dbid] != "0"
69
+ invoice
70
+ else
71
+ raise StandardError
72
+ end
55
73
  end
56
74
 
57
75
  def get_inv_pay_methods
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kashflow_soap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: