invoiced 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/invoiced/estimate.rb +8 -0
- data/lib/invoiced/version.rb +1 -1
- data/test/invoiced/estimate_test.rb +15 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b98433a3e628556bd4d294f5bae44d5b10f08fb
|
4
|
+
data.tar.gz: 6bd2918198be5721927beed9fb274e3ca5bd9328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b90dc335734439b91f07bb1bd5a22739959f49389f178d1e21dce3e77c5650fd0307dcf7223a9556bce8cbc0ec34581719b38775c637cc4f69bcc0d0df9099a5
|
7
|
+
data.tar.gz: 42bad9d2f4113e27889dfff5334be4f5f947a31afe2514bb931a5ea6f5dac5bd80730ccf20d72e0bfb8582222fe8688149997f83539c484e38ad85e64558c51f
|
data/lib/invoiced/estimate.rb
CHANGED
@@ -13,6 +13,14 @@ module Invoiced
|
|
13
13
|
Util.build_objects(email, response[:body])
|
14
14
|
end
|
15
15
|
|
16
|
+
def generate_invoice(opts={})
|
17
|
+
response = @client.request(:post, "#{self.endpoint()}/invoice", opts)
|
18
|
+
|
19
|
+
# build invoice object
|
20
|
+
invoice = Invoice.new(@client)
|
21
|
+
Util.convert_to_object(invoice, response[:body])
|
22
|
+
end
|
23
|
+
|
16
24
|
def attachments(opts={})
|
17
25
|
response = @client.request(:get, "#{self.endpoint()}/attachments", opts)
|
18
26
|
|
data/lib/invoiced/version.rb
CHANGED
@@ -104,6 +104,21 @@ module Invoiced
|
|
104
104
|
assert_equal(4567, emails[0].id)
|
105
105
|
end
|
106
106
|
|
107
|
+
should "create an invoice" do
|
108
|
+
mockResponse = mock('RestClient::Response')
|
109
|
+
mockResponse.stubs(:code).returns(201)
|
110
|
+
mockResponse.stubs(:body).returns('{"id":4567,"total":100}')
|
111
|
+
mockResponse.stubs(:headers).returns({})
|
112
|
+
|
113
|
+
RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
|
114
|
+
|
115
|
+
estimate = Estimate.new(@client, 123)
|
116
|
+
invoice = estimate.generate_invoice
|
117
|
+
|
118
|
+
assert_instance_of(Invoiced::Invoice, invoice)
|
119
|
+
assert_equal(4567, invoice.id)
|
120
|
+
end
|
121
|
+
|
107
122
|
should "list all of the estimate's attachments" do
|
108
123
|
mockResponse = mock('RestClient::Response')
|
109
124
|
mockResponse.stubs(:code).returns(200)
|