invoiced 0.8.0 → 0.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f736084452a6d592a98f327acd5d3fc8409b8db
4
- data.tar.gz: 4f4ba8787785a2131686c4db8966e3c8460e4022
3
+ metadata.gz: 1b98433a3e628556bd4d294f5bae44d5b10f08fb
4
+ data.tar.gz: 6bd2918198be5721927beed9fb274e3ca5bd9328
5
5
  SHA512:
6
- metadata.gz: 416ba0ed6f5b90cd1ca822b246103b749999e0d32be0c33fdfb566955f16d0ebf76fe382ae45aae11ab4d3114ac6e0cccbe21f8634ba03419db10916cd212aa2
7
- data.tar.gz: 82345c29a000f4242968818d9a66979153ab3040d215db97179d829753d45ef77e386dea946bfe1c8857abc0aaa5ecf4073ed95bf758eb43d87898d6a5f9bd96
6
+ metadata.gz: b90dc335734439b91f07bb1bd5a22739959f49389f178d1e21dce3e77c5650fd0307dcf7223a9556bce8cbc0ec34581719b38775c637cc4f69bcc0d0df9099a5
7
+ data.tar.gz: 42bad9d2f4113e27889dfff5334be4f5f947a31afe2514bb931a5ea6f5dac5bd80730ccf20d72e0bfb8582222fe8688149997f83539c484e38ad85e64558c51f
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Invoiced
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
3
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invoiced
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared King