zoho_invoice 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/zoho_invoice/invoice.rb
CHANGED
@@ -22,7 +22,7 @@ module ZohoInvoice
|
|
22
22
|
has_many :invoice_items
|
23
23
|
|
24
24
|
def self.find_by_customer_id(client, id, options = {})
|
25
|
-
result_hash = client.get("/api/
|
25
|
+
result_hash = client.get("/api/invoices/customer/#{id}").body
|
26
26
|
potential_objects = result_hash['Response']["Invoices"]
|
27
27
|
objects_to_hydrate = potential_objects["Invoice"] if potential_objects
|
28
28
|
self.process_objects(client, objects_to_hydrate)
|
@@ -41,7 +41,7 @@ module ZohoInvoice
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def self.find_unpaid_by_customer_id(client, id, options = {})
|
44
|
-
result_hash = client.get("/api/
|
44
|
+
result_hash = client.get("/api/invoices/unpaid/customer/#{id}").body
|
45
45
|
potential_objects = result_hash['Response']["Invoices"]
|
46
46
|
objects_to_hydrate = potential_objects["Invoice"] if potential_objects
|
47
47
|
self.process_objects(client, objects_to_hydrate)
|
data/lib/zoho_invoice/version.rb
CHANGED
@@ -8,19 +8,19 @@ describe ZohoInvoice::Invoice do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should return an array if a customer has a single invoice" do
|
11
|
-
invoice_test('/api/
|
11
|
+
invoice_test('/api/invoices/customer/1234', 'successful_single_customer_response', 1, /Draft|Open|Closed|Overdue|Void/, :find_by_customer_id, @client, '1234')
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should return an array if a customer has multiple invoices" do
|
15
|
-
invoice_test('/api/
|
15
|
+
invoice_test('/api/invoices/customer/1234', 'successful_multiple_customer_response', 2, /Draft|Open|Closed|Overdue|Void/, :find_by_customer_id, @client, '1234')
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should return an empty array if a customer doesn't have any invoices" do
|
19
|
-
invoice_test('/api/
|
19
|
+
invoice_test('/api/invoices/customer/1234', 'successful_empty_customer_response', 0, //, :find_by_customer_id, @client, '1234')
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should return an error if theres an error" do
|
23
|
-
error_test('/api/
|
23
|
+
error_test('/api/invoices/customer/1234', '500_internal_server_error', :find_by_customer_id, 'Invalid value passed for XMLString', '2', '0', 500, @client, '1234')
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should return a hash if multiple customers are searched for" do
|
@@ -34,19 +34,19 @@ describe ZohoInvoice::Invoice do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should return an array if a customer has a single unpaid invoice" do
|
37
|
-
invoice_test('/api/
|
37
|
+
invoice_test('/api/invoices/unpaid/customer/1234', 'successful_unpaid_single_customer_response', 1, /Open|Overdue/, :find_unpaid_by_customer_id, @client, '1234')
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should return an array if a customer has multiple unpaid invoices" do
|
41
|
-
invoice_test('/api/
|
41
|
+
invoice_test('/api/invoices/unpaid/customer/1234', 'successful_unpaid_multiple_customer_response', 2, /Open|Overdue/, :find_unpaid_by_customer_id, @client, '1234')
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should return an empty array if a customer doesn't have any unpaid invoices" do
|
45
|
-
invoice_test('/api/
|
45
|
+
invoice_test('/api/invoices/unpaid/customer/1234', 'successful_unpaid_empty_customer_response', 0, //, :find_unpaid_by_customer_id, @client, '1234')
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should return an error if theres an error" do
|
49
|
-
error_test('/api/
|
49
|
+
error_test('/api/invoices/unpaid/customer/1234', '500_internal_server_error', :find_unpaid_by_customer_id, 'Invalid value passed for XMLString', '2', '0', 500, @client, '1234')
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should return a hash if multiple customers are searched for" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoho_invoice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|